package numx import "testing" func TestFormatFlow(t *testing.T) { cases := []struct { in int64 want string }{ {500, "500 B"}, {1536, "1.5 KB"}, {1024 * 1024, "1.0 MB"}, {1024 * 1024 * 1024, "1.0 GB"}, } for _, c := range cases { if got := FormatFlow(c.in); got != c.want { t.Errorf("FormatFlow(%d) = %q, want %q", c.in, got, c.want) } } } func TestIgnoreDigits(t *testing.T) { if got := IgnoreDigits(12345, 3); got != 12000 { t.Errorf("IgnoreDigits(12345,3) = %d, want 12000", got) } } func TestMaxMin(t *testing.T) { if got := Max(3, 7, 5); got != 7 { t.Errorf("Max = %d, want 7", got) } if got := Min(3, 1, 2); got != 1 { t.Errorf("Min = %d, want 1", got) } if got := Min(2, 5); got != 2 { t.Errorf("Min(2,5) = %d, want 2", got) } }