go-ncurses/ncurses_test.go

63 lines
975 B
Go

package ncurses
import (
"testing"
)
func StartTest(t *testing.T) Window {
window := InitScr()
return window
}
func EndTest(t *testing.T) {
ret := EndWin()
if ret != 0 {
t.Fatalf("EndWin result - 0x%02x", ret)
}
}
func TestInitScr(t *testing.T) {
StartTest(t)
EndTest(t)
}
func TestNewWin(t *testing.T) {
StartTest(t)
window := NewWin(10, 10, 0, 0)
t.Logf("NewWin result - 0x%x", window)
ret := DelWin(window)
if ret != 0 {
t.Fatalf("DelWin result - 0x%02x", ret)
}
EndTest(t)
}
func TestColors(t *testing.T) {
StartTest(t)
ret := StartColor()
if ret != 0 {
t.Fatalf("StartColor result - 0x%02x", ret)
}
ret = InitColor(0, 1000, 0, 0)
if ret != 0 {
t.Fatalf("InitColor result - 0x%02x", ret)
}
ret = InitColor(1, 0, 1000, 0)
if ret != 0 {
t.Fatalf("InitColor result - 0x%02x", ret)
}
ret = InitPair(1, 0, 1)
if ret != 0 {
t.Fatalf("InitPair result - 0x%02x", ret)
}
EndTest(t)
}