runeint_test.go 626 B

12345678910111213141516171819202122232425
  1. package utils
  2. import "testing"
  3. func Test_RuneToIntIntToRune(t *testing.T) {
  4. if IntToRune(0) != '0' {
  5. t.Errorf("failed IntToRune(0) returned %d", IntToRune(0))
  6. }
  7. if IntToRune(9) != '9' {
  8. t.Errorf("failed IntToRune(9) returned %d", IntToRune(9))
  9. }
  10. if IntToRune(10) != 'F' {
  11. t.Errorf("failed IntToRune(10) returned %d", IntToRune(10))
  12. }
  13. if RuneToInt('0') != 0 {
  14. t.Errorf("failed RuneToInt('0') returned %d", RuneToInt(0))
  15. }
  16. if RuneToInt('9') != 9 {
  17. t.Errorf("failed RuneToInt('9') returned %d", RuneToInt(9))
  18. }
  19. if RuneToInt('F') != -1 {
  20. t.Errorf("failed RuneToInt('F') returned %d", RuneToInt('F'))
  21. }
  22. }