aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/idx_inc.blc (renamed from test/inc.blc)0
-rw-r--r--test/idx_inc.blc.dump55
-rw-r--r--test/idx_open.blc (renamed from test/open.blc)0
-rw-r--r--test/idx_open.blc.dump45
-rw-r--r--test/idx_simple.blc (renamed from test/simple.blc)0
-rw-r--r--test/idx_simple.blc.dump45
-rw-r--r--test/idx_unbound.blc1
-rw-r--r--test/parenting.blc1
-rwxr-xr-xtest/run16
9 files changed, 163 insertions, 0 deletions
diff --git a/test/inc.blc b/test/idx_inc.blc
index 9cd3419..9cd3419 100644
--- a/test/inc.blc
+++ b/test/idx_inc.blc
diff --git a/test/idx_inc.blc.dump b/test/idx_inc.blc.dump
new file mode 100644
index 0000000..bede771
--- /dev/null
+++ b/test/idx_inc.blc.dump
@@ -0,0 +1,55 @@
+[DEBUG] reading from inc.blc
+[DEBUG] referring head of 71eb
+[DEBUG] referring head of 76e3
+[DEBUG] reducing...
+[DEBUG] queue size: 1
+
+---
+Map dump:
+type refs hash term parents
+1 1 bc00 [[1]] {([[1]] [1]), }
+1 1 d5b2 [([[1]] [1])] {}
+1 2 76e3 [1] {[[1]], ([[1]] [1]), }
+2 1 49e4 ([[1]] [1]) {[([[1]] [1])], }
+3 2 71eb 1 {[1], }
+---
+
+[DEBUG] reducing 49e4
+[DEBUG] substituting bc00 with 76e3
+[DEBUG] substituting 76e3 with 76e3
+[DEBUG] substituting 71eb with 76e3
+[DEBUG] shifting 76e3
+[DEBUG] shifting 71eb
+[DEBUG] rehashing var 71eb (2)
+[DEBUG] dereferring head of 71eb
+[DEBUG] dereferring head of 71eb
+[DEBUG] rehashing abs 76e3 (ccd5)
+[DEBUG] dereferring head of 76e3
+[DEBUG] rehashing abs 76e3 (e935)
+[DEBUG] dereferring head of 76e3
+[DEBUG] rehashing parents of 276f
+[DEBUG] rehashing abs bc00 (276f)
+[DEBUG] dereferring head of bc00
+[DEBUG] destroying head of bc00
+[DEBUG] destroying head of 49e4
+[DEBUG] destroying head of d5b2
+[DEBUG] rehashing parents of ae76
+[DEBUG] no more redexes!
+
+---
+Map dump:
+type refs hash term parents
+1 1 76e3 [1] {}
+3 1 ccd5 2 {[2], }
+1 1 e935 [2] {[[2]], }
+1 1 ae76 [[[2]]] {}
+3 1 71eb 1 {[1], }
+1 1 276f [[2]] {[[[2]]], }
+---
+
+[DEBUG] destroying head of 76e3
+[DEBUG] destroying head of ccd5
+[DEBUG] destroying head of e935
+[DEBUG] destroying head of 276f
+[DEBUG] destroying head of ae76
+[DEBUG] destroying head of 71eb
diff --git a/test/open.blc b/test/idx_open.blc
index 1540526..1540526 100644
--- a/test/open.blc
+++ b/test/idx_open.blc
diff --git a/test/idx_open.blc.dump b/test/idx_open.blc.dump
new file mode 100644
index 0000000..94a265b
--- /dev/null
+++ b/test/idx_open.blc.dump
@@ -0,0 +1,45 @@
+[DEBUG] reading from open.blc
+[DEBUG] reducing...
+[DEBUG] queue size: 1
+
+---
+Map dump:
+type refs hash term parents
+1 1 bc00 [[1]] {([4] [[1]]), }
+1 1 7573 [4] {([4] [[1]]), }
+1 1 76e3 [1] {[[1]], }
+1 1 3418 [([4] [[1]])] {}
+3 1 71eb 1 {[1], }
+3 1 c8dd 4 {[4], }
+2 1 8cde ([4] [[1]]) {[([4] [[1]])], }
+---
+
+[DEBUG] reducing 8cde
+[DEBUG] substituting 7573 with bc00
+[DEBUG] substituting c8dd with bc00
+[DEBUG] shifting c8dd
+[DEBUG] rehashing var c8dd (3)
+[DEBUG] dereferring head of c8dd
+[DEBUG] dereferring head of 71eb
+[DEBUG] destroying head of 71eb
+[DEBUG] destroying head of 76e3
+[DEBUG] destroying head of bc00
+[DEBUG] destroying head of 8cde
+[DEBUG] destroying head of 3418
+[DEBUG] rehashing abs 7573 (5f3e)
+[DEBUG] dereferring head of 7573
+[DEBUG] destroying head of 7573
+[DEBUG] rehashing parents of f80c
+[DEBUG] dereferring head of c8dd
+[DEBUG] destroying head of c8dd
+[DEBUG] no more redexes!
+
+---
+Map dump:
+type refs hash term parents
+1 1 f80c [3] {}
+3 1 5f3e 3 {[3], }
+---
+
+[DEBUG] destroying head of f80c
+[DEBUG] destroying head of 5f3e
diff --git a/test/simple.blc b/test/idx_simple.blc
index 05c2b00..05c2b00 100644
--- a/test/simple.blc
+++ b/test/idx_simple.blc
diff --git a/test/idx_simple.blc.dump b/test/idx_simple.blc.dump
new file mode 100644
index 0000000..2adc459
--- /dev/null
+++ b/test/idx_simple.blc.dump
@@ -0,0 +1,45 @@
+[DEBUG] reading from simple.blc
+[DEBUG] reducing...
+[DEBUG] queue size: 1
+
+---
+Map dump:
+type refs hash term parents
+1 1 bc00 [[1]] {([0] [[1]]), }
+1 1 76e3 [1] {[[1]], }
+2 1 4db9 ([0] [[1]]) {[([0] [[1]])], }
+1 1 180b [0] {([0] [[1]]), }
+3 1 71eb 1 {[1], }
+1 1 4e2b [([0] [[1]])] {}
+3 1 b2bf 0 {[0], }
+---
+
+[DEBUG] reducing 4db9
+[DEBUG] substituting 180b with bc00
+[DEBUG] substituting b2bf with bc00
+[DEBUG] shifting bc00
+[DEBUG] shifting 76e3
+[DEBUG] shifting 71eb
+[DEBUG] rehashing abs 180b (bc00)
+[DEBUG] dereferring head of 180b
+[DEBUG] destroying head of 180b
+[DEBUG] destroying head of 4db9
+[DEBUG] destroying head of 4e2b
+[DEBUG] rehashing parents of 7deb
+[DEBUG] dereferring head of b2bf
+[DEBUG] destroying head of b2bf
+[DEBUG] no more redexes!
+
+---
+Map dump:
+type refs hash term parents
+1 1 bc00 [[1]] {[[[1]]], }
+1 1 76e3 [1] {[[1]], }
+3 1 71eb 1 {[1], }
+1 1 7deb [[[1]]] {}
+---
+
+[DEBUG] destroying head of bc00
+[DEBUG] destroying head of 7deb
+[DEBUG] destroying head of 76e3
+[DEBUG] destroying head of 71eb
diff --git a/test/idx_unbound.blc b/test/idx_unbound.blc
new file mode 100644
index 0000000..835abbb
--- /dev/null
+++ b/test/idx_unbound.blc
@@ -0,0 +1 @@
+01000000100010
diff --git a/test/parenting.blc b/test/parenting.blc
new file mode 100644
index 0000000..bc2a397
--- /dev/null
+++ b/test/parenting.blc
@@ -0,0 +1 @@
+01010010000000000111011110010010000000000111100111011110
diff --git a/test/run b/test/run
new file mode 100755
index 0000000..8822eb9
--- /dev/null
+++ b/test/run
@@ -0,0 +1,16 @@
+#!/bin/sh
+
+set -e
+
+FAIL="\033[0;31m[FAIL]\033[0m "
+SUCC="\033[0;32m[SUCC]\033[0m "
+
+# for file in *.blc; do
+for file in idx_open.blc idx_simple.blc; do
+ ../build/calm "$file" &>../build/"$file".dump
+ cmp "$file".dump ../build/"$file".dump && printf "$SUCC" || printf "$FAIL"
+ echo "reduction of $file"
+ rm ../build/"$file".dump
+ valgrind --leak-check=full -s --error-exitcode=1 ../build/calm "$file" &>/dev/null && printf "$SUCC" || printf "$FAIL"
+ echo "memory failures of $file"
+done