MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / TestDecimal

Function TestDecimal

projects/Go/tests/decimal_test.go:39–57  ·  view source on GitHub ↗
(test *testing.T)

Source from the content-addressed store, hash-verified

37}
38
39func TestDecimal(test *testing.T) {
40 // FBE decimal exponent ranging from 0 to 28
41 decimal.DivisionPrecision = 29
42 VerifyDecimal(test, 0x00000000, 0x00000000, 0x00000000, false, 0x00000000, "0")
43 VerifyDecimal(test, 0x00000001, 0x00000000, 0x00000000, false, 0x00000000, "1")
44 VerifyDecimal(test, 0x107A4000, 0x00005AF3, 0x00000000, false, 0x00000000, "100000000000000")
45 VerifyDecimal(test, 0x10000000, 0x3E250261, 0x204FCE5E, false, 0x000E0000>>16, "100000000000000.00000000000000")
46 VerifyDecimal(test, 0x10000000, 0x3E250261, 0x204FCE5E, false, 0x00000000, "10000000000000000000000000000")
47 VerifyDecimal(test, 0x10000000, 0x3E250261, 0x204FCE5E, false, 0x001C0000>>16, "1.0000000000000000000000000000")
48 VerifyDecimal(test, 0x075BCD15, 0x00000000, 0x00000000, false, 0x00000000, "123456789")
49 VerifyDecimal(test, 0x075BCD15, 0x00000000, 0x00000000, false, 0x00090000>>16, "0.123456789")
50 VerifyDecimal(test, 0x075BCD15, 0x00000000, 0x00000000, false, 0x00120000>>16, "0.000000000123456789")
51 VerifyDecimal(test, 0x075BCD15, 0x00000000, 0x00000000, false, 0x001B0000>>16, "0.000000000000000000123456789")
52 VerifyDecimal(test, 0xFFFFFFFF, 0x00000000, 0x00000000, false, 0x00000000, "4294967295")
53 VerifyDecimal(test, 0xFFFFFFFF, 0xFFFFFFFF, 0x00000000, false, 0x00000000, "18446744073709551615")
54 VerifyDecimal(test, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, false, 0x00000000, "79228162514264337593543950335")
55 VerifyDecimal(test, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, true, 0x00000000, "-79228162514264337593543950335")
56 VerifyDecimal(test, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, true, 0x001C0000>>16, "-7.9228162514264337593543950335")
57}

Callers

nothing calls this directly

Calls 1

VerifyDecimalFunction · 0.70

Tested by

no test coverage detected