gomp/config/kMap_test.go

37 lines
974 B
Go
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

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)
}
}
result, err := GetAsciiValue("")
if err == nil || result != -1 {
t.Errorf("Wrong Result Received for Control Characters %v %v", result, err)
}
}