-
Notifications
You must be signed in to change notification settings - Fork 10
/
eq.ahk
49 lines (35 loc) · 914 Bytes
/
eq.ahk
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
eq(param_value, param_other) {
; prepare
if (isObject(param_value)) {
param_value := this._internal_stringify(param_value)
param_other := this._internal_stringify(param_other)
}
; create
if (param_value == param_other) {
return true
}
return false
}
; tests
object := {"a": 1}
other := {"a": 1}
assert.true(A.eq(object, other))
assert.true(A.eq("a", "a"))
assert.true(A.eq("", ""))
; omit
assert.label("different object")
assert.false(A.eq({"a": 2}, {"a": 1}))
assert.label("different string")
assert.false(A.eq("b", "a"))
assert.label("different empty string")
assert.false(A.eq(" ", ""))
assert.label("number")
assert.true(A.eq(1, 1))
assert.label("different number")
assert.false(A.eq(2, 1))
assert.label("boolean")
assert.true(A.eq(true, true))
assert.label("different boolean")
assert.false(A.eq(true, false))
assert.label("Testing with undefined values")
assert.true(A.eq("", ""))