Browse Source

Silence door_test. Remove WSAStartup.

Steve Thielemann 1 year ago
parent
commit
1aab0f75bd
3 changed files with 26 additions and 8 deletions
  1. 23 7
      door/door_test.go
  2. 2 0
      door/input_windows.c
  3. 1 1
      door/input_windows.h

+ 23 - 7
door/door_test.go

@@ -19,7 +19,7 @@ import (
 // go test -c; ./door.test -test.run DoorCP437 -test.v
 
 const KEEP_LOGS bool = true     // false
-const VERBOSE_TEST bool = false // true // false
+const VERBOSE_TEST bool = false 
 
 func TestGoto(t *testing.T) {
 	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 {
 		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 {
 		if VERBOSE_TEST {
@@ -339,7 +343,10 @@ func InputTests(t *testing.T, server net.Conn, d *Door, mode string) {
 
 	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)
 	if timeout == nil {
 		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("Starting input test (%s)\n", mode)
+	if VERBOSE_TEST {
+		t.Logf("Starting input test (%s)\n", mode)
+	}
+
 	// Input test
 	buffer = "1234567890\r"
 	_, 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.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}}
 	for _, pos := range cpos {
 		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}}
 	for _, m := range mouse {
 		if VERBOSE_TEST {

+ 2 - 0
door/input_windows.c

@@ -1,9 +1,11 @@
 #include "input_windows.h"
 
+/*
  void init_wsa(void) {
     WSADATA wsa;
  	WSAStartup(WINSOCK_VERSION, &wsa); 
  }
+*/
 
  int windows_read(int fd, char *buffer, int len) {
     struct timeval tv;

+ 1 - 1
door/input_windows.h

@@ -2,5 +2,5 @@
 #include <string.h>
 #include <errno.h>
 
-void init_wsa(void);
+// void init_wsa(void);
 int windows_read(int fd, char *buffer, int len);