MCPcopy Create free account
hub / github.com/WICG/webpackage / TestTextStringIsDeterministic

Function TestTextStringIsDeterministic

go/internal/cbor/deterministic_test.go:160–170  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

158}
159
160func TestTextStringIsDeterministic(t *testing.T) {
161 hello := multiappend([]byte{toCborHeader(TypeText, 5)}, []byte("hello"))
162 hello2 := multiappend([]byte{toCborHeader(TypeText, 6)}, []byte("hello2"))
163 combinedHellos := multiappend(hello, hello2)
164
165 for _, testCase := range [][]byte{hello, hello2, combinedHellos} {
166 if err := Deterministic(testCase); err != nil {
167 t.Error("Deterministically encoded text string should not return false for deterministicy.")
168 }
169 }
170}
171
172func TestByteStringIsNotDeterministic(t *testing.T) {
173 // Claiming it would be followed by 3 bytes but there are only 2.

Callers

nothing calls this directly

Calls 3

multiappendFunction · 0.85
toCborHeaderFunction · 0.85
DeterministicFunction · 0.85

Tested by

no test coverage detected