2014-08-12 18:29:20 +00:00
|
|
|
package utils
|
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func Test_RuneToIntIntToRune(t *testing.T) {
|
|
|
|
if IntToRune(0) != '0' {
|
2018-03-15 03:30:44 +00:00
|
|
|
t.Errorf("failed IntToRune(0) returned %d", IntToRune(0))
|
2014-08-12 18:29:20 +00:00
|
|
|
}
|
|
|
|
if IntToRune(9) != '9' {
|
|
|
|
t.Errorf("failed IntToRune(9) returned %d", IntToRune(9))
|
|
|
|
}
|
|
|
|
if IntToRune(10) != 'F' {
|
|
|
|
t.Errorf("failed IntToRune(10) returned %d", IntToRune(10))
|
|
|
|
}
|
|
|
|
if RuneToInt('0') != 0 {
|
2018-03-15 03:30:44 +00:00
|
|
|
t.Errorf("failed RuneToInt('0') returned %d", RuneToInt(0))
|
2014-08-12 18:29:20 +00:00
|
|
|
}
|
|
|
|
if RuneToInt('9') != 9 {
|
2018-03-15 03:30:44 +00:00
|
|
|
t.Errorf("failed RuneToInt('9') returned %d", RuneToInt(9))
|
2014-08-12 18:29:20 +00:00
|
|
|
}
|
|
|
|
if RuneToInt('F') != -1 {
|
2018-03-15 03:30:44 +00:00
|
|
|
t.Errorf("failed RuneToInt('F') returned %d", RuneToInt('F'))
|
2014-08-12 18:29:20 +00:00
|
|
|
}
|
|
|
|
}
|