Added tests for std::hasher

parent bb35dea7
......@@ -27,6 +27,7 @@ import test::std::test_float
import test::std::test_format
import test::std::test_fs
import test::std::test_hash_map
import test::std::test_hasher
import test::std::test_inspect
import test::std::test_integer
import test::std::test_io
......
import std::hasher::DefaultHasher
import std::test
import std::test::assert
test.group('std::hasher::DefaultHasher.write_integer') do (g) {
g.test('Hashing an Integer') {
let hasher = DefaultHasher.new
hasher.write_integer(10)
let hash1 = hasher.finish
hasher.write_integer(10)
let hash2 = hasher.finish
assert.equal(hash1, hash2)
}
}
test.group('std::hasher::DefaultHasher.write_float') do (g) {
g.test('Hashing an Float') {
let hasher = DefaultHasher.new
hasher.write_float(10.0)
let hash1 = hasher.finish
hasher.write_float(10.0)
let hash2 = hasher.finish
assert.equal(hash1, hash2)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment