]> git.scottworley.com Git - planeteer/blobdiff - planeteer_test.go
Calculate visit costs
[planeteer] / planeteer_test.go
index 7661ad6edc6000ac453653135a99fe03e1d21c3f..42baae0a5a78bd89a295567baf1ca0854fc82ebd 100644 (file)
@@ -17,3 +17,24 @@ func TestEncodeDecode(t *testing.T) {
                }
        }
 }
+
+func TestCommas(t *testing.T) {
+       cases := map[int32]string{
+               1: "1",
+               10: "10",
+               100: "100",
+               1000: "1,000",
+               10000: "10,000",
+               100000: "100,000",
+               1000000: "1,000,000",
+               1234567: "1,234,567",
+               1000567: "1,000,567",
+               1234000: "1,234,000",
+               525000: "525,000",
+       }
+       for n, s := range cases {
+               if Commas(n) != s {
+                       t.Error(n, "not", s)
+               }
+       }
+}