-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathset_test.go
More file actions
48 lines (35 loc) · 738 Bytes
/
set_test.go
File metadata and controls
48 lines (35 loc) · 738 Bytes
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
package hob
import (
"log"
"testing"
"github.com/bmizerany/assert"
"github.com/mrb/hob"
)
func TestSet(t *testing.T) {
set := hob.NewSet()
set.Add("Key1")
key1 := set.Test("Key1")
key2 := set.Test("Key2")
assert.T(t, key1 == true)
assert.T(t, key2 == false)
set.Add("Key2")
key2 = set.Test("Key2")
assert.T(t, key2 == true)
set.Remove("Key2")
key2 = set.Test("Key2")
assert.T(t, key2 == false)
set.Add("Key3")
set.Add("Key4")
set.Add("Key5")
set.Add("Key6")
set.Add("Key7")
log.Print(set.Slice())
set2 := hob.NewSet()
set2.Add("Key1")
set2.Add("Okey1")
set2.Add("Okey23")
union := set.Union(set2)
log.Print(union.Slice())
intersection := set.Intersection(set2)
log.Print(intersection.Slice())
}