ブレークポイントを扱うハッシュ関数のテストを追加
authorj8takagi <j8takagi@nifty.com>
Thu, 28 Jun 2018 13:22:50 +0000 (22:22 +0900)
committerj8takagi <j8takagi@nifty.com>
Thu, 28 Jun 2018 13:22:50 +0000 (22:22 +0900)
test/unit/bpshash/0.txt [new file with mode: 0644]
test/unit/bpshash/Makefile [new file with mode: 0644]
test/unit/bpshash/cmd.c [new file with mode: 0644]
test/unit/bpshash/desc.txt [new file with mode: 0644]

diff --git a/test/unit/bpshash/0.txt b/test/unit/bpshash/0.txt
new file mode 100644 (file)
index 0000000..a4f31b8
--- /dev/null
@@ -0,0 +1,10 @@
+0: 0
+1: 1
+2: 2
+3: 3
+10: 10
+250: 250
+251: 0
+254: 3
+36863: 217
+65535: 24
diff --git a/test/unit/bpshash/Makefile b/test/unit/bpshash/Makefile
new file mode 100644 (file)
index 0000000..c97998b
--- /dev/null
@@ -0,0 +1,20 @@
+include ../Define.mk
+include ../Test.mk
+
+CC := gcc
+CFLAGS := -g -Wall
+
+.INTERMEDIATE: $(CMD_FILE)
+
+CMDSRC_FILE := cmd.c
+TARGETDIR := ../../../src
+INCLUDEDIR := ../../../include
+TESTTARGET_FILES := $(TARGETDIR)/hash.c $(TARGETDIR)/debugger.c $(TARGETDIR)/cmem.c $(TARGETDIR)/hash.c $(TARGETDIR)/cerr.c $(TARGETDIR)/word.c $(TARGETDIR)/exec.c $(TARGETDIR)/struct.c $(TARGETDIR)/debugger.c $(TARGETDIR)/dump.c      # Set test target files
+
+$(CMD_FILE): $(CMDSRC_FILE) $(TESTTARGET_FILES)
+       $(CC) $(CFLAGS) -I $(INCLUDEDIR) -o $@ $^
+
+clean_cmd:
+       @rm -rf cmd.dSYM cmd
+
+clean: clean_cmd
diff --git a/test/unit/bpshash/cmd.c b/test/unit/bpshash/cmd.c
new file mode 100644 (file)
index 0000000..0543358
--- /dev/null
@@ -0,0 +1,11 @@
+#include "debugger.h"
+
+int main()
+{
+    int i;
+    WORD w[10] ={0, 1, 2, 3, 10, 250, 251, 254, 0x8FFF, 65535};
+    for(i = 0; i < 10; i++) {
+        printf("%ld: %d\n", (long)w[i], adrhash(w[i]));
+    }
+    return 0;
+}
diff --git a/test/unit/bpshash/desc.txt b/test/unit/bpshash/desc.txt
new file mode 100644 (file)
index 0000000..a9384b1
--- /dev/null
@@ -0,0 +1 @@
+ブレークポイントを扱うハッシュ関数のテスト