1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
package namcu
import (
"fmt"
"testing"
)
func TestLojbanDigit(t *testing.T) {
cases := []struct {
input int
output string
}{
{
input: 1,
output: "pa",
},
{
input: 10,
output: "pano",
},
{
input: 1337,
output: "pacicize",
},
}
for _, cs := range cases {
t.Run(fmt.Sprint(cs), func(t *testing.T) {
result := lojbanDigit(cs.input)
if result != cs.output {
t.Errorf("expected %[1]d -> %[2]q, got: %[1]d -> %[3]q", cs.input, cs.output, result)
}
})
}
}
|