aboutsummaryrefslogtreecommitdiff
path: root/test/mst_test.exs
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2018-07-20 16:07:13 +0200
committerAlex Auvolat <alex@adnab.me>2018-07-20 16:07:13 +0200
commit87a35ab4741eaf78ec3eddc8c7452ef2a32477b7 (patch)
treea7624aca36ca772d808a49d701cad860a065ff91 /test/mst_test.exs
parenta624a8504c722a2c561ce147f64c2a1a0bb6f4b0 (diff)
downloadshard-87a35ab4741eaf78ec3eddc8c7452ef2a32477b7.tar.gz
shard-87a35ab4741eaf78ec3eddc8c7452ef2a32477b7.zip
Add get call and associated test
Diffstat (limited to 'test/mst_test.exs')
-rw-r--r--test/mst_test.exs13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/mst_test.exs b/test/mst_test.exs
index 68886c7..6615b6e 100644
--- a/test/mst_test.exs
+++ b/test/mst_test.exs
@@ -11,6 +11,14 @@ defmodule ShardTest.MST do
z = Enum.reduce(Enum.shuffle(0..1000), MST.new(),
fn i, acc -> MST.insert(acc, i, i) end)
+ for i <- 0..1000 do
+ assert MST.get(y, i) == i
+ assert MST.get(z, i) == i
+ end
+ assert MST.get(y, 9999) == nil
+ assert MST.get(z, -1001) == nil
+ assert MST.get(z, 1.01) == nil
+
IO.puts "y.root: #{y.root|>Base.encode16}"
IO.puts "z.root: #{z.root|>Base.encode16}"
assert y.root == z.root
@@ -28,6 +36,11 @@ defmodule ShardTest.MST do
z = Enum.reduce(Enum.shuffle(items), MST.new(),
fn {k, v}, acc -> MST.insert(acc, k, v) end)
+ for {k, v} <- items do
+ assert MST.get(y, k) == v
+ assert MST.get(z, k) == v
+ end
+
IO.puts "y.root: #{y.root|>Base.encode16}"
IO.puts "z.root: #{z.root|>Base.encode16}"
assert y.root == z.root