482978897d
Following Changes Have been made: 1. Rename KMAP -> SPECIAL_KEYS 2. Added Default Mappings through KEY_MAPPINGS so when the config is read it will change the KEY_MAPPINGS map which will be then used by the handler function for events.
33 lines
825 B
Go
33 lines
825 B
Go
package config
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestGetAsciiValue(t *testing.T) {
|
|
for k, v := range SPECIAL_KEYS {
|
|
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)
|
|
}
|
|
}
|
|
}
|