| 56 | } |
| 57 | |
| 58 | func TestAllNum(t *testing.T) { |
| 59 | tests := []struct { |
| 60 | doc, id string |
| 61 | expected bool |
| 62 | }{ |
| 63 | { |
| 64 | doc: "mixed letters and numbers", |
| 65 | id: "4e38e38c8ce0", |
| 66 | expected: false, |
| 67 | }, |
| 68 | { |
| 69 | doc: "letters only", |
| 70 | id: "deadbeefcafe", |
| 71 | expected: false, |
| 72 | }, |
| 73 | { |
| 74 | doc: "numbers only", |
| 75 | id: "012345678912", |
| 76 | expected: true, |
| 77 | }, |
| 78 | } |
| 79 | for _, tc := range tests { |
| 80 | t.Run(tc.doc, func(t *testing.T) { |
| 81 | if actual := allNum(tc.id); actual != tc.expected { |
| 82 | t.Errorf("expected %q to be %t, got %t, ", tc.id, !tc.expected, actual) |
| 83 | } |
| 84 | }) |
| 85 | } |
| 86 | } |