git @ Cat's Eye Technologies Nhohnhehr / 75174c3
Add slightly more complete and slightly better structured test suite. Chris Pressey 7 months ago
3 changed file(s) with 63 addition(s) and 10 deletion(s). Raw diff Collapse all Expand all
00 #!/bin/sh
11
2 # Just a rudimentary sanity test, better than nothing.
3
4 EXPECTED='110101010101011111111'
5 R=`echo '11111110000001' | src/nhohnhehr.py bits eg/reverse-esque.nho`
6 if [ $R = $EXPECTED ]; then
7 echo 'Sanity test passed.'
8 else
9 echo "Expected $EXPECTED but got $R."
10 exit 1
11 fi
2 APPLIANCES="tests/appliances/nhohnhehr.py.md"
3 falderal $APPLIANCES tests/Nhohnhehr.md || exit 1
0 Test Suite for Nhohnhehr
1 ========================
2
3 This test suite is written in [Falderal][] format.
4
5 [Falderal]: https://catseye.tc/node/Falderal
6
7 -> Tests for functionality "Run Nhohnhehr program, outputting at most 80 bits"
8
9 "Reverse-esque" example.
10
11 | +------------+
12 | | /} |
13 | |&#/$? \ |
14 | | / \& |
15 | | |
16 | | |
17 | | 0 |
18 | | ! |
19 | | |
20 | | |
21 | | {1 /# |
22 | | { |
23 | |\\@ |
24 | +------------+
25 + 11111110000001
26 = 110101010101011111111
27
28 "Read and store" example.
29
30 | +------+
31 | | /}|
32 | |&#/$?@|
33 | | / \&|
34 | | |
35 | | { |
36 | |\\ |
37 | +------+
38 + 11111110000001
39 =
40
41 Truth-machine example.
42
43 | +---+
44 | |@/0|
45 | |$? |
46 | |#\1|
47 | +---+
48 + 0
49 = 0
50
51 | +---+
52 | |@/0|
53 | |$? |
54 | |#\1|
55 | +---+
56 + 1
57 = 11111111111111111111111111111111111111111111111111111111111111111111111111111111
0 -> Functionality "Run Nhohnhehr program, outputting at most 80 bits" is implemented by
1 -> shell command
2 -> "python src/nhohnhehr.py bits %(test-body-file) <%(test-input-file) | head -c 80"