Debian Codegraph @

test/curve.c

raw symbols SCIP
1 /*
2 *
3 * Copyright 2002 Robert Krawitz ([email protected])
4 *
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the Free
7 * Software Foundation; either version 2 of the License, or (at your option)
8 * any later version.
9 *
10 * This program is distributed in the hope that it will be useful, but
11 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
12 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
13 * for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <https://www.gnu.org/licenses/>.
17 */
18
19 #ifdef HAVE_CONFIG_Hcxx . . $ `<built-in>:411:9`!
20 #include <config.h>cxx . . $ `<file>/config.h`/
21 #endif
22 #include <stdlib.h>
23 #include <stdio.h>
24 #include <fcntl.h>
25 #include <unistd.h>
26 #include <string.h>
27 #include <limits.h>
28 #ifdef __GNU_LIBRARY__cxx . . $ `<external>/18206667465210621810/features.h:510:9`!
29 #include <getopt.h>
30 #endif
31
32 #pragma GCC diagnostic ignored "-Woverlength-strings"
33
34 #define DEBUG_SIGNALcxx . . $ `test/curve.c:34:9`!
35 #define MINcxx . . $ `test/curve.c:35:9`!(x, y) ((x) <= (y) ? (x) : (y))
36 #include <gutenprint/gutenprint.h>cxx . . $ `<file>/include/gutenprint/gutenprint.h`/
37
38 int global_test_countcxx . . $ global_test_count. = 0;
39 int global_error_countcxx . . $ global_error_count. = 0;
40 int verbosecxx . . $ verbose. = 0;
41 int quietcxx . . $ quiet. = 0;
42
43 #ifdef __GNU_LIBRARY__cxx . . $ `<external>/18206667465210621810/features.h:510:9`!
44
45 struct optioncxx . . $ option# optlistcxx . . $ optlist.[] =
46 {
47 { "quiet", 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, (int) 'q' },
48 { "verbose", 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, (int) 'v' },
49 { NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0, NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!, 0 }
50 };
51 #endif
52
53 struct test_failurecxx . . $ test_failure#
54 {
55 int test_numbercxx . . $ test_failure#test_number.;
56 struct test_failurecxx . . $ test_failure# *nextcxx . . $ test_failure#next.;
57 };
58
59 static struct test_failurecxx . . $ test_failure# *test_failure_headcxx . . $ test_failure_head. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
60 static struct test_failurecxx . . $ test_failure# *test_failure_tailcxx . . $ test_failure_tail. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
61
62 static const char *current_test_namecxx . . $ current_test_name.;
63 static int current_test_linecxx . . $ current_test_line.;
64
65 static void
66 TEST_internalcxx . . $ TEST_internal(34d26762b42c433a).(const char *name, int line)
67 {
68 global_test_countcxx . . $ global_test_count.++;
69 current_test_namecxx . . $ current_test_name. = name;
70 current_test_linecxx . . $ current_test_line. = line;
71 }
72
73 #define TESTcxx . . $ `test/curve.c:73:9`!(name) TEST_internal(name, __LINE__)
74
75 static void
76 TEST_PASScxx . . $ TEST_PASS(49f6e7a06ebc5aa8).(void)
77 {
78 if (verbosecxx . . $ verbose.)
79 printfcxx . . $ printf(581fddd72a8db8fc).("%d.%d: Checking %s... PASS\n", global_test_countcxx . . $ global_test_count., current_test_linecxx . . $ current_test_line.,
80 current_test_namecxx . . $ current_test_name.);
81 fflushcxx . . $ fflush(89bc1efcdac0ca22).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!);
82 }
83
84 static void
85 TEST_FAILcxx . . $ TEST_FAIL(49f6e7a06ebc5aa8).(void)
86 {
87 struct test_failurecxx . . $ test_failure# *test_failure_tmp = malloccxx . . $ malloc(bfcfa4d6b7f7ef64).(sizeof(struct test_failurecxx . . $ test_failure#));
88 test_failure_tmp->nextcxx . . $ test_failure#next. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
89 test_failure_tmp->test_numbercxx . . $ test_failure#test_number. = global_test_countcxx . . $ global_test_count.;
90
91 if (!test_failure_headcxx . . $ test_failure_head.)
92 {
93 test_failure_headcxx . . $ test_failure_head. = test_failure_tmp;
94 test_failure_tailcxx . . $ test_failure_tail. = test_failure_headcxx . . $ test_failure_head.;
95 }
96 else
97 {
98 test_failure_tailcxx . . $ test_failure_tail.->nextcxx . . $ test_failure#next. = test_failure_tmp;
99 test_failure_tailcxx . . $ test_failure_tail. = test_failure_tmp;
100 }
101
102 global_error_countcxx . . $ global_error_count.++;
103 printfcxx . . $ printf(581fddd72a8db8fc).("%d.%d: Checking %s... FAIL\n", global_test_countcxx . . $ global_test_count., current_test_linecxx . . $ current_test_line.,
104 current_test_namecxx . . $ current_test_name.);
105 fflushcxx . . $ fflush(89bc1efcdac0ca22).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!);
106 }
107
108 #define SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(conditional) \
109 do { \
110 if ((conditional)) \
111 TEST_PASS(); \
112 else \
113 TEST_FAIL(); \
114 } while (0)
115
116 static const double standard_sat_adjustmentcxx . . $ standard_sat_adjustment.[] =
117 {
118 0.50, 0.6, 0.7, 0.8, 0.9, 0.86, 0.82, 0.79, /* C */
119 0.78, 0.8, 0.83, 0.87, 0.9, 0.95, 1.05, 1.15, /* B */
120 1.3, 1.25, 1.2, 1.15, 1.12, 1.09, 1.06, 1.03, /* M */
121 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, /* R */
122 1.0, 0.9, 0.8, 0.7, 0.65, 0.6, 0.55, 0.52, /* Y */
123 0.48, 0.47, 0.47, 0.49, 0.49, 0.49, 0.52, 0.51, /* G */
124 };
125
126 static const double reverse_sat_adjustmentcxx . . $ reverse_sat_adjustment.[] =
127 {
128 0.50, 0.51, 0.52, 0.49, 0.49, 0.49, 0.47, 0.47,
129 0.48, 0.52, 0.55, 0.6, 0.65, 0.7, 0.8, 0.9,
130 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0,
131 1.0, 1.03, 1.06, 1.09, 1.12, 1.15, 1.2, 1.25,
132 1.3, 1.15, 1.05, 0.95, 0.9, 0.87, 0.83, 0.8,
133 0.78, 0.79, 0.82, 0.86, 0.9 , 0.8, 0.7, 0.6,
134 };
135
136 static const stp_curve_point_tcxx . . $ stp_curve_point_t# standard_piecewise_sat_adjustmentcxx . . $ standard_piecewise_sat_adjustment.[] =
137 {
138 { 0.00, 0.50},
139 { 0.02, 0.6},
140 { 0.04, 0.7},
141 { 0.06, 0.8},
142 { 0.08, 0.9},
143 { 0.10, 0.86},
144 { 0.12, 0.82},
145 { 0.14, 0.79},
146 { 0.16, 0.78},
147 { 0.18, 0.8},
148 { 0.20, 0.83},
149 { 0.22, 0.87},
150 { 0.24, 0.9},
151 { 0.26, 0.95},
152 { 0.28, 1.05},
153 { 0.30, 1.15},
154 { 0.32, 0.05},
155 { 0.34, 3.95},
156 { 0.36, 0.05},
157 { 0.38, 1.15},
158 { 0.40, 1.12},
159 { 0.42, 1.09},
160 { 0.44, 1.06},
161 { 0.46, 1.03},
162 { 0.48, 1.0},
163 { 0.50, 1.0},
164 { 0.52, 1.0},
165 { 0.54, 1.0},
166 { 0.56, 1.0},
167 { 0.58, 1.0},
168 { 0.60, 1.0},
169 { 0.62, 1.0},
170 { 0.64, 1.0},
171 { 0.66, 0.9},
172 { 0.68, 0.8},
173 { 0.70, 0.7},
174 { 0.72, 0.65},
175 { 0.74, 0.6},
176 { 0.76, 0.55},
177 { 0.78, 0.52},
178 { 0.80, 0.48},
179 { 0.82, 0.47},
180 { 0.84, 0.47},
181 { 0.86, 0.49},
182 { 0.88, 0.49},
183 { 0.90, 0.49},
184 { 0.93, 0.52},
185 { 0.96, 0.51},
186 { 1.00, 2},
187 };
188
189 static const stp_curve_point_tcxx . . $ stp_curve_point_t# reverse_piecewise_sat_adjustmentcxx . . $ reverse_piecewise_sat_adjustment.[] =
190 {
191 { 0.00, 0.50},
192 { 0.02, 0.6},
193 { 0.04, 0.7},
194 { 0.06, 0.8},
195 { 0.08, 0.9},
196 { 0.10, 0.86},
197 { 0.12, 0.82},
198 { 0.14, 0.79},
199 { 0.16, 0.78},
200 { 0.18, 0.8},
201 { 0.20, 0.83},
202 { 0.22, 0.87},
203 { 0.24, 0.9},
204 { 0.26, 0.95},
205 { 0.28, 1.05},
206 { 0.30, 1.15},
207 { 0.32, 0.05},
208 { 0.34, 3.95},
209 { 0.36, 0.05},
210 { 0.38, 1.15},
211 { 0.40, 1.12},
212 { 0.42, 1.09},
213 { 0.44, 1.06},
214 { 0.46, 1.03},
215 { 0.48, 1.0},
216 { 0.50, 1.0},
217 { 0.52, 1.0},
218 { 0.54, 1.0},
219 { 0.56, 1.0},
220 { 0.58, 1.0},
221 { 0.60, 1.0},
222 { 0.62, 1.0},
223 { 0.64, 1.0},
224 { 0.66, 0.9},
225 { 0.68, 0.8},
226 { 0.70, 0.7},
227 { 0.72, 0.65},
228 { 0.74, 0.6},
229 { 0.76, 0.55},
230 { 0.78, 0.52},
231 { 0.80, 0.48},
232 { 0.82, 0.47},
233 { 0.84, 0.47},
234 { 0.86, 0.49},
235 { 0.88, 0.49},
236 { 0.90, 0.49},
237 { 0.93, 0.52},
238 { 0.96, 0.51},
239 { 1.00, 2},
240 };
241
242 const char *small_piecewise_curvecxx . . $ small_piecewise_curve. =
243 "<?xml version=\"1.0\"?>\n"
244 "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
245 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
246 "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
247 "<curve wrap=\"nowrap\" type=\"linear\" gamma=\"0\" piecewise=\"true\">\n"
248 "<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"4\">\n"
249 "0 0.5 0.1 0.6 1.00 0.51\n"
250 "</sequence>\n"
251 "</curve>\n"
252 "</gutenprint>\n";
253
254 const char *good_curvescxx . . $ good_curves.[] =
255 {
256 /* Space separated, in same layout as output for comparison */
257 "<?xml version=\"1.0\"?>\n"
258 "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
259 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
260 "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
261 "<curve wrap=\"wrap\" type=\"linear\" gamma=\"0\" piecewise=\"false\">\n"
262 "<sequence count=\"48\" lower-bound=\"0\" upper-bound=\"4\">\n"
263 "0.5 0.6 0.7 0.8 0.9 0.86 0.82 0.79 0.78 0.8 0.83 0.87 0.9 0.95 1.05 1.15\n"
264 "1.3 1.25 1.2 1.15 1.12 1.09 1.06 1.03 1 1 1 1 1 1 1 1 1 0.9 0.8 0.7 0.65\n"
265 "0.6 0.55 0.52 0.48 0.47 0.47 0.49 0.49 0.49 0.52 0.51\n"
266 "</sequence>\n"
267 "</curve>\n"
268 "</gutenprint>\n",
269
270 /* Space separated, in same layout as output for comparison */
271 "<?xml version=\"1.0\"?>\n"
272 "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
273 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
274 "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
275 "<curve wrap=\"nowrap\" type=\"linear\" gamma=\"0\" piecewise=\"false\">\n"
276 "<sequence count=\"48\" lower-bound=\"0\" upper-bound=\"4\">\n"
277 "0.5 0.6 0.7 0.8 0.9 0.86 0.82 0.79 0.78 0.8 0.83 0.87 0.9 0.95 1.05 1.15\n"
278 "1.3 1.25 1.2 1.15 1.12 1.09 1.06 1.03 1 1 1 1 1 1 1 1 1 0.9 0.8 0.7 0.65\n"
279 "0.6 0.55 0.52 0.48 0.47 0.47 0.49 0.49 0.49 0.52 0.51\n"
280 "</sequence>\n"
281 "</curve>\n"
282 "</gutenprint>\n",
283
284 /* Space separated, in same layout as output for comparison */
285 "<?xml version=\"1.0\"?>\n"
286 "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
287 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
288 "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
289 "<curve wrap=\"wrap\" type=\"spline\" gamma=\"0\" piecewise=\"false\">\n"
290 "<sequence count=\"48\" lower-bound=\"0\" upper-bound=\"4\">\n"
291 "0.5 0.6 0.7 0.8 0.9 0.86 0.82 0.79 0.78 0.8 0.83 0.87 0.9 0.95 1.05 1.15\n"
292 "1.3 1.25 1.2 1.15 1.12 1.09 1.06 1.03 1 1 1 1 1 1 1 1 1 0.9 0.8 0.7 0.65\n"
293 "0.6 0.55 0.52 0.48 0.47 0.47 0.49 0.49 0.49 0.52 0.51\n"
294 "</sequence>\n"
295 "</curve>\n"
296 "</gutenprint>\n",
297
298 /* Space separated, in same layout as output for comparison */
299 "<?xml version=\"1.0\"?>\n"
300 "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
301 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
302 "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
303 "<curve wrap=\"nowrap\" type=\"spline\" gamma=\"0\" piecewise=\"false\">\n"
304 "<sequence count=\"48\" lower-bound=\"0\" upper-bound=\"4\">\n"
305 "0.5 0.6 0.7 0.8 0.9 0.86 0.82 0.79 0.78 0.8 0.83 0.87 0.9 0.95 1.05 1.15\n"
306 "1.3 1.25 1.2 1.15 1.12 1.09 1.06 1.03 1 1 1 1 1 1 1 1 1 0.9 0.8 0.7 0.65\n"
307 "0.6 0.55 0.52 0.48 0.47 0.47 0.49 0.49 0.49 0.52 0.51\n"
308 "</sequence>\n"
309 "</curve>\n"
310 "</gutenprint>\n",
311
312 "<?xml version=\"1.0\"?>\n"
313 "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
314 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
315 "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
316 "<curve wrap=\"wrap\" type=\"linear\" gamma=\"0\" piecewise=\"true\">\n"
317 "<sequence count=\"96\" lower-bound=\"0\" upper-bound=\"4\">\n"
318 "0 0.5 0.02 0.6 0.04 0.7 0.06 0.8 0.08 0.9 0.1 0.86 0.12 0.82 0.14 0.79 0.16\n"
319 "0.78 0.18 0.8 0.2 0.83 0.22 0.87 0.24 0.9 0.26 0.95 0.28 1.05 0.3 1.15 0.32\n"
320 "1.3 0.34 1.25 0.36 1.2 0.38 1.15 0.4 1.12 0.42 1.09 0.44 1.06 0.46 1.03\n"
321 "0.48 1 0.5 1 0.52 1 0.54 1 0.56 1 0.58 1 0.6 1 0.62 1 0.64 1 0.66 0.9 0.68\n"
322 "0.8 0.7 0.7 0.72 0.65 0.74 0.6 0.76 0.55 0.78 0.52 0.8 0.48 0.82 0.47 0.84\n"
323 "0.47 0.86 0.49 0.88 0.49 0.9 0.49 0.93 0.52 0.96 0.51\n"
324 "</sequence>\n"
325 "</curve>\n"
326 "</gutenprint>\n",
327
328 "<?xml version=\"1.0\"?>\n"
329 "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
330 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
331 "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
332 "<curve wrap=\"wrap\" type=\"linear\" gamma=\"0\" piecewise=\"true\">\n"
333 "<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"4\">\n"
334 "0 0.5 0.02 0.6 0.96 0.51\n"
335 "</sequence>\n"
336 "</curve>\n"
337 "</gutenprint>\n",
338
339 /* Gamma curve 1 */
340 "<?xml version=\"1.0\"?>\n"
341 "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
342 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
343 "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
344 "<curve wrap=\"nowrap\" type=\"linear\" gamma=\"1\" piecewise=\"false\">\n"
345 "<sequence count=\"0\" lower-bound=\"0\" upper-bound=\"4\"/>\n"
346 "</curve>\n"
347 "</gutenprint>\n",
348
349 /* Gamma curve 2 */
350 "<?xml version=\"1.0\"?>\n"
351 "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
352 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
353 "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
354 "<curve wrap=\"nowrap\" type=\"linear\" gamma=\"1\" piecewise=\"false\">\n"
355 "<sequence count=\"0\" lower-bound=\"0\" upper-bound=\"4\"/>\n"
356 "</curve>\n"
357 "</gutenprint>\n"
358 };
359
360 static const int good_curve_countcxx . . $ good_curve_count. = sizeof(good_curvescxx . . $ good_curves.) / sizeof(const char *);
361
362 const char *bad_curvescxx . . $ bad_curves.[] =
363 {
364 /* Bad point count */
365 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
366 "<gutenprint><curve wrap=\"wrap\" type=\"linear\" gamma=\"0\" piecewise=\"false\">\n"
367 "<sequence count=\"-1\" lower-bound=\"0\" upper-bound=\"4\">\n"
368 "0.5 0.6 0.7 0.8 0.9 0.86 0.82 0.79 0.78 0.8\n"
369 "0.83 0.87 0.9 0.95 1.05 1.15 1.3 1.25 1.2 1.15\n"
370 "1.12 1.09 1.06 1.03 1 1 1 1 1 1\n"
371 "1 1 1 0.9 0.8 0.7 0.65 0.6 0.55 0.52\n"
372 "0.48 0.47 0.47 0.49 0.49 0.49 0.52 0.51\n"
373 "</sequence></curve></gutenprint>\n",
374
375 /* Bad point count */
376 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
377 "<gutenprint><curve wrap=\"wrap\" type=\"linear\" gamma=\"0\" piecewise=\"false\">\n"
378 "<sequence count=\"200\" lower-bound=\"0\" upper-bound=\"4\">\n"
379 "0.5 0.6 0.7 0.8 0.9 0.86 0.82 0.79 0.78 0.8\n"
380 "0.83 0.87 0.9 0.95 1.05 1.15 1.3 1.25 1.2 1.15\n"
381 "1.12 1.09 1.06 1.03 1 1 1 1 1 1\n"
382 "1 1 1 0.9 0.8 0.7 0.65 0.6 0.55 0.52\n"
383 "0.48 0.47 0.47 0.49 0.49 0.49 0.52 0.51\n"
384 "</sequence></curve></gutenprint>\n",
385
386 "<?xml version=\"1.0\"?>\n"
387 "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
388 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
389 "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
390 "<curve wrap=\"wrap\" type=\"linear\" gamma=\"0\" piecewise=\"true\">\n"
391 "<sequence count=\"5\" lower-bound=\"0\" upper-bound=\"4\">\n"
392 "0 0.5 0.02 0.6 0.96\n"
393 "</sequence>\n"
394 "</curve>\n"
395 "</gutenprint>\n",
396
397 "<?xml version=\"1.0\"?>\n"
398 "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
399 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
400 "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
401 "<curve wrap=\"nowrap\" type=\"linear\" gamma=\"0\" piecewise=\"true\">\n"
402 "<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"4\">\n"
403 "0 0.5 0.02 0.6 0.96 0.51\n"
404 "</sequence>\n"
405 "</curve>\n"
406 "</gutenprint>\n",
407
408 "<?xml version=\"1.0\"?>\n"
409 "<gutenprint xmlns=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0\"\n"
410 "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n"
411 "xsi:schemaLocation=\"http://gimp-print.sourceforge.net/xsd/gp.xsd-1.0 gutenprint.xsd\">\n"
412 "<curve wrap=\"nowrap\" type=\"linear\" gamma=\"0\" piecewise=\"true\">\n"
413 "<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"4\">\n"
414 "0.01 0.5 0.02 0.6 1.0 0.51\n"
415 "</sequence>\n"
416 "</curve>\n"
417 "</gutenprint>\n",
418
419 /* Gamma curves */
420 /* Incorrect wrap mode */
421 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
422 "<gutenprint><curve wrap=\"wrap\" type=\"linear\" gamma=\"1.0\" piecewise=\"false\">\n"
423 "<sequence count=\"-1\" lower-bound=\"0\" upper-bound=\"4\">\n"
424 "</sequence></curve></gutenprint>\n",
425
426 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
427 "<gutenprint><curve wrap=\"wrap\" type=\"linear\" gamma=\"1.0\" piecewise=\"false\">\n"
428 "<sequence count=\"1\" lower-bound=\"0\" upper-bound=\"4\">\n"
429 "</sequence></curve></gutenprint>\n",
430
431 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
432 "<gutenprint><curve wrap=\"wrap\" type=\"linear\" gamma=\"1.0\" piecewise=\"false\">\n"
433 "<sequence count=\"48\" lower-bound=\"0\" upper-bound=\"4\">\n"
434 "</sequence></curve></gutenprint>\n",
435
436 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
437 "<gutenprint><curve wrap=\"wrap\" type=\"linear\" gamma=\"1.0\" piecewise=\"false\">\n"
438 "<sequence count=\"0\" lower-bound=\"0\" upper-bound=\"4\">\n"
439 "</sequence></curve></gutenprint>\n"
440 };
441
442 static const int bad_curve_countcxx . . $ bad_curve_count. = sizeof(bad_curvescxx . . $ bad_curves.) / sizeof(const char *);
443
444 const char *linear_curve_1cxx . . $ linear_curve_1. =
445 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
446 "<gutenprint><curve wrap=\"nowrap\" type=\"linear\" gamma=\"0\" piecewise=\"false\">\n"
447 "<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"1\">\n"
448 "0 0 0 1 1 1"
449 "</sequence></curve></gutenprint>";
450
451 const char *linear_curve_2cxx . . $ linear_curve_2. =
452 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
453 "<gutenprint><curve wrap=\"wrap\" type=\"linear\" gamma=\"0\" piecewise=\"false\">\n"
454 "<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"1\">\n"
455 "0 0 0 1 1 1"
456 "</sequence></curve></gutenprint>";
457
458 const char *linear_curve_3cxx . . $ linear_curve_3. =
459 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
460 "<gutenprint><curve wrap=\"nowrap\" type=\"linear\" gamma=\"0\" piecewise=\"false\">\n"
461 "<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"1\">\n"
462 "0 0 0 1 1 1"
463 "</sequence></curve></gutenprint>";
464
465 const char *linear_curve_4cxx . . $ linear_curve_4. =
466 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
467 "<gutenprint><curve wrap=\"wrap\" type=\"linear\" gamma=\"0\" piecewise=\"false\">\n"
468 "<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"1\">\n"
469 "0 0 0 1 1 1"
470 "</sequence></curve></gutenprint>";
471
472 const char *spline_curve_1cxx . . $ spline_curve_1. =
473 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
474 "<gutenprint><curve wrap=\"nowrap\" type=\"spline\" gamma=\"0\" piecewise=\"false\">\n"
475 "<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"1\">\n"
476 "0 0 0 1 1 1"
477 "</sequence></curve></gutenprint>";
478
479 const char *spline_curve_2cxx . . $ spline_curve_2. =
480 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
481 "<gutenprint><curve wrap=\"wrap\" type=\"spline\" gamma=\"0\" piecewise=\"false\">\n"
482 "<sequence count=\"6\" lower-bound=\"0\" upper-bound=\"1\">\n"
483 "0 0 0 1 1 1"
484 "</sequence></curve></gutenprint>";
485
486 static void
487 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(stp_curve_tcxx . . $ stp_curve_t# *curve1, int resample_points, size_t expected)
488 {
489 stp_curve_tcxx . . $ stp_curve_t# *curve2;
490 const stp_curve_point_tcxx . . $ stp_curve_point_t# *curve_points;
491 size_t count;
492 size_t i;
493 double low;
494
495 TESTcxx . . $ `test/curve.c:73:9`!("get data points of piecewise curve");
496 curve_points = stp_curve_get_data_pointscxx . . $ stp_curve_get_data_points(58883ef28f2b1600).(curve1, &count);
497 if (curve_points)
498 {
499 int bad_compare = 0;
500 TEST_PASScxx . . $ TEST_PASS(49f6e7a06ebc5aa8).();
501 TESTcxx . . $ `test/curve.c:73:9`!("Checking count of curve points");
502 if (count == expected)
503 TEST_PASScxx . . $ TEST_PASS(49f6e7a06ebc5aa8).();
504 else
505 {
506 TEST_FAILcxx . . $ TEST_FAIL(49f6e7a06ebc5aa8).();
507 if (!quietcxx . . $ quiet.)
508 printfcxx . . $ printf(581fddd72a8db8fc).("Expected %zu points, got %lu\n", expected, count);
509 }
510 TESTcxx . . $ `test/curve.c:73:9`!("Comparing data");
511 for (i = 0; i < count; i++)
512 {
513 if (curve_points[i].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x. != standard_piecewise_sat_adjustmentcxx . . $ standard_piecewise_sat_adjustment.[i].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x. ||
514 curve_points[i].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y. - .0000001 > standard_piecewise_sat_adjustmentcxx . . $ standard_piecewise_sat_adjustment.[i].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y. ||
515 curve_points[i].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y. + .0000001 < standard_piecewise_sat_adjustmentcxx . . $ standard_piecewise_sat_adjustment.[i].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y.)
516 {
517 bad_compare = 1;
518 if (!quietcxx . . $ quiet.)
519 printfcxx . . $ printf(581fddd72a8db8fc).("Miscompare at element %zu: (%f, %f) (%f, %f)\n", i,
520 standard_piecewise_sat_adjustmentcxx . . $ standard_piecewise_sat_adjustment.[i].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x.,
521 standard_piecewise_sat_adjustmentcxx . . $ standard_piecewise_sat_adjustment.[i].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y.,
522 curve_points[i].xcxx . . $ $anonymous_type_efb3b6c928d15d2f_4#x., curve_points[i].ycxx . . $ $anonymous_type_efb3b6c928d15d2f_4#y.);
523 }
524 }
525 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(!bad_compare);
526 }
527 else
528 TEST_FAILcxx . . $ TEST_FAIL(49f6e7a06ebc5aa8).();
529
530 TESTcxx . . $ `test/curve.c:73:9`!("get sequence of piecewise curve (PASS is an expected failure)");
531 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(!stp_curve_get_sequence(curve1));
532
533 TESTcxx . . $ `test/curve.c:73:9`!("get data of piecewise curve (PASS is an expected failure)");
534 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(!stp_curve_get_data(curve1, &count));
535
536 TESTcxx . . $ `test/curve.c:73:9`!("set data point of piecewise curve (PASS is an expected failure)");
537 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(!stp_curve_set_point(curve1, 2, 1.0));
538
539 TESTcxx . . $ `test/curve.c:73:9`!("get data point of piecewise curve (PASS is an expected failure)");
540 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(!stp_curve_get_point(curve1, 2, &low));
541
542 TESTcxx . . $ `test/curve.c:73:9`!("interpolate piecewise curve (PASS is an expected failure)");
543 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(!stp_curve_interpolate_value(curve1, .5, &low));
544
545 TESTcxx . . $ `test/curve.c:73:9`!("rescale piecewise curve");
546 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_rescale(curve1, .5, STP_CURVE_COMPOSE_ADD,
547 STP_CURVE_BOUNDS_RESCALE));
548
549 TESTcxx . . $ `test/curve.c:73:9`!("get float data of piecewise curve (PASS is an expected failure)");
550 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(!stp_curve_get_float_data(curve1, &count));
551
552 TESTcxx . . $ `test/curve.c:73:9`!("get subrange on piecewise curve (PASS is an expected failure)");
553 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(!(curve2 = stp_curve_get_subrange(curve1, 0, 2)));
554 if (!quietcxx . . $ quiet. && curve2)
555 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve2);
556
557 TESTcxx . . $ `test/curve.c:73:9`!("set subrange on piecewise curve (PASS is an expected failure)");
558 curve2 = stp_curve_create_from_stringcxx . . $ stp_curve_create_from_string(fc1a54117bc5f637).(linear_curve_2cxx . . $ linear_curve_2.);
559 if (stp_curve_set_subrangecxx . . $ stp_curve_set_subrange(e3bf18be9622e1b).(curve1, curve2, 1))
560 {
561 TEST_FAILcxx . . $ TEST_FAIL(49f6e7a06ebc5aa8).();
562 if (!quietcxx . . $ quiet.)
563 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve2);
564 }
565 else
566 TEST_PASScxx . . $ TEST_PASS(49f6e7a06ebc5aa8).();
567 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve2);
568
569 if (resample_points > 0)
570 {
571 char tmpbuf[64];
572 sprintfcxx . . $ sprintf(26c8642d26409d6d).(tmpbuf, "resample piecewise curve to %d points", resample_points);
573 TESTcxx . . $ `test/curve.c:73:9`!(tmpbuf);
574 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_resample(curve1, resample_points));
575
576 TESTcxx . . $ `test/curve.c:73:9`!("resampled curve is not piecewise");
577 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(!stp_curve_is_piecewise(curve1));
578
579 TESTcxx . . $ `test/curve.c:73:9`!("get data points of piecewise copy (PASS is an expected failure)");
580 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(!stp_curve_get_data_points(curve1, &count));
581
582 TESTcxx . . $ `test/curve.c:73:9`!("get sequence of piecewise copy");
583 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_get_sequence(curve1));
584
585 TESTcxx . . $ `test/curve.c:73:9`!("get data of piecewise copy");
586 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_get_data(curve1, &count));
587
588 TESTcxx . . $ `test/curve.c:73:9`!("set data point of piecewise copy");
589 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_set_point(curve1, 2, 0.51));
590
591 TESTcxx . . $ `test/curve.c:73:9`!("get data point of piecewise copy");
592 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_get_point(curve1, 2, &low));
593
594 TESTcxx . . $ `test/curve.c:73:9`!("interpolate piecewise copy");
595 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_interpolate_value(curve1, .5, &low));
596
597 TESTcxx . . $ `test/curve.c:73:9`!("rescale piecewise copy");
598 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_rescale(curve1, 2,
599 STP_CURVE_COMPOSE_MULTIPLY,
600 STP_CURVE_BOUNDS_RESCALE));
601
602 TESTcxx . . $ `test/curve.c:73:9`!("get float data of piecewise copy");
603 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_get_float_data(curve1, &count));
604
605 TESTcxx . . $ `test/curve.c:73:9`!("get subrange on piecewise copy");
606 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!((curve2 = stp_curve_get_subrange(curve1, 0, 2)));
607 if (verbosecxx . . $ verbose. && curve2)
608 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve2);
609 if (curve2)
610 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve2);
611
612 if (resample_points > 10)
613 {
614 TESTcxx . . $ `test/curve.c:73:9`!("set subrange on piecewise copy");
615 curve2 = stp_curve_create_from_stringcxx . . $ stp_curve_create_from_string(fc1a54117bc5f637).(linear_curve_2cxx . . $ linear_curve_2.);
616 if (verbosecxx . . $ verbose.)
617 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve1);
618 if (stp_curve_set_subrangecxx . . $ stp_curve_set_subrange(e3bf18be9622e1b).(curve1, curve2, 4))
619 {
620 TEST_PASScxx . . $ TEST_PASS(49f6e7a06ebc5aa8).();
621 if (verbosecxx . . $ verbose.)
622 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve1);
623 }
624 else
625 TEST_FAILcxx . . $ TEST_FAIL(49f6e7a06ebc5aa8).();
626 if (curve2)
627 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve2);
628 }
629 }
630 }
631
632 int
633 maincxx . . $ main(afcd3168fc1188a4).(int argc, char **argv)
634 {
635 char *tmp;
636 int i;
637 size_t count;
638 double low, high;
639
640 stp_curve_tcxx . . $ stp_curve_t# *curve1;
641 stp_curve_tcxx . . $ stp_curve_t# *curve2;
642 stp_curve_tcxx . . $ stp_curve_t# *curve3;
643 const stp_curve_point_tcxx . . $ stp_curve_point_t# *curve_points;
644
645 while (1)
646 {
647 #ifdef __GNU_LIBRARY__cxx . . $ `<external>/18206667465210621810/features.h:510:9`!
648 int option_index = 0;
649 int c = getopt_longcxx . . $ getopt_long(41f665c090816971).(argc, argv, "qv", optlistcxx . . $ optlist., &option_index);
650 #else
651 int c = getopt(argc, argv, "qv");
652 #endif
653 if (c == -1)
654 break;
655 switch (c)
656 {
657 case 'q':
658 quietcxx . . $ quiet. = 1;
659 verbosecxx . . $ verbose. = 0;
660 break;
661 case 'v':
662 quietcxx . . $ quiet. = 0;
663 verbosecxx . . $ verbose. = 1;
664 break;
665 default:
666 break;
667 }
668 }
669 stp_initcxx . . $ stp_init(b126dc7c1de90089).();
670
671 TESTcxx . . $ `test/curve.c:73:9`!("creation of XML string from curve");
672 curve1 = stp_curve_createcxx . . $ stp_curve_create(37ed35325dc8f7a1).(STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.);
673 stp_curve_set_boundscxx . . $ stp_curve_set_bounds(758f5ad7a073d1f3).(curve1, 0.0, 4.0);
674 stp_curve_set_datacxx . . $ stp_curve_set_data(b7b412adf12354dc).(curve1, 48, reverse_sat_adjustmentcxx . . $ reverse_sat_adjustment.);
675 tmp = stp_curve_write_stringcxx . . $ stp_curve_write_string(757823e9e3a329cf).(curve1);
676 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve1);
677 curve1 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
678 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(tmp);
679 if (verbosecxx . . $ verbose.)
680 printfcxx . . $ printf(581fddd72a8db8fc).("%s\n", tmp);
681
682
683 TESTcxx . . $ `test/curve.c:73:9`!("creation of curve from XML string (stp_curve_create_from_string)");
684 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!((curve2 = stp_curve_create_from_string(tmp)));
685 freecxx . . $ free(5d22bdacc48458e8).(tmp);
686
687 TESTcxx . . $ `test/curve.c:73:9`!("stp_curve_resample");
688 if (curve2 != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`! && stp_curve_resamplecxx . . $ stp_curve_resample(bc87752a72bd695e).(curve2, 95) == 0)
689 {
690 TEST_FAILcxx . . $ TEST_FAIL(49f6e7a06ebc5aa8).();
691 }
692 else
693 {
694 TEST_PASScxx . . $ TEST_PASS(49f6e7a06ebc5aa8).();
695 if (verbosecxx . . $ verbose.)
696 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve2);
697 }
698 if (curve2)
699 {
700 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve2);
701 curve2 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
702 }
703
704 if (!quietcxx . . $ quiet.)
705 printfcxx . . $ printf(581fddd72a8db8fc).("Testing known bad curves... (expect messages)\n");
706 for (i = 0; i < bad_curve_countcxx . . $ bad_curve_count.; i++)
707 {
708 stp_curve_tcxx . . $ stp_curve_t# *bad = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
709 TESTcxx . . $ `test/curve.c:73:9`!("BAD curve (PASS is an expected failure)");
710 if ((bad = stp_curve_create_from_stringcxx . . $ stp_curve_create_from_string(fc1a54117bc5f637).(bad_curvescxx . . $ bad_curves.[i])) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
711 {
712 TEST_FAILcxx . . $ TEST_FAIL(49f6e7a06ebc5aa8).();
713 if (!quietcxx . . $ quiet.)
714 {
715 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, bad);
716 printfcxx . . $ printf(581fddd72a8db8fc).("\n");
717 }
718 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(bad);
719 bad = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
720 }
721 else
722 TEST_PASScxx . . $ TEST_PASS(49f6e7a06ebc5aa8).();
723 }
724
725 if (!quietcxx . . $ quiet.)
726 printfcxx . . $ printf(581fddd72a8db8fc).("Testing known good curves...\n");
727 for (i = 0; i < good_curve_countcxx . . $ good_curve_count.; i++)
728 {
729 if (curve2)
730 {
731 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve2);
732 curve2 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
733 }
734 TESTcxx . . $ `test/curve.c:73:9`!("GOOD curve");
735 if ((curve2 = stp_curve_create_from_stringcxx . . $ stp_curve_create_from_string(fc1a54117bc5f637).(good_curvescxx . . $ good_curves.[i])) != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
736 {
737 TEST_PASScxx . . $ TEST_PASS(49f6e7a06ebc5aa8).();
738 tmp = stp_curve_write_stringcxx . . $ stp_curve_write_string(757823e9e3a329cf).(curve2);
739 TESTcxx . . $ `test/curve.c:73:9`!("whether XML curve is identical to original");
740 if (tmp && strcmpcxx . . $ strcmp(5ae29d726ae57f88).((const char *) tmp, good_curvescxx . . $ good_curves.[i]))
741 {
742 TEST_FAILcxx . . $ TEST_FAIL(49f6e7a06ebc5aa8).();
743 if (!quietcxx . . $ quiet.)
744 {
745 printfcxx . . $ printf(581fddd72a8db8fc).("XML:\n");
746 printfcxx . . $ printf(581fddd72a8db8fc).("%s", tmp);
747 printfcxx . . $ printf(581fddd72a8db8fc).("Original:\n");
748 printfcxx . . $ printf(581fddd72a8db8fc).("%s", good_curvescxx . . $ good_curves.[i]);
749 printfcxx . . $ printf(581fddd72a8db8fc).("End:\n");
750 }
751 }
752 else
753 {
754 TEST_PASScxx . . $ TEST_PASS(49f6e7a06ebc5aa8).();
755 if (verbosecxx . . $ verbose.)
756 printfcxx . . $ printf(581fddd72a8db8fc).("%s", tmp);
757 }
758 freecxx . . $ free(5d22bdacc48458e8).(tmp);
759 }
760 else
761 TEST_FAILcxx . . $ TEST_FAIL(49f6e7a06ebc5aa8).();
762 }
763 if (curve2)
764 {
765 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve2);
766 curve2 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
767 }
768 if (verbosecxx . . $ verbose.)
769 printfcxx . . $ printf(581fddd72a8db8fc).("Allocate 1\n");
770 curve1 = stp_curve_createcxx . . $ stp_curve_create(37ed35325dc8f7a1).(STP_CURVE_WRAP_NONEcxx . . $ STP_CURVE_WRAP_NONE.);
771 if (verbosecxx . . $ verbose.)
772 printfcxx . . $ printf(581fddd72a8db8fc).("Allocate 2\n");
773 curve2 = stp_curve_createcxx . . $ stp_curve_create(37ed35325dc8f7a1).(STP_CURVE_WRAP_NONEcxx . . $ STP_CURVE_WRAP_NONE.);
774 TESTcxx . . $ `test/curve.c:73:9`!("set curve 1 gamma");
775 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_set_gamma(curve1, 1.2));
776 if (verbosecxx . . $ verbose.)
777 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve1);
778 TESTcxx . . $ `test/curve.c:73:9`!("set curve 2 gamma");
779 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_set_gamma(curve2, -1.2));
780 if (verbosecxx . . $ verbose.)
781 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve2);
782
783 TESTcxx . . $ `test/curve.c:73:9`!("compose add from gamma curves");
784 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_compose(&curve3, curve1, curve2,
785 STP_CURVE_COMPOSE_ADD, 64));
786 if (verbosecxx . . $ verbose. && curve3)
787 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve3);
788
789 TESTcxx . . $ `test/curve.c:73:9`!("resample curve 1");
790 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_resample(curve1, 64));
791 if (verbosecxx . . $ verbose. && curve1)
792 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve1);
793 if (curve3)
794 {
795 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve3);
796 curve3 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
797 }
798 TESTcxx . . $ `test/curve.c:73:9`!("compose multiply from gamma curves");
799 if (!stp_curve_composecxx . . $ stp_curve_compose(116ca8de2bc26c87).(&curve3, curve1, curve2, STP_CURVE_COMPOSE_MULTIPLYcxx . . $ STP_CURVE_COMPOSE_MULTIPLY., 64))
800 TEST_FAILcxx . . $ TEST_FAIL(49f6e7a06ebc5aa8).();
801 else
802 {
803 TEST_PASScxx . . $ TEST_PASS(49f6e7a06ebc5aa8).();
804 if (verbosecxx . . $ verbose.)
805 {
806 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve1);
807 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve2);
808 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve3);
809 }
810 }
811
812 TESTcxx . . $ `test/curve.c:73:9`!("compose add from non-gamma curves");
813 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve1);
814 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve2);
815 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve3);
816 curve1 = stp_curve_create_from_stringcxx . . $ stp_curve_create_from_string(fc1a54117bc5f637).(good_curvescxx . . $ good_curves.[0]);
817 curve2 = stp_curve_create_from_stringcxx . . $ stp_curve_create_from_string(fc1a54117bc5f637).(linear_curve_2cxx . . $ linear_curve_2.);
818 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_compose(&curve3, curve1, curve2,
819 STP_CURVE_COMPOSE_ADD, 64));
820 if (verbosecxx . . $ verbose. && curve3)
821 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve3);
822
823 TESTcxx . . $ `test/curve.c:73:9`!("resample curve 1");
824 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_resample(curve1, 64));
825 if (verbosecxx . . $ verbose. && curve1)
826 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve1);
827 if (curve3)
828 {
829 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve3);
830 curve3 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
831 }
832 TESTcxx . . $ `test/curve.c:73:9`!("compose multiply from non-gamma curves");
833 if (!stp_curve_composecxx . . $ stp_curve_compose(116ca8de2bc26c87).(&curve3, curve1, curve2, STP_CURVE_COMPOSE_MULTIPLYcxx . . $ STP_CURVE_COMPOSE_MULTIPLY., 64))
834 TEST_FAILcxx . . $ TEST_FAIL(49f6e7a06ebc5aa8).();
835 else
836 {
837 TEST_PASScxx . . $ TEST_PASS(49f6e7a06ebc5aa8).();
838 if (verbosecxx . . $ verbose.)
839 {
840 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve1);
841 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve2);
842 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve3);
843 }
844 }
845 if (curve3)
846 {
847 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve3);
848 curve3 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
849 }
850
851 TESTcxx . . $ `test/curve.c:73:9`!("multiply rescale");
852 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_rescale(curve2, -1, STP_CURVE_COMPOSE_MULTIPLY,
853 STP_CURVE_BOUNDS_RESCALE));
854 if (verbosecxx . . $ verbose. && curve2)
855 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve2);
856 TESTcxx . . $ `test/curve.c:73:9`!("subtract compose");
857 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_compose(&curve3, curve1, curve2,
858 STP_CURVE_COMPOSE_ADD, 64));
859 if (verbosecxx . . $ verbose. && curve3)
860 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve3);
861
862 if (curve3)
863 {
864 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve3);
865 curve3 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
866 }
867 if (curve1)
868 {
869 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve1);
870 curve1 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
871 }
872 if (curve2)
873 {
874 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve2);
875 curve2 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
876 }
877
878 TESTcxx . . $ `test/curve.c:73:9`!("spline curve 1 creation");
879 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!((curve1 = stp_curve_create_from_string(spline_curve_1)));
880 TESTcxx . . $ `test/curve.c:73:9`!("spline curve 2 creation");
881 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!((curve2 = stp_curve_create_from_string(spline_curve_2)));
882 if (curve1)
883 {
884 if (verbosecxx . . $ verbose.)
885 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve1);
886 TESTcxx . . $ `test/curve.c:73:9`!("spline curve 1 resample 1");
887 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_resample(curve1, 41));
888 if (verbosecxx . . $ verbose. && curve1)
889 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve1);
890 TESTcxx . . $ `test/curve.c:73:9`!("spline curve 1 resample 2");
891 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_resample(curve1, 83));
892 if (verbosecxx . . $ verbose. && curve1)
893 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve1);
894 }
895 if (curve2)
896 {
897 if (verbosecxx . . $ verbose.)
898 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve2);
899 TESTcxx . . $ `test/curve.c:73:9`!("spline curve 2 resample");
900 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_resample(curve2, 48));
901 if (verbosecxx . . $ verbose. && curve2)
902 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve2);
903 }
904 TESTcxx . . $ `test/curve.c:73:9`!("compose add (PASS is an expected failure)");
905 if (curve1 && curve2 &&
906 stp_curve_composecxx . . $ stp_curve_compose(116ca8de2bc26c87).(&curve3, curve1, curve2, STP_CURVE_COMPOSE_MULTIPLYcxx . . $ STP_CURVE_COMPOSE_MULTIPLY., -1))
907 {
908 TEST_FAILcxx . . $ TEST_FAIL(49f6e7a06ebc5aa8).();
909 if (!quietcxx . . $ quiet.)
910 printfcxx . . $ printf(581fddd72a8db8fc).("compose with different wrap mode should fail!\n");
911 }
912 else
913 TEST_PASScxx . . $ TEST_PASS(49f6e7a06ebc5aa8).();
914 if (curve1)
915 {
916 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve1);
917 curve1 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
918 }
919 if (curve2)
920 {
921 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve2);
922 curve2 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
923 }
924
925 TESTcxx . . $ `test/curve.c:73:9`!("linear curve 1 creation");
926 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!((curve1 = stp_curve_create_from_string(linear_curve_1)));
927 TESTcxx . . $ `test/curve.c:73:9`!("linear curve 2 creation");
928 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!((curve2 = stp_curve_create_from_string(linear_curve_2)));
929
930 TESTcxx . . $ `test/curve.c:73:9`!("get data points of dense curve (PASS is an expected failure)");
931 curve_points = stp_curve_get_data_pointscxx . . $ stp_curve_get_data_points(58883ef28f2b1600).(curve2, &count);
932 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(!curve_points);
933
934 if (curve1)
935 {
936 if (verbosecxx . . $ verbose.)
937 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve1);
938 TESTcxx . . $ `test/curve.c:73:9`!("linear curve 1 resample");
939 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_resample(curve1, 41));
940 if (verbosecxx . . $ verbose. && curve1)
941 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve1);
942 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve1);
943 curve1 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
944 }
945 if (curve2)
946 {
947 if (verbosecxx . . $ verbose.)
948 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve2);
949 TESTcxx . . $ `test/curve.c:73:9`!("linear curve 2 resample");
950 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_resample(curve2, 48));
951 if (verbosecxx . . $ verbose. && curve2)
952 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve2);
953 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve2);
954 curve2 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
955 }
956
957 curve1 = stp_curve_createcxx . . $ stp_curve_create(37ed35325dc8f7a1).(STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.);
958 stp_curve_set_interpolation_typecxx . . $ stp_curve_set_interpolation_type(43c66d7f6033514f).(curve1, STP_CURVE_TYPE_SPLINEcxx . . $ STP_CURVE_TYPE_SPLINE.);
959 stp_curve_set_boundscxx . . $ stp_curve_set_bounds(758f5ad7a073d1f3).(curve1, 0.0, 4.0);
960 stp_curve_set_datacxx . . $ stp_curve_set_data(b7b412adf12354dc).(curve1, 48, standard_sat_adjustmentcxx . . $ standard_sat_adjustment.);
961 TESTcxx . . $ `test/curve.c:73:9`!("setting curve data");
962 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(curve1 && (stp_curve_count_points(curve1) == 48));
963 if (verbosecxx . . $ verbose.)
964 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve1);
965 TESTcxx . . $ `test/curve.c:73:9`!("curve resample");
966 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_resample(curve1, 384));
967 if (verbosecxx . . $ verbose.)
968 stp_curve_writecxx . . $ stp_curve_write(963948d587b55a3d).(stdoutcxx . . $ `<external>/232824719582829767/stdio.h:154:9`!, curve1);
969 TESTcxx . . $ `test/curve.c:73:9`!("very large curve resample");
970 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_resample(curve1, 65535));
971 TESTcxx . . $ `test/curve.c:73:9`!("offsetting large curve");
972 #if 0
973 stp_curve_get_range(curve1, &low, &high);
974 fprintf(stderr, "Result original max %f min %f\n", high, low);
975 stp_curve_get_bounds(curve1, &low, &high);
976 fprintf(stderr, "Bounds original max %f min %f\n", high, low);
977 #endif
978 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_rescale(curve1, 2.0, STP_CURVE_COMPOSE_ADD,
979 STP_CURVE_BOUNDS_RESCALE));
980
981 stp_curve_rescalecxx . . $ stp_curve_rescale(3a3738bc767b1327).(curve1, 1.0, STP_CURVE_COMPOSE_ADDcxx . . $ STP_CURVE_COMPOSE_ADD.,
982 STP_CURVE_BOUNDS_RESCALEcxx . . $ STP_CURVE_BOUNDS_RESCALE.);
983 stp_curve_get_boundscxx . . $ stp_curve_get_bounds(de70be28309e8730).(curve1, &low, &high);
984 stp_curve_rescalecxx . . $ stp_curve_rescale(3a3738bc767b1327).(curve1, 0.0, STP_CURVE_COMPOSE_ADDcxx . . $ STP_CURVE_COMPOSE_ADD.,
985 STP_CURVE_BOUNDS_RESCALEcxx . . $ STP_CURVE_BOUNDS_RESCALE.);
986 stp_curve_get_boundscxx . . $ stp_curve_get_bounds(de70be28309e8730).(curve1, &low, &high);
987 stp_curve_rescalecxx . . $ stp_curve_rescale(3a3738bc767b1327).(curve1, 0.0, STP_CURVE_COMPOSE_ADDcxx . . $ STP_CURVE_COMPOSE_ADD.,
988 STP_CURVE_BOUNDS_RESCALEcxx . . $ STP_CURVE_BOUNDS_RESCALE.);
989 stp_curve_get_boundscxx . . $ stp_curve_get_bounds(de70be28309e8730).(curve1, &low, &high);
990 stp_curve_rescalecxx . . $ stp_curve_rescale(3a3738bc767b1327).(curve1, 0.0, STP_CURVE_COMPOSE_ADDcxx . . $ STP_CURVE_COMPOSE_ADD.,
991 STP_CURVE_BOUNDS_RESCALEcxx . . $ STP_CURVE_BOUNDS_RESCALE.);
992 stp_curve_get_boundscxx . . $ stp_curve_get_bounds(de70be28309e8730).(curve1, &low, &high);
993 TESTcxx . . $ `test/curve.c:73:9`!("writing very large curve to string");
994 tmp = stp_curve_write_stringcxx . . $ stp_curve_write_string(757823e9e3a329cf).(curve1);
995 if (tmp == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!)
996 TEST_FAILcxx . . $ TEST_FAIL(49f6e7a06ebc5aa8).();
997 else
998 TEST_PASScxx . . $ TEST_PASS(49f6e7a06ebc5aa8).();
999 if (tmp)
1000 {
1001 TESTcxx . . $ `test/curve.c:73:9`!("reading back very large curve");
1002 curve2 = stp_curve_create_from_stringcxx . . $ stp_curve_create_from_string(fc1a54117bc5f637).(tmp);
1003 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_count_points(curve2) == 65535);
1004
1005 freecxx . . $ free(5d22bdacc48458e8).(tmp);
1006 TESTcxx . . $ `test/curve.c:73:9`!("Rescaling readback");
1007 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_rescale(curve2, -1.0,
1008 STP_CURVE_COMPOSE_MULTIPLY,
1009 STP_CURVE_BOUNDS_RESCALE));
1010 TESTcxx . . $ `test/curve.c:73:9`!("Adding curves");
1011 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_compose(&curve3, curve1, curve2,
1012 STP_CURVE_COMPOSE_ADD, 65535));
1013
1014 stp_curve_get_rangecxx . . $ stp_curve_get_range(de70be28309e8730).(curve3, &low, &high);
1015 TESTcxx . . $ `test/curve.c:73:9`!("Comparing results");
1016 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(low < .00001 && low > -.00001 &&
1017 high < .00001 && high > -.00001);
1018
1019 if (curve1)
1020 {
1021 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve1);
1022 curve1 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1023 }
1024 if (curve2)
1025 {
1026 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve2);
1027 curve2 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1028 }
1029 }
1030
1031 TESTcxx . . $ `test/curve.c:73:9`!("Creating piecewise wrap-around curve");
1032 curve1 = stp_curve_createcxx . . $ stp_curve_create(37ed35325dc8f7a1).(STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.);
1033 stp_curve_set_boundscxx . . $ stp_curve_set_bounds(758f5ad7a073d1f3).(curve1, 0.0, 4.0);
1034
1035 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_set_data_points
1036 (curve1, 48, reverse_piecewise_sat_adjustment));
1037
1038 TESTcxx . . $ `test/curve.c:73:9`!("Writing piecewise wrap-around curve to string");
1039 tmp = stp_curve_write_stringcxx . . $ stp_curve_write_string(757823e9e3a329cf).(curve1);
1040 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(tmp);
1041 if (verbosecxx . . $ verbose.)
1042 printfcxx . . $ printf(581fddd72a8db8fc).("%s\n", tmp);
1043 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(tmp);
1044
1045 TESTcxx . . $ `test/curve.c:73:9`!("Check curve is piecewise");
1046 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_is_piecewise(curve1));
1047
1048 TESTcxx . . $ `test/curve.c:73:9`!("Create copy of piecewise curve");
1049 curve2 = stp_curve_create_copycxx . . $ stp_curve_create_copy(df54bc0b812d6ee).(curve1);
1050 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(curve2);
1051
1052 TESTcxx . . $ `test/curve.c:73:9`!("Check copy is piecewise");
1053 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_is_piecewise(curve2));
1054
1055 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve1, 0, 48);
1056 stp_curve_rescalecxx . . $ stp_curve_rescale(3a3738bc767b1327).(curve1, -.5, STP_CURVE_COMPOSE_ADDcxx . . $ STP_CURVE_COMPOSE_ADD.,
1057 STP_CURVE_BOUNDS_RESCALEcxx . . $ STP_CURVE_BOUNDS_RESCALE.);
1058 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 3, 48);
1059
1060 TESTcxx . . $ `test/curve.c:73:9`!("Copy in place piecewise curve");
1061 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1062 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(curve1 != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
1063 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 10, 48);
1064 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1065 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 15, 48);
1066 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1067 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 47, 48);
1068 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1069 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 48, 48);
1070 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1071 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 49, 48);
1072 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1073 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 50, 48);
1074 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1075 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 100, 48);
1076 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve1);
1077 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve2);
1078
1079 TESTcxx . . $ `test/curve.c:73:9`!("Creating piecewise no-wrap curve with not enough data (PASS is an expected failure)");
1080 curve1 = stp_curve_createcxx . . $ stp_curve_create(37ed35325dc8f7a1).(STP_CURVE_WRAP_NONEcxx . . $ STP_CURVE_WRAP_NONE.);
1081 stp_curve_set_boundscxx . . $ stp_curve_set_bounds(758f5ad7a073d1f3).(curve1, 0.0, 4.0);
1082 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(!stp_curve_set_data_points
1083 (curve1, 48, standard_piecewise_sat_adjustment));
1084
1085 TESTcxx . . $ `test/curve.c:73:9`!("Creating piecewise no-wrap curve correctly");
1086 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_set_data_points
1087 (curve1, 49, standard_piecewise_sat_adjustment));
1088
1089 TESTcxx . . $ `test/curve.c:73:9`!("Writing piecewise no-wrap curve to string");
1090 tmp = stp_curve_write_stringcxx . . $ stp_curve_write_string(757823e9e3a329cf).(curve1);
1091 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(tmp);
1092 if (verbosecxx . . $ verbose.)
1093 printfcxx . . $ printf(581fddd72a8db8fc).("%s\n", tmp);
1094 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(tmp);
1095
1096 TESTcxx . . $ `test/curve.c:73:9`!("Check curve is piecewise");
1097 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_is_piecewise(curve1));
1098
1099 TESTcxx . . $ `test/curve.c:73:9`!("Create copy of piecewise curve");
1100 curve2 = stp_curve_create_copycxx . . $ stp_curve_create_copy(df54bc0b812d6ee).(curve1);
1101 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(curve2);
1102 TESTcxx . . $ `test/curve.c:73:9`!("Check copy is piecewise");
1103 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_is_piecewise(curve2));
1104
1105 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve1, 0, 49);
1106 stp_curve_rescalecxx . . $ stp_curve_rescale(3a3738bc767b1327).(curve1, -.5, STP_CURVE_COMPOSE_ADDcxx . . $ STP_CURVE_COMPOSE_ADD.,
1107 STP_CURVE_BOUNDS_RESCALEcxx . . $ STP_CURVE_BOUNDS_RESCALE.);
1108 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 3, 49);
1109
1110 TESTcxx . . $ `test/curve.c:73:9`!("Copy in place piecewise curve");
1111 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1112 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(curve1 != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
1113 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 10, 49);
1114 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1115 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 15, 49);
1116 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1117 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 47, 49);
1118 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1119 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 48, 49);
1120 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1121 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 49, 49);
1122 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1123 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 50, 49);
1124 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1125 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 100, 49);
1126 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve2);
1127 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve1);
1128
1129 TESTcxx . . $ `test/curve.c:73:9`!("Creating piecewise spline wrap-around curve");
1130 curve1 = stp_curve_createcxx . . $ stp_curve_create(37ed35325dc8f7a1).(STP_CURVE_WRAP_AROUNDcxx . . $ STP_CURVE_WRAP_AROUND.);
1131 stp_curve_set_interpolation_typecxx . . $ stp_curve_set_interpolation_type(43c66d7f6033514f).(curve1, STP_CURVE_TYPE_SPLINEcxx . . $ STP_CURVE_TYPE_SPLINE.);
1132 stp_curve_set_boundscxx . . $ stp_curve_set_bounds(758f5ad7a073d1f3).(curve1, 0.0, 4.0);
1133
1134 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_set_data_points
1135 (curve1, 48, standard_piecewise_sat_adjustment));
1136
1137 TESTcxx . . $ `test/curve.c:73:9`!("Writing piecewise wrap-around curve to string");
1138 tmp = stp_curve_write_stringcxx . . $ stp_curve_write_string(757823e9e3a329cf).(curve1);
1139 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(tmp);
1140 if (verbosecxx . . $ verbose.)
1141 printfcxx . . $ printf(581fddd72a8db8fc).("%s\n", tmp);
1142 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(tmp);
1143
1144 TESTcxx . . $ `test/curve.c:73:9`!("Check curve is piecewise");
1145 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_is_piecewise(curve1));
1146
1147 TESTcxx . . $ `test/curve.c:73:9`!("Create copy of piecewise curve");
1148 curve2 = stp_curve_create_copycxx . . $ stp_curve_create_copy(df54bc0b812d6ee).(curve1);
1149 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(curve2);
1150 TESTcxx . . $ `test/curve.c:73:9`!("Check copy is piecewise");
1151 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_is_piecewise(curve2));
1152
1153 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve1, 0, 48);
1154 stp_curve_rescalecxx . . $ stp_curve_rescale(3a3738bc767b1327).(curve1, -.5, STP_CURVE_COMPOSE_ADDcxx . . $ STP_CURVE_COMPOSE_ADD.,
1155 STP_CURVE_BOUNDS_RESCALEcxx . . $ STP_CURVE_BOUNDS_RESCALE.);
1156 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 3, 48);
1157
1158 TESTcxx . . $ `test/curve.c:73:9`!("Copy in place piecewise curve");
1159 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1160 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(curve1 != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
1161 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 10, 48);
1162 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1163 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 15, 48);
1164 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1165 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 47, 48);
1166 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1167 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 48, 48);
1168 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1169 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 49, 48);
1170 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1171 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 50, 48);
1172 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1173 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 100, 48);
1174 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve1);
1175
1176 TESTcxx . . $ `test/curve.c:73:9`!("Creating piecewise spline wrap-around curve");
1177 curve1 = stp_curve_createcxx . . $ stp_curve_create(37ed35325dc8f7a1).(STP_CURVE_WRAP_NONEcxx . . $ STP_CURVE_WRAP_NONE.);
1178 stp_curve_set_interpolation_typecxx . . $ stp_curve_set_interpolation_type(43c66d7f6033514f).(curve1, STP_CURVE_TYPE_SPLINEcxx . . $ STP_CURVE_TYPE_SPLINE.);
1179 stp_curve_set_boundscxx . . $ stp_curve_set_bounds(758f5ad7a073d1f3).(curve1, 0.0, 4.0);
1180
1181 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_set_data_points
1182 (curve1, 49, standard_piecewise_sat_adjustment));
1183
1184 TESTcxx . . $ `test/curve.c:73:9`!("Writing piecewise no-wrap curve to string");
1185 tmp = stp_curve_write_stringcxx . . $ stp_curve_write_string(757823e9e3a329cf).(curve1);
1186 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(tmp);
1187 if (verbosecxx . . $ verbose.)
1188 printfcxx . . $ printf(581fddd72a8db8fc).("%s\n", tmp);
1189 stp_freecxx . . $ stp_free(5d22bdacc48458e8).(tmp);
1190
1191 TESTcxx . . $ `test/curve.c:73:9`!("Check curve is piecewise");
1192 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_is_piecewise(curve1));
1193
1194 if (curve2)
1195 {
1196 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve2);
1197 curve2 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1198 }
1199 TESTcxx . . $ `test/curve.c:73:9`!("Create copy of piecewise curve");
1200 curve2 = stp_curve_create_copycxx . . $ stp_curve_create_copy(df54bc0b812d6ee).(curve1);
1201 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(curve2);
1202 TESTcxx . . $ `test/curve.c:73:9`!("Check copy is piecewise");
1203 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(stp_curve_is_piecewise(curve2));
1204
1205 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve1, 0, 49);
1206 stp_curve_rescalecxx . . $ stp_curve_rescale(3a3738bc767b1327).(curve1, -.5, STP_CURVE_COMPOSE_ADDcxx . . $ STP_CURVE_COMPOSE_ADD.,
1207 STP_CURVE_BOUNDS_RESCALEcxx . . $ STP_CURVE_BOUNDS_RESCALE.);
1208 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 3, 49);
1209
1210 TESTcxx . . $ `test/curve.c:73:9`!("Copy in place piecewise curve");
1211 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1212 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(curve1 != NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!);
1213 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 10, 49);
1214 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1215 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 15, 49);
1216 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1217 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 47, 49);
1218 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1219 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 48, 49);
1220 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1221 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 49, 49);
1222 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1223 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 50, 49);
1224 stp_curve_copycxx . . $ stp_curve_copy(c5c12b2c5dad0880).(curve2, curve1);
1225 piecewise_curve_checkscxx . . $ piecewise_curve_checks(b4bd06ba36071752).(curve2, 100, 49);
1226 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve1);
1227
1228 TESTcxx . . $ `test/curve.c:73:9`!("Create small piecewise curve");
1229 curve1 = stp_curve_create_from_stringcxx . . $ stp_curve_create_from_string(fc1a54117bc5f637).(small_piecewise_curvecxx . . $ small_piecewise_curve.);
1230 SIMPLE_TEST_CHECKcxx . . $ `test/curve.c:108:9`!(curve1);
1231
1232 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve1);
1233 curve1 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1234 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve2);
1235 curve2 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1236 stp_curve_destroycxx . . $ stp_curve_destroy(357dc05c3c24eef1).(curve3);
1237 curve3 = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/15/include/stddef.h:419:9`!;
1238
1239 if (global_error_countcxx . . $ global_error_count.)
1240 {
1241 printfcxx . . $ printf(581fddd72a8db8fc).("%d/%d tests FAILED.\n", global_error_countcxx . . $ global_error_count., global_test_countcxx . . $ global_test_count.);
1242 printfcxx . . $ printf(581fddd72a8db8fc).("Failures:\n");
1243 while (test_failure_headcxx . . $ test_failure_head.)
1244 {
1245 printfcxx . . $ printf(581fddd72a8db8fc).(" %3d\n", test_failure_headcxx . . $ test_failure_head.->test_numbercxx . . $ test_failure#test_number.);
1246 test_failure_headcxx . . $ test_failure_head. = test_failure_headcxx . . $ test_failure_head.->nextcxx . . $ test_failure#next.;
1247 }
1248 }
1249 else
1250 printfcxx . . $ printf(581fddd72a8db8fc).("All %d tests passed successfully.\n", global_test_countcxx . . $ global_test_count.);
1251 return global_error_countcxx . . $ global_error_count. ? 1 : 0;
1252 }