MCPcopy
hub / github.com/google/mangle / TestAtomHash

Function TestAtomHash

ast/ast_test.go:259–270  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

257}
258
259func TestAtomHash(t *testing.T) {
260 a := NewAtom("bar", String("foo"))
261 h := fnv.New64()
262 h.Write([]byte(a.Predicate.Symbol))
263 b := make([]byte, 8)
264 binary.LittleEndian.PutUint64(b, a.Args[0].(Constant).Hash())
265 h.Write(b)
266 expected := h.Sum64()
267 if a.Hash() != expected {
268 t.Errorf("(%v).Hash() expected %v got %v", a, expected, a.Hash())
269 }
270}
271
272func TestString(t *testing.T) {
273 tests := []struct {

Callers

nothing calls this directly

Calls 4

HashMethod · 0.95
NewAtomFunction · 0.85
StringFunction · 0.85
HashMethod · 0.65

Tested by

no test coverage detected