1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56
|
package terminfo
import (
"testing"
)
func TestCapSizes(t *testing.T) {
if CapCountBool*2 != len(boolCapNames) {
t.Fatalf("boolCapNames should have same length as twice CapCountBool")
}
if CapCountNum*2 != len(numCapNames) {
t.Fatalf("numCapNames should have same length as twice CapCountNum")
}
if CapCountString*2 != len(stringCapNames) {
t.Fatalf("stringCapNames should have same length as twice CapCountString")
}
}
func TestCapNames(t *testing.T) {
for i := 0; i < CapCountBool; i++ {
n, s := BoolCapName(i), BoolCapNameShort(i)
if n == "" {
t.Errorf("Bool cap %d should have name", i)
}
if s == "" {
t.Errorf("Bool cap %d should have short name", i)
}
if n == s {
t.Errorf("Bool cap %d name and short name should not equal (%s==%s)", i, n, s)
}
}
for i := 0; i < CapCountNum; i++ {
n, s := NumCapName(i), NumCapNameShort(i)
if n == "" {
t.Errorf("Num cap %d should have name", i)
}
if s == "" {
t.Errorf("Num cap %d should have short name", i)
}
if n == s && n != "lines" {
t.Errorf("Num cap %d name and short name should not equal (%s==%s)", i, n, s)
}
}
for i := 0; i < CapCountString; i++ {
n, s := StringCapName(i), StringCapNameShort(i)
if n == "" {
t.Errorf("String cap %d should have name", i)
}
if s == "" {
t.Errorf("String cap %d should have short name", i)
}
if n == s && n != "tone" && n != "pulse" {
t.Errorf("String cap %d name and short name should not equal (%s==%s)", i, n, s)
}
}
}
|