my-solutions/leetcode/0007-reverse-integer/main_test.go
2023-11-30 11:56:47 +05:00

21 lines
421 B
Go

package main
import (
"testing"
"math"
)
func TestReverse(t *testing.T) {
if res := reverse(123); res != 321 {
t.Fatalf("%v != 321", res)
}
if res := reverse(-123); res != -321 {
t.Fatalf("%v != -321", res)
}
if res := reverse(120); res != 21 {
t.Fatalf("%v != 12", res)
}
if res := reverse(math.MaxInt32); res != 0 {
t.Fatalf("%v != 0", res)
}
}