(t *testing.T)
| 196 | } |
| 197 | |
| 198 | func TestLongArrayIsDeterministic(t *testing.T) { |
| 199 | const numOfItems = 24 |
| 200 | longArr := make([]byte, 2 /*=num of startBytes*/ +len(uint45)*numOfItems) |
| 201 | longArr[0] = toCborHeader(TypeArray, 24) // ARR (4) + ONE_BYTE (24) |
| 202 | longArr[1] = byte(numOfItems) |
| 203 | |
| 204 | // Fill in the byte array with 24 times uint45 bytes. |
| 205 | for i := 2; i < len(longArr); i += len(uint45) { |
| 206 | for j := 0; j < len(uint45); j++ { |
| 207 | longArr[i+j] = uint45[j] |
| 208 | } |
| 209 | } |
| 210 | |
| 211 | cborSequenceArray := multiappend(longArr, longArr) |
| 212 | |
| 213 | for _, testCase := range [][]byte{longArr, cborSequenceArray} { |
| 214 | if err := Deterministic(testCase); err != nil { |
| 215 | t.Error("Deterministically encoded CBOR array should not return false for deterministicy.") |
| 216 | } |
| 217 | } |
| 218 | } |
| 219 | |
| 220 | func TestArraysNumberOfItemsIsWrong(t *testing.T) { |
| 221 | // There is one item too little. The additional information claims that there are 5 but there are only 4. |
nothing calls this directly
no test coverage detected