|
@@ -19,7 +19,7 @@ import (
|
|
// go test -c; ./door.test -test.run DoorCP437 -test.v
|
|
// go test -c; ./door.test -test.run DoorCP437 -test.v
|
|
|
|
|
|
const KEEP_LOGS bool = true // false
|
|
const KEEP_LOGS bool = true // false
|
|
-const VERBOSE_TEST bool = false // true // false
|
|
|
|
|
|
+const VERBOSE_TEST bool = false
|
|
|
|
|
|
func TestGoto(t *testing.T) {
|
|
func TestGoto(t *testing.T) {
|
|
GotoMap := map[string][]int{"\x1b[10;20H": {20, 10},
|
|
GotoMap := map[string][]int{"\x1b[10;20H": {20, 10},
|
|
@@ -221,7 +221,9 @@ func InputTests(t *testing.T, server net.Conn, d *Door, mode string) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- t.Logf("Starting keytest (%s)\n", mode)
|
|
|
|
|
|
+ if VERBOSE_TEST {
|
|
|
|
+ t.Logf("Starting keytest (%s)\n", mode)
|
|
|
|
+ }
|
|
|
|
|
|
for send, get := range keytest {
|
|
for send, get := range keytest {
|
|
if VERBOSE_TEST {
|
|
if VERBOSE_TEST {
|
|
@@ -281,7 +283,9 @@ func InputTests(t *testing.T, server net.Conn, d *Door, mode string) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- t.Logf("Starting keyextest (%s)\n", mode)
|
|
|
|
|
|
+ if VERBOSE_TEST {
|
|
|
|
+ t.Logf("Starting keyextest (%s)\n", mode)
|
|
|
|
+ }
|
|
|
|
|
|
for send, get := range keyextest {
|
|
for send, get := range keyextest {
|
|
if VERBOSE_TEST {
|
|
if VERBOSE_TEST {
|
|
@@ -339,7 +343,10 @@ func InputTests(t *testing.T, server net.Conn, d *Door, mode string) {
|
|
|
|
|
|
clear_socket(server, t)
|
|
clear_socket(server, t)
|
|
|
|
|
|
- t.Logf("Starting WaitKey timeout (%s)...\n", mode)
|
|
|
|
|
|
+ if VERBOSE_TEST {
|
|
|
|
+ t.Logf("Starting WaitKey timeout (%s)...\n", mode)
|
|
|
|
+ }
|
|
|
|
+
|
|
_, _, timeout := d.WaitKey(keyWait)
|
|
_, _, timeout := d.WaitKey(keyWait)
|
|
if timeout == nil {
|
|
if timeout == nil {
|
|
t.Errorf("Expected timeout, got %d / %X", timeout, timeout)
|
|
t.Errorf("Expected timeout, got %d / %X", timeout, timeout)
|
|
@@ -347,7 +354,10 @@ func InputTests(t *testing.T, server net.Conn, d *Door, mode string) {
|
|
t.Logf("Ok! Buffer should be empty! -1 (timeout)")
|
|
t.Logf("Ok! Buffer should be empty! -1 (timeout)")
|
|
}
|
|
}
|
|
|
|
|
|
- t.Logf("Starting input test (%s)\n", mode)
|
|
|
|
|
|
+ if VERBOSE_TEST {
|
|
|
|
+ t.Logf("Starting input test (%s)\n", mode)
|
|
|
|
+ }
|
|
|
|
+
|
|
// Input test
|
|
// Input test
|
|
buffer = "1234567890\r"
|
|
buffer = "1234567890\r"
|
|
_, err = server.Write([]byte(buffer))
|
|
_, err = server.Write([]byte(buffer))
|
|
@@ -403,7 +413,10 @@ func InputTests(t *testing.T, server net.Conn, d *Door, mode string) {
|
|
t.Errorf("Expected Input(5) = 98765, but got %#v", input)
|
|
t.Errorf("Expected Input(5) = 98765, but got %#v", input)
|
|
}
|
|
}
|
|
|
|
|
|
- t.Logf("Starting cursor pos test (%s)\n", mode)
|
|
|
|
|
|
+ if VERBOSE_TEST {
|
|
|
|
+ t.Logf("Starting cursor pos test (%s)\n", mode)
|
|
|
|
+ }
|
|
|
|
+
|
|
var cpos []CursorPos = []CursorPos{{1, 1}, {50, 5}, {4, 40}, {80, 25}, {160, 55}}
|
|
var cpos []CursorPos = []CursorPos{{1, 1}, {50, 5}, {4, 40}, {80, 25}, {160, 55}}
|
|
for _, pos := range cpos {
|
|
for _, pos := range cpos {
|
|
if VERBOSE_TEST {
|
|
if VERBOSE_TEST {
|
|
@@ -440,7 +453,10 @@ func InputTests(t *testing.T, server net.Conn, d *Door, mode string) {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- t.Logf("Starting Mouse test (%s)\n", mode)
|
|
|
|
|
|
+ if VERBOSE_TEST {
|
|
|
|
+ t.Logf("Starting Mouse test (%s)\n", mode)
|
|
|
|
+ }
|
|
|
|
+
|
|
var mouse []Mouse = []Mouse{{1, 4, 5}, {4, 4, 5}, {45, 80, 25}, {2, 55, 17}}
|
|
var mouse []Mouse = []Mouse{{1, 4, 5}, {4, 4, 5}, {45, 80, 25}, {2, 55, 17}}
|
|
for _, m := range mouse {
|
|
for _, m := range mouse {
|
|
if VERBOSE_TEST {
|
|
if VERBOSE_TEST {
|