forked from dolthub/swiss
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathnativemap_test.go
More file actions
51 lines (44 loc) · 1019 Bytes
/
nativemap_test.go
File metadata and controls
51 lines (44 loc) · 1019 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
49
50
51
package set3
import (
"testing"
)
func TestNativeMapEmptyNativeWithCapacity(t *testing.T) {
set := emptyNativeWithCapacity[int](0)
if set == nil {
t.Error("Expected non-nil set")
}
if set.count() != uint32(0) {
t.Errorf("Expected count to be 0, got %d", set.count())
}
}
func TestNativeMapAddAndContains(t *testing.T) {
set := emptyNativeWithCapacity[int](0)
set.add(1)
set.add(2)
set.add(3)
if !set.contains(1) {
t.Error("Expected set to contain 1")
}
if !set.contains(2) {
t.Error("Expected set to contain 2")
}
if !set.contains(3) {
t.Error("Expected set to contain 3")
}
if set.contains(4) {
t.Error("Expected set not to contain 4")
}
}
func TestNativeMapCount(t *testing.T) {
set := emptyNativeWithCapacity[int](0)
set.add(1)
set.add(2)
set.add(3)
if set.count() != 3 {
t.Errorf("Expected count to be 3, got %d", set.count())
}
set.add(3) // Adding duplicate
if set.count() != 3 {
t.Errorf("Expected count to be 3 after adding duplicate, got %d", set.count())
}
}