MCPcopy Create free account
hub / github.com/dinedal/textql / TestNumeric

Function TestNumeric

sqlparser/sqltypes/type_test.go:39–57  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func TestNumeric(t *testing.T) {
40 n := Value{Numeric([]byte("1234"))}
41 b := bytes.NewBuffer(nil)
42 n.EncodeSql(b)
43 if b.String() != "1234" {
44 t.Errorf("Expecting 1234, got %s", b.String())
45 }
46 n.EncodeAscii(b)
47 if b.String() != "12341234" {
48 t.Errorf("Expecting 12341234, got %s", b.String())
49 }
50 js, err := n.MarshalJSON()
51 if err != nil {
52 t.Errorf("Unexpected error: %s", err)
53 }
54 if string(js) != "1234" {
55 t.Errorf("Expecting 1234, received %s", js)
56 }
57}
58
59func TestTime(t *testing.T) {
60 date := time.Date(1999, 1, 2, 3, 4, 5, 0, time.UTC)

Callers

nothing calls this directly

Calls 5

EncodeSqlMethod · 0.95
EncodeAsciiMethod · 0.95
MarshalJSONMethod · 0.95
NumericTypeAlias · 0.85
StringMethod · 0.80

Tested by

no test coverage detected