X-Git-Url: http://git.scottworley.com/planeteer/blobdiff_plain/c45c1bcae7063b858bfa08a2376efe3a87b2c7f2..49cc7edb54405f2870bd0d82a8b3aaa7bee9f231:/planeteer_test.go?ds=sidebyside diff --git a/planeteer_test.go b/planeteer_test.go index 0cc7f65..db3294c 100644 --- a/planeteer_test.go +++ b/planeteer_test.go @@ -3,8 +3,9 @@ package main import "testing" func TestEncodeDecode(t *testing.T) { - dims := []int{3, 2, 4, 17, 26, 15, 1, 2, 1} - for i := 0; i < 318240; i++ { // Product of dims + dims := LogicalIndex{3, 2, 4, 17, 26, 15, 2, 1, 2, 1} + var i PhysicalIndex + for i = 0; i < 636480; i++ { // Product of dims addr := DecodeIndex(dims, i) for j := 0; j < len(dims); j++ { if addr[j] >= dims[j] { @@ -16,3 +17,24 @@ func TestEncodeDecode(t *testing.T) { } } } + +func TestCommas(t *testing.T) { + cases := map[Value]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) + } + } +}