MCPcopy Create free account
hub / github.com/CovenantSQL/CovenantSQL / TestReadBits

Function TestReadBits

utils/big_test.go:179–192  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

177}
178
179func TestReadBits(t *testing.T) {
180 check := func(input string) {
181 want, _ := hex.DecodeString(input)
182 int, _ := new(big.Int).SetString(input, 16)
183 buf := make([]byte, len(want))
184 ReadBits(int, buf)
185 if !bytes.Equal(buf, want) {
186 t.Errorf("have: %x\nwant: %x", buf, want)
187 }
188 }
189 check("000000000000000000000000000000000000000000000000000000FEFCF3F8F0")
190 check("0000000000012345000000000000000000000000000000000000FEFCF3F8F0")
191 check("18F8F8F1000111000110011100222004330052300000000000000000FEFCF3F8F0")
192}
193
194func TestU256(t *testing.T) {
195 tests := []struct{ x, y *big.Int }{

Callers

nothing calls this directly

Calls 2

ReadBitsFunction · 0.85
ErrorfMethod · 0.80

Tested by

no test coverage detected