MCPcopy Create free account
hub / github.com/IceFireDB/IceFireDB / testHashArray

Function testHashArray

hashes_test.go:74–91  ·  view source on GitHub ↗
(ay []interface{}, checkValues ...int)

Source from the content-addressed store, hash-verified

72 t.Fatal(n)
73 }
74}
75
76func testHashArray(ay []interface{}, checkValues ...int) error {
77 if len(ay) != len(checkValues) {
78 return fmt.Errorf("invalid return number %d != %d", len(ay), len(checkValues))
79 }
80
81 for i := 0; i < len(ay); i++ {
82 if ay[i] == nil && checkValues[i] != 0 {
83 return fmt.Errorf("must nil")
84 } else if ay[i] != nil {
85 d := cast.ToInt(ay[i])
86
87 if d != checkValues[i] {
88 return fmt.Errorf("invalid data %d %v != %d", i, d, checkValues[i])
89 }
90 }
91 }
92 return nil
93}
94

Callers 2

TestHashMFunction · 0.85
TestHashGetAllFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected