Skip to content

Commit 0bec97d

Browse files
committedMay 21, 2016
Add v1.1 tests
1 parent 9f4afee commit 0bec97d

File tree

12 files changed

+364
-0
lines changed

12 files changed

+364
-0
lines changed
 

‎tests.in/044

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
# This is 8 of John Tromp's 9-rule abstraction algorithm, exercizing the parts
2+
# that make it different from H&S Rule 2.18 (abcf) abstraction.
3+
rule: I 1 -> 1
4+
rule: K 1 2 -> 1
5+
rule: S 1 2 3 -> 1 3 (2 3)
6+
abstraction: [_] S K * -> S K
7+
abstraction: [_] *- -> K 1
8+
abstraction: [_] *- _ -> 1
9+
abstraction: [_] _ -> I
10+
abstraction: [_] _ * _ -> [_] S S K _ 2
11+
abstraction: [_] (*! (*! *)) -> [_] (S (K 1) 2 3)
12+
abstraction: [_] (*! * *!) -> [_] (S 1 (K 3) 2)
13+
abstraction: [_] * * -> S ([_] 1) ([_] 2)
14+
[x] S K S
15+
[x] S K (S S)
16+
[x] S K m
17+
[x] S K (m n)
18+
[x] S K x
19+
[x] S K (x n)
20+
[x] S K (x S)
21+
[x] S K (S x)
22+
[x] M
23+
[x] M N
24+
[x] M N L
25+
[x] S
26+
[x] S S
27+
[x] (S K S)
28+
[x] M x
29+
[x] M N x
30+
[x] M N L x
31+
[x] S x
32+
[x] S S x
33+
[x] (S K S) x
34+
[x] x
35+
[x] (S (K (m x)))
36+
([x] (S (K (m x)))) x
37+
[x] x x x
38+
[x] S K x
39+
[x] S K z
40+
[x] S K I
41+
[x] S x S
42+
[x] S x (S S)

‎tests.in/045

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# $Id: 045,v 1.1 2011/03/24 19:45:20 bediger Exp $
2+
rule: I 1 -> 1
3+
rule: K 1 2 -> 1
4+
rule: S 1 2 3 -> 1 3 (2 3)
5+
#
6+
# This illustrates a potential flaw in distinguishing '*-' from '*!':
7+
# If the *! abstraction rule comes first, it gets used. If the
8+
# '*-' rule comes first, it gets used.
9+
abstraction: [_] *! -> (I K) 1
10+
abstraction: [_] *- -> K 1
11+
[x] y z # Should hit '*-' rule
12+
[x] K K # Should hit '*!' rule

‎tests.in/046

+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# Exercize "on" and "off" special case in lexer
2+
load "on"
3+
load "\on"
4+
load "off"
5+
load "\off"
6+
load on
7+
load off
8+
load yowza
9+
rule: I 1 -> 1
10+
rule: K 1 2 -> 1
11+
rule: S 1 2 3 -> 1 3 (2 3)
12+
abstraction: [_] *- -> K 1
13+
abstraction: [_] _ -> I
14+
abstraction: [_] *- _ -> 1
15+
abstraction: [_] * * -> S ([_] 1) ([_] 2)
16+
([on] on on) x
17+
([off] off (m off)) x
18+
def on I
19+
on a
20+
def off I
21+
off b
22+
debug on
23+
debug off
24+
elaborate on
25+
elaborate off
26+
trace on
27+
trace off
28+
step on
29+
step off
30+
abstraction: [_] on * -> K 2
31+
abstraction: [_] * off -> K 1

‎tests.in/047

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# A tottally rediculous abstraction rule to get
2+
# the circular buffer-based queue data structure to
3+
# overflow the circular buffer.
4+
# $Id: 047,v 1.1 2011/03/24 19:45:20 bediger Exp $
5+
rule: I 1 -> 1
6+
rule: K 1 2 -> 1
7+
rule: S 1 2 3 -> 1 3 (2 3)
8+
9+
abstraction: [_] a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a)))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a)))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a)))))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a)))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a)))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))))))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a)))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a)))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))))))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a)))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a)))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a)))))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a)))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a)))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a))) (a a (a a) (a a (a a)) (a a (a a) (a a (a a)))))))) -> K 1
10+
abstraction: [_] *- -> K 1
11+
abstraction: [_] _ -> I
12+
abstraction: [_] *- _ -> 1
13+
abstraction: [_] * * -> S ([_] 1) ([_] 2)

‎tests.in/048

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# From Johannes Waldmann's thesis, "The Combinator S", section 5.4, "Monsters".
2+
# "A monster is a term with a normal form that is very large and many reduction
3+
# steps away.
4+
# Section 5.4.1. Ax Ay S are monsters.
5+
rule: S 1 2 3 -> 1 3 (2 3)
6+
trace on
7+
def A0 S
8+
def T1 (S S)
9+
def A1 (T1 A0)
10+
def A2 (T1 A1)
11+
def A3 (T1 A2)
12+
def A4 (T1 A3)
13+
def A5 (T1 A4)
14+
def A6 (T1 A5)
15+
16+
# Try to trigger a number of struct buffer resizes, resize_buffer()
17+
# function in buffer.c
18+
A3 A2 S

‎tests.in/049

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Exercize some otherwise un-executed code branches in
2+
# print_tree() in node.c
3+
rule: W 1 2 -> 1 2 2
4+
rule: K 1 2 -> 1
5+
trace on
6+
elaborate on
7+
debug on
8+
W (W K) x

‎tests.out/044

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
S K
2+
S K
3+
S K
4+
S K
5+
S K
6+
S K
7+
S K
8+
S K
9+
S K
10+
S K
11+
S K
12+
S K
13+
S K
14+
S K
15+
S K
16+
S K
17+
K M
18+
K M
19+
K (M N)
20+
K (M N)
21+
K (M N L)
22+
K (M N L)
23+
K S
24+
K S
25+
K (S S)
26+
K (S S)
27+
S K
28+
S K
29+
M
30+
M
31+
M N
32+
M N
33+
M N L
34+
M N L
35+
S
36+
S
37+
S S
38+
S S
39+
S K S
40+
S K S
41+
I
42+
I
43+
S (K (S (K S) K)) m
44+
S (K (S (K S) K)) m
45+
S (K (S (K S) K)) m x
46+
S (K (m x))
47+
S (S S K) I
48+
S (S S K) I
49+
S K
50+
S K
51+
S K
52+
S K
53+
S K
54+
S K
55+
S S (K S)
56+
S S (K S)
57+
S S (K (S S))
58+
S S (K (S S))

‎tests.out/045

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
K (y z)
2+
K (y z)
3+
I K (K K)
4+
K (K K)

‎tests.out/046

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
S I I x
2+
x x
3+
S I m x
4+
x (m x)
5+
I a
6+
a
7+
I b
8+
b

‎tests.out/047

Whitespace-only changes.

‎tests.out/048

+72
Large diffs are not rendered by default.

‎tests.out/049

+98
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
W{1} {5} (W{2} {4} K{3}) {7} x{6}
2+
W{1} {5} (W{2} {4} K{3}) {7} x{6} {9}+ ()
3+
push left branch on stack, depth now 2
4+
pop stack 0 items
5+
didn't performed reduction, popped 0, stack depth now 2: W{1} {5} (W{2} {4} K{3}) {7}+ x{6} {9} ()
6+
direction left
7+
direction now left
8+
push left branch on stack, depth now 3
9+
pop stack 0 items
10+
didn't performed reduction, popped 0, stack depth now 3: W{1} {5}+ (W{2} {4} K{3}) {7} x{6} {9} ()
11+
direction left
12+
direction now left
13+
push left branch on stack, depth now 4
14+
pop stack 0 items
15+
didn't performed reduction, popped 0, stack depth now 4: W{1}+ {5} (W{2} {4} K{3}) {7} x{6} {9} ()
16+
direction left
17+
direction now left
18+
W reduction (sn 1), stack depth 4, before: W{1}+ {5} (W{2} {4} K{3}) {7} x{6}
19+
pop stack 3 items
20+
performed reduction, popped 3, stack depth now 1: W{2} {4} K{3} {10} x{6} {11} x{6} {9}+ ()
21+
direction left
22+
direction now left
23+
W reduction, after: W{2} {4} K{3} {10} x{6} {11} x{6}
24+
W{2} {4} K{3} {10} x{6} {11} x{6}
25+
push left branch on stack, depth now 2
26+
pop stack 0 items
27+
didn't performed reduction, popped 0, stack depth now 2: W{2} {4} K{3} {10} x{6} {11}+ x{6} {9} ()
28+
direction left
29+
direction now left
30+
push left branch on stack, depth now 3
31+
pop stack 0 items
32+
didn't performed reduction, popped 0, stack depth now 3: W{2} {4} K{3} {10}+ x{6} {11} x{6} {9} ()
33+
direction left
34+
direction now left
35+
push left branch on stack, depth now 4
36+
pop stack 0 items
37+
didn't performed reduction, popped 0, stack depth now 4: W{2} {4}+ K{3} {10} x{6} {11} x{6} {9} ()
38+
direction left
39+
direction now left
40+
push left branch on stack, depth now 5
41+
pop stack 0 items
42+
didn't performed reduction, popped 0, stack depth now 5: W{2}+ {4} K{3} {10} x{6} {11} x{6} {9} ()
43+
direction left
44+
direction now left
45+
W reduction (sn 2), stack depth 5, before: W{2}+ {4} K{3} {10} x{6} {11} x{6}
46+
pop stack 3 items
47+
performed reduction, popped 3, stack depth now 2: K{3} {7} x{6} {5} x{6} {11}+ x{6} {9} ()
48+
direction left
49+
direction now left
50+
W reduction, after: K{3} {7} x{6} {5} x{6} {11}+ x{6}
51+
K{3} {7} x{6} {5} x{6} {11} x{6}
52+
push left branch on stack, depth now 3
53+
pop stack 0 items
54+
didn't performed reduction, popped 0, stack depth now 3: K{3} {7} x{6} {5}+ x{6} {11} x{6} {9} ()
55+
direction left
56+
direction now left
57+
push left branch on stack, depth now 4
58+
pop stack 0 items
59+
didn't performed reduction, popped 0, stack depth now 4: K{3} {7}+ x{6} {5} x{6} {11} x{6} {9} ()
60+
direction left
61+
direction now left
62+
push left branch on stack, depth now 5
63+
pop stack 0 items
64+
didn't performed reduction, popped 0, stack depth now 5: K{3}+ {7} x{6} {5} x{6} {11} x{6} {9} ()
65+
direction left
66+
direction now left
67+
K reduction (sn 3), stack depth 5, before: K{3}+ {7} x{6} {5} x{6} {11} x{6}
68+
pop stack 3 items
69+
performed reduction, popped 3, stack depth now 2: x{6} {11}+ x{6} {9} ()
70+
direction left
71+
direction now left
72+
K reduction, after: x{6} {11}+ x{6}
73+
x{6} {11} x{6}
74+
push left branch on stack, depth now 3
75+
pop stack 0 items
76+
didn't performed reduction, popped 0, stack depth now 3: x{6}+ {11} x{6}+ {9} ()
77+
direction left
78+
direction now left
79+
x atom, stack depth 3, required depth -1.
80+
pop stack 1 items
81+
didn't performed reduction, popped 1, stack depth now 2: x{6} {11}+ x{6} {9} ()
82+
direction left
83+
direction now right
84+
push right branch on stack, depth now 2
85+
pop stack 0 items
86+
didn't performed reduction, popped 0, stack depth now 2: x{6}+ {11} x{6}+ {9} ()
87+
direction right
88+
direction now left
89+
x atom, stack depth 2, required depth -1.
90+
pop stack 1 items
91+
didn't performed reduction, popped 1, stack depth now 2: x{6} {11}+ x{6} {9} ()
92+
direction left
93+
direction now up
94+
pop stack 1 items
95+
didn't performed reduction, popped 1, stack depth now 1: x{6} {11} x{6} {9}+ ()
96+
direction up
97+
direction now up
98+
x x

0 commit comments

Comments
 (0)
Please sign in to comment.