MCPcopy Create free account
hub / github.com/cockroachdb/apd / TestBigIntJSONEncoding

Function TestBigIntJSONEncoding

bigint_test.go:2745–2766  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2743}
2744
2745func TestBigIntJSONEncoding(t *testing.T) {
2746 for _, test := range encodingTests {
2747 for _, sign := range []string{"", "+", "-"} {
2748 x := sign + test
2749 var tx BigInt
2750 tx.SetString(x, 10)
2751 b, err := json.Marshal(&tx)
2752 if err != nil {
2753 t.Errorf("marshaling of %s failed: %s", &tx, err)
2754 continue
2755 }
2756 var rx BigInt
2757 if err := json.Unmarshal(b, &rx); err != nil {
2758 t.Errorf("unmarshaling of %s failed: %s", &tx, err)
2759 continue
2760 }
2761 if rx.Cmp(&tx) != 0 {
2762 t.Errorf("JSON encoding of %s failed: got %s want %s", &tx, &rx, &tx)
2763 }
2764 }
2765 }
2766}
2767
2768func TestBigIntXMLEncoding(t *testing.T) {
2769 for _, test := range encodingTests {

Callers

nothing calls this directly

Calls 2

SetStringMethod · 0.95
CmpMethod · 0.95

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…