about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rw-r--r--subx/002test.cc20
-rwxr-xr-xsubx/build1
2 files changed, 20 insertions, 1 deletions
diff --git a/subx/002test.cc b/subx/002test.cc
index 33560a9d..af6c34a3 100644
--- a/subx/002test.cc
+++ b/subx/002test.cc
@@ -54,7 +54,7 @@ if (Run_tests) {
   time_t t;  time(&t);
   cerr << "C tests: " << ctime(&t);
   for (size_t i=0;  i < sizeof(Tests)/sizeof(Tests[0]);  ++i) {
-//?     cerr << "running .build/test_list line " << (i+1) << '\n';
+//?     cerr << "running " << Test_names[i] << '\n';
     run_test(i);
     if (Passed) cerr << '.';
     else ++num_failures;
@@ -82,5 +82,23 @@ void run_test(size_t i) {
   // End Test Teardown
 }
 
+//: Convenience: run a single test
+:(before "Globals")
+// Names for each element of the 'Tests' global, respectively.
+const string Test_names[] = {
+  #include "test_name_list"  // auto-generated; see 'build*' scripts
+};
+:(after "Test Runs")
+string maybe_single_test_to_run = argv[argc-1];
+if (!starts_with(maybe_single_test_to_run, "test_"))
+  maybe_single_test_to_run.insert(0, "test_");
+for (size_t i=0;  i < sizeof(Tests)/sizeof(Tests[0]);  ++i) {
+  if (Test_names[i] == maybe_single_test_to_run) {
+    run_test(i);
+    if (Passed) cerr << ".\n";
+    return 0;
+  }
+}
+
 :(before "End Includes")
 #include <stdlib.h>
diff --git a/subx/build b/subx/build
index 7d01f975..3bcbfc0c 100755
--- a/subx/build
+++ b/subx/build
@@ -98,6 +98,7 @@ older_than subx.cc $LAYERS ../enumerate/enumerate ../tangle/tangle && {
 
 grep -h "^[^[:space:]#].*) {$" subx.cc  |grep -v ":.*("  |sed 's/ {.*/;/'  |update function_list
 grep -h "^\s*void test_" subx.cc  |sed 's/^\s*void \(.*\)() {.*/\1,/'  |update test_list
+grep -h "^\s*void test_" subx.cc  |sed 's/^\s*void \(.*\)() {.*/"\1",/'  |update test_name_list
 
 older_than subx_bin subx.cc *_list && {
   $CXX $CFLAGS subx.cc -o subx_bin
34ded306526bd87568e50ac9a6e03c9c0594'>^
a654e4ec ^
dbe12410 ^
4690ce81 ^
a654e4ec ^
e5c11a51 ^
70f4e9b6 ^
d059fe74 ^
672e3e50 ^

a654e4ec ^



e5c11a51 ^






















a654e4ec ^

672e3e50 ^
e5c11a51 ^
a654e4ec ^
204dae92 ^

















201458e3 ^
204dae92 ^
201458e3 ^
204dae92 ^


201458e3 ^
204dae92 ^




201458e3 ^
204dae92 ^
201458e3 ^
204dae92 ^











201458e3 ^
fd7d8138 ^
201458e3 ^
fd7d8138 ^
204dae92 ^


201458e3 ^
204dae92 ^


201458e3 ^
204dae92 ^














201458e3 ^
fd7d8138 ^

204dae92 ^

201458e3 ^
204dae92 ^
201458e3 ^

204dae92 ^
201458e3 ^

204dae92 ^




201458e3 ^
204dae92 ^


598f1b53 ^
204dae92 ^


201458e3 ^
204dae92 ^
201458e3 ^
204dae92 ^
672e3e50 ^


a654e4ec ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162