summaryrefslogtreecommitdiff
path: root/lib/cryptohash/test/util.myr
diff options
context:
space:
mode:
authorOri Bernstein <ori@eigenstate.org>2015-08-26 12:20:58 -0700
committerOri Bernstein <ori@eigenstate.org>2015-08-26 12:20:58 -0700
commit2bc852bda98762d3bc01548bf972e3f1b137fbfb (patch)
tree74831deed3c9057c5fe0cbb8790d220e855bc792 /lib/cryptohash/test/util.myr
parent3de952510eb2a23350d24ed926f19c0cf72a12f2 (diff)
downloadmc-2bc852bda98762d3bc01548bf972e3f1b137fbfb.tar.gz
Move Myrddin libs to lib/ subdirectory.
Diffstat (limited to 'lib/cryptohash/test/util.myr')
-rw-r--r--lib/cryptohash/test/util.myr19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/cryptohash/test/util.myr b/lib/cryptohash/test/util.myr
new file mode 100644
index 0000000..ceb411c
--- /dev/null
+++ b/lib/cryptohash/test/util.myr
@@ -0,0 +1,19 @@
+use std
+
+pkg =
+ const hasheq : (got : byte[:], expected : byte[:] -> void)
+;;
+
+const hasheq = {got, expected
+ var sb, str
+
+ sb = std.mksb()
+ for x in got
+ std.sbfmt(sb, "{p=0,w=2,x}", x)
+ ;;
+ str = std.sbfin(sb)
+ if (!std.sleq(str, expected))
+ std.fatal("mismatched hashes:\n\tgot:\t{}\n\texpected:\t{}\n", str, expected)
+ ;;
+ std.slfree(str)
+}