MCPcopy Create free account
hub / github.com/goadesign/goa / TestPrimitiveHash

Function TestPrimitiveHash

expr/hasher_test.go:5–46  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3import "testing"
4
5func TestPrimitiveHash(t *testing.T) {
6 cases := map[string]Primitive{
7 "boolean": Boolean,
8 "int": Int,
9 "int32": Int32,
10 "int64": Int64,
11 "uint": UInt,
12 "uint32": UInt32,
13 "uint64": UInt64,
14 "float32": Float32,
15 "float64": Float64,
16 "string": String,
17 "bytes": Bytes,
18 "any": Any,
19 }
20 for k, p := range cases {
21 if actual := Hash(p, true, false, false); k != actual {
22 t.Errorf("%s: got %#v, expected %#v", k, actual, k)
23 }
24 if actual := Hash(p, true, false, true); k != actual {
25 t.Errorf("%s: got %#v, expected %#v", k, actual, k)
26 }
27 if actual := Hash(p, true, true, false); k != actual {
28 t.Errorf("%s: got %#v, expected %#v", k, actual, k)
29 }
30 if actual := Hash(p, true, true, true); k != actual {
31 t.Errorf("%s: got %#v, expected %#v", k, actual, k)
32 }
33 if actual := Hash(p, false, false, false); k != actual {
34 t.Errorf("%s: got %#v, expected %#v", k, actual, k)
35 }
36 if actual := Hash(p, false, false, true); k != actual {
37 t.Errorf("%s: got %#v, expected %#v", k, actual, k)
38 }
39 if actual := Hash(p, false, true, false); k != actual {
40 t.Errorf("%s: got %#v, expected %#v", k, actual, k)
41 }
42 if actual := Hash(p, false, true, true); k != actual {
43 t.Errorf("%s: got %#v, expected %#v", k, actual, k)
44 }
45 }
46}
47
48func TestObjectHash(t *testing.T) {
49 var (

Callers

nothing calls this directly

Calls 1

HashFunction · 0.85

Tested by

no test coverage detected