-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
comparators_test.go
54 lines (39 loc) · 1.03 KB
/
comparators_test.go
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
50
51
52
53
54
package gosl
import (
"github.com/stretchr/testify/assert"
"testing"
)
func BenchmarkEquals(b *testing.B) {
for i := 0; i < b.N; i++ {
Equals("hello", "hello")
}
}
func BenchmarkNotEquals(b *testing.B) {
for i := 0; i < b.N; i++ {
NotEquals(42, 64)
}
}
func TestEquals(t *testing.T) {
b := Equals("hello", "hello")
assert.EqualValues(t, b, true)
b = Equals(42, 64)
assert.EqualValues(t, b, false)
g1 := GenericUtility[any, string]{} // tests for method
b = g1.Equals("hello", "hello")
assert.EqualValues(t, b, true)
g2 := GenericUtility[any, int]{} // tests for method
b = g2.Equals(42, 64)
assert.EqualValues(t, b, false)
}
func TestNotEquals(t *testing.T) {
b := NotEquals("hello", "hello")
assert.EqualValues(t, b, false)
b = NotEquals(42, 64)
assert.EqualValues(t, b, true)
g1 := GenericUtility[any, string]{} // tests for method
b = g1.NotEquals("hello", "hello")
assert.EqualValues(t, b, false)
g2 := GenericUtility[any, int]{} // tests for method
b = g2.NotEquals(42, 64)
assert.EqualValues(t, b, true)
}