You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
31 lines
475 B
31 lines
475 B
package palindromenumber_test
|
|
|
|
import (
|
|
"strconv"
|
|
"testing"
|
|
|
|
"git.jxs.me/leetgo/palindromenumber"
|
|
)
|
|
|
|
func TestCases(t *testing.T) {
|
|
cases := map[int]bool{
|
|
0: true,
|
|
10: false,
|
|
11: true,
|
|
100: false,
|
|
101: true,
|
|
-121: false,
|
|
}
|
|
|
|
for input, expected := range cases {
|
|
t.Run(strconv.Itoa(input), func(t *testing.T) {
|
|
result := palindromenumber.IsPalindrome(input)
|
|
|
|
if expected != result {
|
|
t.Errorf("%v != %v", expected, result)
|
|
}
|
|
})
|
|
}
|
|
|
|
}
|