Skip to content

Commit 82e95d2

Browse files
robyoderdeckarep
authored andcommitted
Add thread safe test for PowerSet()
This test fails but shouldn’t.
1 parent 504e848 commit 82e95d2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

set_test.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1045,6 +1045,20 @@ func Test_PowerSet(t *testing.T) {
10451045
}
10461046
}
10471047

1048+
func Test_PowerSetThreadSafe(t *testing.T) {
1049+
set := NewSet().PowerSet()
1050+
_, setIsThreadSafe := set.(*threadSafeSet)
1051+
if !setIsThreadSafe {
1052+
t.Error("result of PowerSet should be thread safe")
1053+
}
1054+
1055+
subset := set.Pop()
1056+
_, subsetIsThreadSafe := subset.(*threadSafeSet)
1057+
if !subsetIsThreadSafe {
1058+
t.Error("subsets in PowerSet result should be thread safe")
1059+
}
1060+
}
1061+
10481062
func Test_EmptySetProperties(t *testing.T) {
10491063
empty := NewSet()
10501064

0 commit comments

Comments
 (0)