ids_test.gno
0.64 Kb · 22 lines
1package bolo
2
3import "testing"
4
5func TestParseID(t *testing.T) {
6 for _, s := range []string{"1", "7", "42", "18446744073709551615"} {
7 id, ok := parseID(s)
8 if !ok || idString(id) != s {
9 t.Errorf("parseID(%q) = %d, %t; want %s", s, uint64(id), ok, s)
10 }
11 }
12 // One ID, one spelling (API C9, INV-18): anything else names no campaign.
13 for _, s := range []string{
14 "", "0", "00", "042", "+42", "-1", " 42", "42 ", "4 2", "4.2", "0x2a", "1e3",
15 "18446744073709551616", "99999999999999999999", "123456789012345678901",
16 "42", "٤٢",
17 } {
18 if id, ok := parseID(s); ok {
19 t.Errorf("parseID(%q) = %d; want no campaign", s, uint64(id))
20 }
21 }
22}