19 lines
377 B
Go
19 lines
377 B
Go
package repository
|
|
|
|
import "testing"
|
|
|
|
func TestDecimalText(t *testing.T) {
|
|
for _, test := range []struct {
|
|
cents int64
|
|
want string
|
|
}{
|
|
{cents: 13000000, want: "130000.00"},
|
|
{cents: 1, want: "0.01"},
|
|
{cents: 0, want: "0.00"},
|
|
} {
|
|
if got := decimalText(test.cents); got != test.want {
|
|
t.Fatalf("decimalText(%d)=%q want=%q", test.cents, got, test.want)
|
|
}
|
|
}
|
|
}
|