2021-11-11 09:33:35 -07:00
|
|
|
package config
|
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestGetAsciiValue(t *testing.T) {
|
2021-11-11 10:54:58 -07:00
|
|
|
for k, v := range SPECIAL_KEYS {
|
2021-11-11 09:33:35 -07:00
|
|
|
result, err := GetAsciiValue(k)
|
|
|
|
if result != v {
|
|
|
|
t.Errorf("Values From KMAP Failed")
|
|
|
|
} else if err != nil {
|
|
|
|
t.Errorf("Error Received: %v", err)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for i := 65; i < (65 + 26); i++ {
|
|
|
|
result, err := GetAsciiValue(string(rune(i)))
|
|
|
|
if err != nil {
|
|
|
|
t.Errorf("Error Received! %v", err)
|
|
|
|
} else if result != i {
|
|
|
|
t.Errorf("Invalid Value Received for small alphabets Result Received: %d expecting %d", result, i)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
for i := 97; i < (97 + 26); i++ {
|
|
|
|
result, err := GetAsciiValue(string(rune(i)))
|
|
|
|
if err != nil {
|
|
|
|
t.Errorf("Error Received: %v", err)
|
|
|
|
} else if result != i {
|
|
|
|
t.Errorf("Invalid Value Received for Big alphabets Result Received: %d expecting %d", result, i)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|