2023-09-24 21:29:05 +00:00
|
|
|
package jsonint_test
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
|
|
|
"encoding/json"
|
|
|
|
|
2024-08-01 22:49:52 +00:00
|
|
|
"github.com/reiver/go-jsonint"
|
2023-09-24 21:29:05 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func TestZero(t *testing.T) {
|
|
|
|
|
|
|
|
var nothing jsonint.Int
|
|
|
|
|
|
|
|
var int64zero jsonint.Int = jsonint.Int64(0)
|
|
|
|
var uint64zero jsonint.Int = jsonint.Uint64(0)
|
|
|
|
|
|
|
|
var jsonzero jsonint.Int
|
|
|
|
{
|
|
|
|
var data []byte = []byte("0")
|
|
|
|
|
|
|
|
err := json.Unmarshal(data, &jsonzero)
|
|
|
|
if nil != err {
|
|
|
|
panic(err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if nothing != int64zero {
|
|
|
|
t.Error("nothing ≠ int64zero")
|
|
|
|
}
|
|
|
|
if nothing != uint64zero {
|
|
|
|
t.Error("nothing ≠ uint64zero")
|
|
|
|
}
|
|
|
|
if nothing != jsonzero {
|
|
|
|
t.Error("nothing ≠ json64zero")
|
|
|
|
}
|
|
|
|
}
|