Ejemplo n.º 1
0
func TestDecGetString(t *testing.T) {
	z := new(inf.Dec)
	for i, test := range decStringTests {
		if !test.ok {
			continue
		}
		z.SetUnscaled(test.val)
		z.SetScale(test.scale)

		s := z.String()
		if s != test.out {
			t.Errorf("#%da got %s; want %s", i, s, test.out)
		}

		s = fmt.Sprintf("%d", z)
		if s != test.out {
			t.Errorf("#%db got %s; want %s", i, s, test.out)
		}
	}
}