- package mishmash
-
- import (
- "fmt"
- "testing"
- )
-
- func TestMishmash(t *testing.T) {
- want := "9d923077"
- if got := fmt.Sprintf("%08x", Mishmash([]byte("google.com"))); want != got {
- t.Error("Parse() = got", got, "want", want)
- } else {
- fmt.Println("TestMishmash Passed")
- }
- }
-
- func TestSecondHash(t *testing.T) {
- want := "3fbdb348"
- hash := Mishmash([]byte("google.com"))
- if got := fmt.Sprintf("%08x", Mishmash([]byte("google.com"), uint64(hash))); want != got {
- t.Error("Parse() = got", got, "want", want)
- } else {
- fmt.Println("TestSecondHash Passed")
- }
- }
-
- func TestSeedOne(t *testing.T) {
- want := "cebf5691"
- if got := fmt.Sprintf("%08x", Mishmash([]byte("google.com"), uint64(1))); want != got {
- t.Error("Parse() = got", got, "want", want)
- } else {
- fmt.Println("TestSeedOne Passed")
- }
- }
-
- func TestEngineAndAccumulator(t *testing.T) {
- want := "65df1304"
- test := []byte("google.com")
- accum := Engine(test, len(test), 0)
- if got := fmt.Sprintf("%08x", Mishmash(test, accum)); want != got {
- t.Error("Parse() = got", got, "want", want)
- } else {
- fmt.Println("TestEngineAndAccumulator Passed")
- }
- }
|