git.sr.ht/~pingoo/stdx@v0.0.0-20240218134121-094174641f6e/barcode/utils/runeint_test.go (about) 1 package utils 2 3 import "testing" 4 5 func Test_RuneToIntIntToRune(t *testing.T) { 6 if IntToRune(0) != '0' { 7 t.Errorf("failed IntToRune(0) returned %d", IntToRune(0)) 8 } 9 if IntToRune(9) != '9' { 10 t.Errorf("failed IntToRune(9) returned %d", IntToRune(9)) 11 } 12 if IntToRune(10) != 'F' { 13 t.Errorf("failed IntToRune(10) returned %d", IntToRune(10)) 14 } 15 if RuneToInt('0') != 0 { 16 t.Errorf("failed RuneToInt('0') returned %d", RuneToInt(0)) 17 } 18 if RuneToInt('9') != 9 { 19 t.Errorf("failed RuneToInt('9') returned %d", RuneToInt(9)) 20 } 21 if RuneToInt('F') != -1 { 22 t.Errorf("failed RuneToInt('F') returned %d", RuneToInt('F')) 23 } 24 }