summary refs log tree commit diff stats
path: root/tests/sets
diff options
context:
space:
mode:
authorSimon Hafner <hafnersimon@gmail.com>2014-01-31 18:22:27 -0600
committerSimon Hafner <hafnersimon@gmail.com>2014-01-31 18:22:27 -0600
commit2c5a2d07fb3bb25dcb590d61882f88528ea17e91 (patch)
tree33a360aa77e7f205af243ed116066cbb483988d1 /tests/sets
parente01fb17d023b046b3403a4413a637d24a9dc492f (diff)
downloadNim-2c5a2d07fb3bb25dcb590d61882f88528ea17e91.tar.gz
sets equivalence
Diffstat (limited to 'tests/sets')
-rw-r--r--tests/sets/testequivalence.nim16
1 files changed, 16 insertions, 0 deletions
diff --git a/tests/sets/testequivalence.nim b/tests/sets/testequivalence.nim
new file mode 100644
index 000000000..a1e02fee7
--- /dev/null
+++ b/tests/sets/testequivalence.nim
@@ -0,0 +1,16 @@
+import unittest
+import sets
+
+suite "sets":
+  test "equivalent or subset":
+    check toSet(@[1,2,3]) <= toSet(@[1,2,3,4])
+    check toSet(@[1,2,3]) <= toSet(@[1,2,3])
+    check(not(toSet(@[1,2,3]) <= toSet(@[1,2])))
+  test "strict subset":
+    check toSet(@[1,2,3]) <= toSet(@[1,2,3,4])
+    check(not(toSet(@[1,2,3]) < toSet(@[1,2,3])))
+    check(not(toSet(@[1,2,3]) < toSet(@[1,2])))
+  test "==":
+    check(not(toSet(@[1,2,3]) == toSet(@[1,2,3,4])))
+    check toSet(@[1,2,3]) == toSet(@[1,2,3])
+    check(not(toSet(@[1,2,3]) == toSet(@[1,2])))