mirror of
https://github.com/VictoriaMetrics/VictoriaMetrics.git
synced 2025-01-20 07:19:17 +01:00
lib/decimal: add tests for negative values passed to maxUpExponent
This commit is contained in:
parent
d448e07546
commit
11ddb79aeb
@ -196,7 +196,6 @@ func testCalibrateScale(t *testing.T, a, b []int64, ae, be int16, aExpected, bEx
|
||||
func TestMaxUpExponent(t *testing.T) {
|
||||
f := func(v int64, eExpected int16) {
|
||||
t.Helper()
|
||||
|
||||
e := maxUpExponent(v)
|
||||
if e != eExpected {
|
||||
t.Fatalf("unexpected e for v=%d; got %d; expecting %d", v, e, eExpected)
|
||||
@ -245,6 +244,44 @@ func TestMaxUpExponent(t *testing.T) {
|
||||
f(923, 15)
|
||||
f(92, 17)
|
||||
f(9, 18)
|
||||
|
||||
f(-1, 18)
|
||||
f(-12, 17)
|
||||
f(-123, 16)
|
||||
f(-1234, 15)
|
||||
f(-12345, 14)
|
||||
f(-123456, 13)
|
||||
f(-1234567, 12)
|
||||
f(-12345678, 11)
|
||||
f(-123456789, 10)
|
||||
f(-1234567890, 9)
|
||||
f(-12345678901, 8)
|
||||
f(-123456789012, 7)
|
||||
f(-1234567890123, 6)
|
||||
f(-12345678901234, 5)
|
||||
f(-123456789012345, 4)
|
||||
f(-1234567890123456, 3)
|
||||
f(-12345678901234567, 2)
|
||||
f(-123456789012345678, 1)
|
||||
f(-1234567890123456789, 0)
|
||||
f(-923456789012345678, 0)
|
||||
f(-92345678901234567, 1)
|
||||
f(-9234567890123456, 2)
|
||||
f(-923456789012345, 3)
|
||||
f(-92345678901234, 4)
|
||||
f(-9234567890123, 5)
|
||||
f(-923456789012, 6)
|
||||
f(-92345678901, 7)
|
||||
f(-9234567890, 8)
|
||||
f(-923456789, 9)
|
||||
f(-92345678, 10)
|
||||
f(-9234567, 11)
|
||||
f(-923456, 12)
|
||||
f(-92345, 13)
|
||||
f(-9234, 14)
|
||||
f(-923, 15)
|
||||
f(-92, 17)
|
||||
f(-9, 18)
|
||||
}
|
||||
|
||||
func TestAppendFloatToDecimal(t *testing.T) {
|
||||
|
Loading…
Reference in New Issue
Block a user