mr_IN_test.go 409 B

123456789101112131415161718192021222324252627
  1. package mr_IN
  2. import "testing"
  3. func TestGrouping(t *testing.T) {
  4. tests := []struct {
  5. num float64
  6. v uint64
  7. expected string
  8. }{
  9. {
  10. num: 1123456.5643,
  11. v: 2,
  12. expected: "11,23,456.56",
  13. },
  14. }
  15. trans := New()
  16. for _, tt := range tests {
  17. s := string(trans.FmtNumber(tt.num, tt.v))
  18. if s != tt.expected {
  19. t.Errorf("Expected '%s' Got '%s", tt.expected, s)
  20. }
  21. }
  22. }