aboutsummaryrefslogtreecommitdiff
path: root/tests/testunit.pd
blob: bc723a7c834642ca436bda5351e56cbc5ae068e3 (plain)
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
#N canvas 578 118 585 499 10;
#N canvas 456 161 474 559 run-test 0;
#X obj 71 136 symbol;
#X obj 71 104 inlet test-to-run;
#X obj 71 514 outlet result;
#X obj 71 440 pack 0 s;
#X msg 113 136 bang;
#N canvas 396 344 450 300 print 0;
#X obj 101 247 print regression-test;
#X obj 101 204 pack s s;
#X obj 101 117 select 1;
#X obj 152 137 b;
#X msg 152 160 failed;
#X msg 101 138 OK;
#X obj 101 185 symbol;
#X msg 101 223 \$2: \$1;
#X obj 101 52 inlet result;
#X obj 101 89 unpack 0 s;
#X connect 1 0 7 0;
#X connect 2 0 5 0;
#X connect 2 1 3 0;
#X connect 3 0 4 0;
#X connect 4 0 6 0;
#X connect 5 0 6 0;
#X connect 6 0 1 0;
#X connect 7 0 0 0;
#X connect 8 0 9 0;
#X connect 9 0 2 0;
#X connect 9 1 1 1;
#X restore 96 491 pd print result;
#X obj 71 252 t f b;
#X text 99 217 start regression test;
#X text 105 251 regression test finished;
#N canvas 318 184 905 641 get 0;
#X obj 105 488 outlet;
#X obj 105 26 inlet reset;
#X obj 105 71 t b b b;
#X obj 162 229 spigot;
#X msg 228 229 1;
#X msg 258 229 0;
#X obj 202 229 t f;
#X obj 163 120 s \$0-send;
#X text 248 120 <- start the test;
#X text 250 168 <- test result;
#X obj 162 165 r \$0-receive;
#X obj 105 342 spigot;
#X obj 228 212 t b b;
#X msg 129 45 bang;
#X obj 162 260 select -1;
#X obj 105 401 t f b;
#X msg 162 278 0;
#X msg 105 316 0;
#X text 136 321 <--------------- fail as default;
#X text 228 262 <- "-1" indicates "wait for result";
#X obj 105 430 t b f;
#X obj 105 446 del 0;
#X obj 105 462 f;
#X text 149 450 <--- buffering \, since we have to avoid that the object
triggers it's own destruction (stack corruption);
#X connect 1 0 2 0;
#X connect 2 0 17 0;
#X connect 2 1 7 0;
#X connect 2 2 12 0;
#X connect 3 0 14 0;
#X connect 4 0 6 0;
#X connect 5 0 6 0;
#X connect 6 0 3 1;
#X connect 6 0 11 1;
#X connect 10 0 3 0;
#X connect 11 0 15 0;
#X connect 12 0 4 0;
#X connect 13 0 2 0;
#X connect 14 0 16 0;
#X connect 14 1 15 0;
#X connect 15 0 20 0;
#X connect 15 1 5 0;
#X connect 16 0 11 1;
#X connect 17 0 11 0;
#X connect 20 0 21 0;
#X connect 20 1 22 1;
#X connect 21 0 22 0;
#X connect 22 0 0 0;
#X restore 71 232 pd get result;
#X text 64 17 the test MUST return a result!;
#X text 77 64 cons: the regression test suite will block until the
test returns a result (potentially infinitely long)!;
#X text 77 33 pros: the test need not be finished in zero-time (good
for testing signal-objects or timed objects);
#X obj 71 470 t l l;
#N canvas 4 49 625 330 create/destroy 0;
#X obj 148 53 inlet;
#X obj 449 48 inlet clear;
#X obj 148 129 pack s \$0;
#X msg 173 196 clear;
#X obj 449 76 t b;
#X obj 148 148 t l b;
#X msg 148 165 obj 100 100 r \$2-send \, obj 100 150 \$1 \, obj 100
200 s \$2-receive \, connect 0 0 1 0 \, connect 1 0 2 0;
#X obj 148 228 s pd-\$0-regressiontest;
#X obj 148 94 t s;
#X connect 0 0 8 0;
#X connect 1 0 4 0;
#X connect 2 0 5 0;
#X connect 3 0 7 0;
#X connect 4 0 3 0;
#X connect 5 0 6 0;
#X connect 5 1 3 0;
#X connect 6 0 7 0;
#X connect 8 0 2 0;
#X restore 146 324 pd create/destroy testpatch;
#N canvas 0 0 450 300 restartaudio 0;
#X obj 113 77 inlet;
#X obj 113 99 t b;
#X msg 113 121 dsp 0 \, dsp 1;
#X obj 113 143 s pd;
#X connect 0 0 1 0;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X restore 141 186 pd restartaudio;
#X obj 71 214 t b;
#X obj 71 186 t b b;
#X obj 71 164 t b s s s;
#X obj 142 165 print starting;
#X connect 0 0 18 0;
#X connect 1 0 0 0;
#X connect 3 0 13 0;
#X connect 4 0 0 0;
#X connect 6 0 3 0;
#X connect 6 1 14 1;
#X connect 9 0 6 0;
#X connect 13 0 2 0;
#X connect 13 1 5 0;
#X connect 16 0 9 0;
#X connect 17 0 16 0;
#X connect 17 1 15 0;
#X connect 18 0 17 0;
#X connect 18 1 14 0;
#X connect 18 2 3 1;
#X connect 18 3 19 0;
#X restore 94 218 pd run-test;
#X obj 94 243 outlet;
#X obj 94 191 inlet;
#N canvas 488 403 450 300 \$0-regressiontest 0;
#X restore 92 266 pd \$0-regressiontest;
#X text 64 17 the test MUST IMMEDIATELY return a result!;
#X text 87 39 1: OK (test passed);
#X text 87 52 0: KO (test failed);
#X text 81 68 -1:;
#X text 103 68 WAIT (test takes some time);
#X text 64 92 if no result is returned immediately \, the test is considered
to be FAILED!;
#X text 63 131 note: we could have this be using "0" as the WAIT result
\, an no-result as KO \; for legacy reasons we don't;
#X connect 0 0 1 0;
#X connect 2 0 0 0;