1 : /*
2 : * This file is part of MIN Test Framework. Copyright © 2008 Nokia Corporation
3 : * and/or its subsidiary(-ies).
4 : * Contact: Marko Hyyppä
5 : * Contact e-mail: DG.MIN-Support@nokia.com
6 : *
7 : * This program is free software: you can redistribute it and/or modify it
8 : * under the terms of the GNU General Public License as published by the Free
9 : * Software Foundation, version 2 of the License.
10 : *
11 : * This program is distributed in the hope that it will be useful, but WITHOUT
12 : * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 : * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 : * more details. You should have received a copy of the GNU General Public
15 : * License along with this program. If not, see
16 : * <http://www.gnu.org/licenses/>.
17 : */
18 :
19 :
20 : /**
21 : * @file min_item_parser.tests
22 : * @version 0.1
23 : * @brief This file contains test for MIN Item Parser
24 : */
25 :
26 : /* ------------------------------------------------------------------------- */
27 : /* INCLUDES */
28 : #include <check.h>
29 : #include "min_common.h"
30 : #include "min_item_parser.h"
31 :
32 : /* ------------------------------------------------------------------------- */
33 : /* CONSTANTS */
34 : /* None */
35 :
36 : /* ------------------------------------------------------------------------- */
37 : /* MACROS */
38 :
39 : /** Define macros of implementation testing for print output enabling */
40 : /*
41 : #define CHECK_STRING_DEBUG_PRINTF_OUTPUT
42 : #define CHECK_INT_DEBUG_PRINTF_OUTPUT
43 : #define CHECK_UINT_DEBUG_PRINTF_OUTPUT
44 : #define CHECK_CHAR_DEBUG_PRINTF_OUTPUT
45 : #define CHECK_REMAINDER_DEBUG_PRINTF_OUTPUT
46 : */
47 : /* ------------------------------------------------------------------------- */
48 : /* DATA TYPES */
49 : /* None */
50 :
51 : /* ------------------------------------------------------------------------- */
52 : /* LOCAL FUNCTION PROTOTYPES */
53 : /* None */
54 :
55 : /* ------------------------------------------------------------------------- */
56 : /* FORWARD DECLARATIONS */
57 : /* None */
58 :
59 : /* ------------------------------------------------------------------------- */
60 : /* STRUCTURES */
61 : /* None */
62 :
63 : /* ------------------------------------------------------------------------- */
64 : /* ==================== LOCAL FUNCTIONS ==================================== */
65 : /* None */
66 :
67 : /* ------------------------------------------------------------------------- */
68 : /* ============================= TESTS ===================================== */
69 : /* ------------------------------------------------------------------------- */
70 1 : START_TEST(test_mip_create_ok)
71 : {
72 1 : MinItemParser* mip = INITPTR;
73 1 : TSChar section[] = "TEST SECTION";
74 1 : int start_pos = 0;
75 1 : int length = strlen( section );
76 1 : TSChar check_string[] = "TEST SECTION";
77 1 : int result = 0;
78 :
79 1 : mip = mip_create( section, start_pos, length );
80 1 : fail_unless( mip != INITPTR, "SIP creation failed." );
81 :
82 1 : result = strncmp( check_string, mip->item_line_section_,
83 : strlen( mip->item_line_section_ ) );
84 1 : fail_unless( result == 0,
85 : "SIP parsing result string incorrect." );
86 :
87 1 : mip_destroy( &mip );
88 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
89 : }
90 1 : END_TEST
91 : /* ------------------------------------------------------------------------- */
92 1 : START_TEST(test_mip_create_initptr)
93 : {
94 1 : MinItemParser* mip = INITPTR;
95 1 : TSChar* section = INITPTR;
96 1 : int start_pos = 0;
97 1 : int length = 4;
98 :
99 1 : mip = mip_create( section, start_pos, length );
100 1 : fail_unless( mip == INITPTR,
101 : "SIP creation with section INITPTR failed." );
102 :
103 1 : mip_destroy( &mip );
104 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
105 : }
106 1 : END_TEST
107 : /* ------------------------------------------------------------------------- */
108 1 : START_TEST(test_mip_create_null)
109 : {
110 1 : MinItemParser* mip = INITPTR;
111 1 : TSChar* section = NULL;
112 1 : int start_pos = 4;
113 1 : int length = 10;
114 :
115 1 : mip = mip_create( section, start_pos, length );
116 1 : fail_unless( mip == INITPTR,
117 : "SIP creation with section NULL failed." );
118 :
119 1 : mip_destroy( &mip );
120 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
121 : }
122 1 : END_TEST
123 : /* ------------------------------------------------------------------------- */
124 1 : START_TEST(test_mip_create_start_pos_negative)
125 : {
126 1 : MinItemParser* mip = INITPTR;
127 1 : TSChar section[] = "TEST SECTION";
128 1 : int start_pos = -1;
129 1 : int length = strlen( section );
130 :
131 1 : mip = mip_create( section, start_pos, length );
132 1 : fail_unless( mip == INITPTR,
133 : "SIP creation with negative start position failed." );
134 :
135 1 : mip_destroy( &mip );
136 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
137 : }
138 1 : END_TEST
139 : /* ------------------------------------------------------------------------- */
140 1 : START_TEST(test_mip_create_start_pos_over_length)
141 : {
142 1 : MinItemParser* mip = INITPTR;
143 1 : TSChar section[] = "TEST SECTION";
144 1 : int length = strlen( section );
145 1 : int start_pos = length + 1;
146 :
147 1 : mip = mip_create( section, start_pos, length );
148 1 : fail_unless( mip == INITPTR,
149 : "SIP creation with start position over length failed." );
150 :
151 1 : mip_destroy( &mip );
152 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
153 : }
154 1 : END_TEST
155 : /* ------------------------------------------------------------------------- */
156 1 : START_TEST(test_mip_create_length_negative)
157 : {
158 1 : MinItemParser* mip = INITPTR;
159 1 : TSChar section[] = "TEST SECTION";
160 1 : int start_pos = 0;
161 1 : int length = -1;
162 :
163 1 : mip = mip_create( section, start_pos, length );
164 1 : fail_unless( mip == INITPTR,
165 : "SIP creation with negative length failed." );
166 :
167 1 : mip_destroy( &mip );
168 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
169 : }
170 1 : END_TEST
171 : /* ------------------------------------------------------------------------- */
172 1 : START_TEST(test_mip_parse_start_and_end_pos_ok)
173 : {
174 1 : MinItemParser* mip = INITPTR;
175 1 : TSChar section[] = "COMMENTS1 TAG = KEYWORD2 KEYWORD3";
176 1 : int start_pos = 0;
177 1 : int length = strlen( section );
178 :
179 1 : TSChar start_tag[] = "TAG";
180 1 : TSChar* ref_start_pos = INITPTR;
181 1 : TSChar* ref_end_pos = INITPTR;
182 1 : int ref_length = 0;
183 1 : TSChar* ref_extra_end_pos = INITPTR;
184 1 : TSChar check_string[] = "KEYWORD2";
185 1 : int retval = 0;
186 1 : int result = 0;
187 :
188 1 : mip = mip_create( section, start_pos, length );
189 1 : fail_unless( mip != INITPTR,
190 : "SIP creation failed." );
191 :
192 1 : retval = mip_parse_start_and_end_pos( mip, start_tag,
193 : &ref_start_pos, &ref_end_pos, &ref_length,
194 : &ref_extra_end_pos );
195 1 : fail_unless( retval == 0,
196 : "SIP parsing start and end position failed." );
197 :
198 1 : result = strncmp( check_string, ref_start_pos, ref_length );
199 1 : fail_unless( result == 0,
200 : "SIP parsing result string incorrect." );
201 :
202 1 : mip_destroy( &mip );
203 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
204 : }
205 1 : END_TEST
206 : /* ------------------------------------------------------------------------- */
207 1 : START_TEST(test_mip_parse_start_and_end_pos_initptr)
208 : {
209 1 : MinItemParser* mip = INITPTR;
210 1 : TSChar start_tag[] = "TAG";
211 1 : TSChar* ref_start_pos = INITPTR;
212 1 : TSChar* ref_end_pos = INITPTR;
213 1 : int ref_length = 0;
214 1 : TSChar* ref_extra_end_pos = INITPTR;
215 1 : int retval = 0;
216 :
217 1 : retval = mip_parse_start_and_end_pos( mip, start_tag,
218 : &ref_start_pos, &ref_end_pos, &ref_length,
219 : &ref_extra_end_pos );
220 1 : fail_unless( retval == -1,
221 : "SIP parsing with mip INITPTR failed." );
222 :
223 1 : mip_destroy( &mip );
224 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
225 : }
226 1 : END_TEST
227 : /* ------------------------------------------------------------------------- */
228 1 : START_TEST(test_mip_parse_start_and_end_pos_only_tag)
229 : {
230 1 : MinItemParser* mip = INITPTR;
231 1 : TSChar section[] = " ONLY_TAG = ";
232 1 : int start_pos = 0;
233 1 : int length = strlen( section );
234 :
235 1 : TSChar start_tag[] = "ONLY_TAG";
236 1 : TSChar* ref_start_pos = INITPTR;
237 1 : TSChar* ref_end_pos = INITPTR;
238 1 : int ref_length = 0;
239 1 : TSChar* ref_extra_end_pos = INITPTR;
240 1 : int retval = 0;
241 :
242 1 : mip = mip_create( section, start_pos, length );
243 1 : fail_unless( mip != INITPTR,
244 : "SIP creation failed." );
245 :
246 1 : retval = mip_parse_start_and_end_pos( mip, start_tag,
247 : &ref_start_pos, &ref_end_pos, &ref_length,
248 : &ref_extra_end_pos );
249 1 : fail_unless( retval == -1,
250 : "SIP parsing with mip only tag failed." );
251 :
252 1 : mip_destroy( &mip );
253 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
254 : }
255 1 : END_TEST
256 : /* ------------------------------------------------------------------------- */
257 1 : START_TEST(test_mip_get_string)
258 : {
259 1 : MinItemParser* mip = INITPTR;
260 1 : TSChar section[] = "TAG1=EXAMPLE_STRING1 TAG2=EXAMPLE_STRING2 TAG3=EXAMPLE_STRING3";
261 1 : int start_pos = 0;
262 1 : int length = strlen( section );
263 :
264 1 : TSChar tag[] = "TAG2";
265 1 : TSChar* string = INITPTR;
266 1 : TSChar check_string[] = "EXAMPLE_STRING2";
267 1 : int retval = 0;
268 1 : int result = 0;
269 :
270 1 : mip = mip_create( section, start_pos, length );
271 1 : fail_unless( mip != INITPTR,
272 : "SIP creation failed." );
273 :
274 1 : retval = mip_get_string( mip, tag, &string );
275 1 : fail_unless( retval == 0,
276 : "SIP parsing operation failed." );
277 :
278 1 : result = strncmp( check_string, string, strlen( string ) );
279 1 : fail_unless( result == 0,
280 : "SIP get string failed." );
281 :
282 : #ifdef CHECK_STRING_DEBUG_PRINTF_OUTPUT
283 : printf("mip_get_string() string = %s\n", string);
284 : #endif
285 :
286 1 : if ( string != INITPTR ) DELETE( string );
287 :
288 1 : mip_destroy( &mip );
289 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
290 : }
291 1 : END_TEST
292 : /* ------------------------------------------------------------------------- */
293 1 : START_TEST(test_mip_get_string_initptr)
294 : {
295 1 : MinItemParser* mip = INITPTR;
296 1 : TSChar tag[] = "TAG";
297 1 : TSChar* string = INITPTR;
298 1 : int retval = 0;
299 :
300 1 : retval = mip_get_string( mip, tag, &string );
301 1 : fail_unless( retval == -1,
302 : "SIP get string INITPTR failed." );
303 :
304 1 : mip_destroy( &mip );
305 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
306 : }
307 1 : END_TEST
308 : /* ------------------------------------------------------------------------- */
309 1 : START_TEST(test_mip_get_string_length_zero)
310 : {
311 1 : MinItemParser* mip = INITPTR;
312 1 : TSChar section[] = " TAG= EXAMPLE_STRING ";
313 1 : int start_pos = 0;
314 1 : int length = strlen( section );
315 :
316 1 : TSChar tag[] = "TAG";
317 1 : TSChar* string = INITPTR;
318 1 : int retval = 0;
319 :
320 1 : mip = mip_create( section, start_pos, length );
321 1 : fail_unless( mip != INITPTR,
322 : "SIP creation failed." );
323 :
324 1 : *(mip->item_line_section_) = '\0';
325 :
326 1 : retval = mip_get_string( mip, tag, &string );
327 1 : fail_unless( retval == -1,
328 : "SIP get string with length zero failed." );
329 :
330 1 : mip_destroy( &mip );
331 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
332 : }
333 1 : END_TEST
334 : /* ------------------------------------------------------------------------- */
335 1 : START_TEST(test_mip_get_string_with_backlashes)
336 : {
337 1 : MinItemParser* mip = INITPTR;
338 1 : TSChar section[] = "TAG1 = \"EXAMPLE_STRING1\" TAG2 = \\\\EXAMPLE_STRING2";
339 1 : int start_pos = 0;
340 1 : int length = strlen( section );
341 :
342 1 : TSChar tag[] = "TAG2";
343 1 : TSChar* string = INITPTR;
344 1 : TSChar check_string[] = "EXAMPLE_STRING2";
345 1 : int retval = 0;
346 1 : int result = 0;
347 :
348 1 : mip = mip_create( section, start_pos, length );
349 1 : fail_unless( mip != INITPTR,
350 : "SIP creation failed." );
351 :
352 1 : retval = mip_get_string( mip, tag, &string );
353 1 : fail_unless( retval == 0,
354 : "SIP get string parsing failed." );
355 :
356 : #ifdef CHECK_STRING_DEBUG_PRINTF_OUTPUT
357 : printf("mip_get_string() string = %s\n", string);
358 : #endif
359 :
360 1 : result = strncmp( check_string, string, strlen( string ) );
361 1 : fail_unless( result == 0,
362 : "SIP get string by backslashes parsing failed." );
363 :
364 1 : if ( string != INITPTR ) DELETE( string );
365 :
366 1 : mip_destroy( &mip );
367 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
368 : }
369 1 : END_TEST
370 : /* ------------------------------------------------------------------------- */
371 1 : START_TEST(test_mip_get_string_with_backlashes_without_comments)
372 : {
373 1 : MinItemParser* mip = INITPTR;
374 1 : TSChar section[] = "TAG1 = \"EXAMPLE_STRING1\" TAG2 = \\\\ ";
375 1 : int start_pos = 0;
376 1 : int length = strlen( section );
377 :
378 1 : TSChar tag[] = "TAG2";
379 1 : TSChar* string = INITPTR;
380 1 : int retval = 0;
381 :
382 1 : mip = mip_create( section, start_pos, length );
383 1 : fail_unless( mip != INITPTR,
384 : "SIP creation failed." );
385 :
386 1 : retval = mip_get_string( mip, tag, &string );
387 1 : fail_unless( retval == -1,
388 : "SIP get string parsing without backslashes comments failed." );
389 :
390 1 : if ( string != INITPTR ) DELETE( string );
391 :
392 1 : mip_destroy( &mip );
393 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
394 : }
395 1 : END_TEST
396 : /* ------------------------------------------------------------------------- */
397 1 : START_TEST(test_mip_get_string_with_quotes)
398 : {
399 1 : MinItemParser* mip = INITPTR;
400 1 : TSChar section[] = "TAG1 = \"WORD1 WORD2 WORD3\" TAG2 = \"WORD4 WORD5 WORD6\" TAG3 = \"WORD7 WORD8 WORD9\"";
401 1 : int start_pos = 0;
402 1 : int length = strlen( section );
403 :
404 1 : TSChar tag[] = "TAG2";
405 1 : TSChar* string = INITPTR;
406 1 : TSChar check_string[] = "WORD4 WORD5 WORD6";
407 1 : int retval = 0;
408 1 : int result = 0;
409 :
410 1 : mip = mip_create( section, start_pos, length );
411 1 : fail_unless( mip != INITPTR,
412 : "SIP creation failed." );
413 :
414 1 : retval = mip_set_parsing_type( mip, EQuoteStyleParsing );
415 1 : fail_unless( retval == 0,
416 : "SIP set parsing type failed." );
417 :
418 1 : retval = mip_get_string( mip, tag, &string );
419 1 : fail_unless( retval == 0,
420 : "SIP get string parsing failed." );
421 :
422 1 : result = strncmp( check_string, string, strlen( check_string ) );
423 1 : fail_unless( result == 0,
424 : "SIP get string by quates parsing failed." );
425 :
426 : #ifdef CHECK_STRING_DEBUG_PRINTF_OUTPUT
427 : printf("mip_get_string() string = %s\n", string);
428 : #endif
429 1 : if ( string != INITPTR ) DELETE( string );
430 :
431 1 : mip_destroy( &mip );
432 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
433 : }
434 1 : END_TEST
435 : /* ------------------------------------------------------------------------- */
436 1 : START_TEST(test_mip_get_string_with_first_quote)
437 : {
438 1 : MinItemParser* mip = INITPTR;
439 1 : TSChar section[] = "TAG1 = \"WORD1 WORD2 WORD3 QUICK_END";
440 1 : int start_pos = 0;
441 1 : int length = strlen( section );
442 :
443 1 : TSChar tag[] = "TAG1";
444 1 : TSChar* string = INITPTR;
445 1 : TSChar check_string[] = "WORD1 WORD2 WORD3 QUICK_END";
446 1 : int retval = 0;
447 1 : int result = 0;
448 :
449 1 : mip = mip_create( section, start_pos, length );
450 1 : fail_unless( mip != INITPTR,
451 : "SIP creation failed." );
452 :
453 1 : retval = mip_set_parsing_type( mip, EQuoteStyleParsing );
454 1 : fail_unless( retval == 0,
455 : "SIP set parsing type failed." );
456 :
457 1 : retval = mip_get_string( mip, tag, &string );
458 1 : fail_unless( retval == 0,
459 : "SIP get string parsing failed." );
460 :
461 : #ifdef CHECK_STRING_DEBUG_PRINTF_OUTPUT
462 : printf("mip_get_string() string = %s\n", string);
463 : printf("DEBUG: length = %d\n", strlen( string ) );
464 : #endif
465 :
466 1 : result = strncmp( check_string, string, strlen( string ) );
467 1 : fail_unless( result == 0,
468 : "SIP get string by first quote parsing failed." );
469 :
470 1 : if ( string != INITPTR ) DELETE( string );
471 :
472 1 : mip_destroy( &mip );
473 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
474 : }
475 1 : END_TEST
476 : /* ------------------------------------------------------------------------- */
477 1 : START_TEST(test_mip_get_next_string)
478 : {
479 1 : MinItemParser* mip = INITPTR;
480 1 : TSChar section[] = "TAG1 = EXAMPLE_STRING1 TAG2 = EXAMPLE_STRING2 \\\\ EXAMPLE_STRING3";
481 1 : int start_pos = 0;
482 1 : int length = strlen( section );
483 :
484 1 : TSChar tag[] = "TAG2";
485 : TSChar* string[2];
486 1 : int retval = 0;
487 :
488 1 : string[0] = INITPTR;
489 1 : string[1] = INITPTR;
490 :
491 1 : mip = mip_create( section, start_pos, length );
492 1 : fail_unless( mip != INITPTR,
493 : "SIP creation failed." );
494 :
495 1 : retval = mip_get_string( mip, tag, &string[0] );
496 1 : fail_unless( retval == 0,
497 : "SIP get string failed." );
498 :
499 : #ifdef CHECK_STRING_DEBUG_PRINTF_OUTPUT
500 : printf( "mip_get_string() string = %s\n", string[0] );
501 : #endif
502 1 : retval = mip_get_next_string( mip, &string[1] );
503 1 : fail_unless( retval == 0,
504 : "SIP get string failed." );
505 :
506 : #ifdef CHECK_STRING_DEBUG_PRINTF_OUTPUT
507 : printf( "mip_get_next_string() string:\n%s\n", string[1] );
508 : #endif
509 :
510 1 : if ( string[0] != INITPTR ) DELETE( string[0] );
511 1 : if ( string[1] != INITPTR ) DELETE( string[1] );
512 :
513 1 : mip_destroy( &mip );
514 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
515 : }
516 1 : END_TEST
517 : /* ------------------------------------------------------------------------- */
518 : void bug_hunting( void )
519 0 : {
520 : static MinItemParser* mip = INITPTR;
521 0 : char section[] = "title Example1\ncreate bar a\na jee 1 2 3 joo jee\ncreate foo b\nb juu 666 jup\nb jaa 5 7 9 0 aaa\ndelete a\ndelete b";
522 0 : int start_pos = 0;
523 0 : int length = strlen( section );
524 0 : int retval = 0;
525 :
526 0 : char* item = INITPTR;
527 0 : char* libname = INITPTR;
528 0 : char* classname = INITPTR;
529 0 : char* funcname = INITPTR;
530 :
531 0 : mip = mip_create( section, start_pos, length );
532 :
533 0 : mip_get_string( mip, "", &item );
534 :
535 0 : if ( strcmp(item,"title") == 0 ) {
536 0 : printf("=> title\n");
537 : }
538 :
539 0 : if (strcmp(item,"delete") == 0 ) {
540 0 : mip_get_next_string( mip, &classname );
541 0 : printf("=> delete %s\n",classname);
542 : }
543 :
544 0 : if (strcmp(item,"create") == 0 ) {
545 0 : mip_get_next_string( mip, &libname );
546 0 : mip_get_next_string( mip, &classname );
547 0 : printf("=> create %s %s\n",libname,classname);
548 : }
549 :
550 0 : mip_get_next_string( mip, &funcname );
551 0 : printf("item: %s funcname: %s\n", item, funcname);
552 0 : while(mip_get_next_string(mip,&funcname) == 0) printf("===> %s\n",funcname);
553 :
554 0 : mip_destroy( &mip );
555 0 : fail_unless( mip == INITPTR, "SIP destroying failed." );
556 0 : }
557 :
558 : /* ------------------------------------------------------------------------- */
559 0 : START_TEST(test_mip_get_next_string_bug_hunting)
560 : {
561 0 : bug_hunting();
562 : }
563 0 : END_TEST
564 : /* ------------------------------------------------------------------------- */
565 1 : START_TEST(test_mip_get_next_tagged_string)
566 : {
567 1 : MinItemParser* mip = INITPTR;
568 1 : TSChar section[] = "TAG = EXAMPLE_STRING1 EXAMPLE_STRING2 TAG = EXAMPLE_STRING3";
569 1 : int start_pos = 0;
570 1 : int length = strlen( section );
571 :
572 1 : TSChar tag[] = "TAG";
573 : TSChar* string[2];
574 1 : int retval = 0;
575 :
576 1 : string[0] = INITPTR;
577 1 : string[1] = INITPTR;
578 :
579 1 : mip = mip_create( section, start_pos, length );
580 1 : fail_unless( mip != INITPTR,
581 : "SIP creation failed." );
582 :
583 1 : retval = mip_get_string( mip, tag, &string[0] );
584 1 : fail_unless( retval == 0,
585 : "SIP get string failed." );
586 :
587 : #ifdef CHECK_STRING_DEBUG_PRINTF_OUTPUT
588 : printf( "mip_get_string() string = %s\n", string[0] );
589 : #endif
590 :
591 1 : retval = mip_get_next_tagged_string( mip, tag, &string[1] );
592 1 : fail_unless( retval == 0,
593 : "SIP get string failed." );
594 :
595 : #ifdef CHECK_STRING_DEBUG_PRINTF_OUTPUT
596 : printf( "mip_get_next_tagged_string() string:\n%s\n", string[1] );
597 : #endif
598 :
599 1 : if ( string[0] != INITPTR ) DELETE( string[0] );
600 1 : if ( string[1] != INITPTR ) DELETE( string[1] );
601 :
602 1 : mip_destroy( &mip );
603 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
604 : }
605 1 : END_TEST
606 : /* ------------------------------------------------------------------------- */
607 1 : START_TEST(test_mip_get_int)
608 : {
609 1 : MinItemParser* mip = INITPTR;
610 1 : TSChar section[] = "EXAMPLE_STRING2 TAG = 123 EXAMPLE_STRING3";
611 1 : int start_pos = 0;
612 1 : int length = strlen( section );
613 :
614 1 : TSChar tag[] = "TAG";
615 1 : int value = 0;
616 1 : int retval = 0;
617 :
618 1 : mip = mip_create( section, start_pos, length );
619 1 : fail_unless( mip != INITPTR,
620 : "SIP creation failed." );
621 :
622 1 : retval = mip_get_int( mip, tag, &value );
623 1 : fail_unless( retval == 0,
624 : "SIP get integer failed." );
625 :
626 : /* For testing...
627 : printf( "mip_get_int() value = %d\n", value );
628 : */
629 :
630 1 : mip_destroy( &mip );
631 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
632 : }
633 1 : END_TEST
634 : /* ------------------------------------------------------------------------- */
635 1 : START_TEST(test_mip_get_next_int)
636 : {
637 1 : MinItemParser* mip = INITPTR;
638 1 : TSChar section[] = "EXAMPLE_STRING2 TAG = 123 3456 ";
639 1 : int start_pos = 0;
640 1 : int length = strlen( section );
641 :
642 1 : TSChar tag[] = "TAG";
643 : int value[2];
644 : int retval;
645 :
646 1 : value[0] = 0;
647 1 : value[1] = 0;
648 :
649 1 : mip = mip_create( section, start_pos, length );
650 1 : fail_unless( mip != INITPTR,
651 : "SIP creation failed." );
652 :
653 1 : retval = mip_get_int( mip, tag, &value[0] );
654 1 : fail_unless( retval == 0,
655 : "SIP get integer failed." );
656 :
657 : #ifdef CHECK_INT_DEBUG_PRINTF_OUTPUT
658 : printf( "mip_get_int() value = %d\n", value[0] );
659 : #endif
660 :
661 1 : retval = mip_get_next_int( mip, &value[1] );
662 1 : fail_unless( retval == 0,
663 : "SIP get next integer failed." );
664 :
665 : #ifdef CHECK_INT_DEBUG_PRINTF_OUTPUT
666 : printf( "mip_get_next_int() value = %d\n", value[1] );
667 : #endif
668 :
669 1 : mip_destroy( &mip );
670 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
671 : }
672 1 : END_TEST
673 : /* ------------------------------------------------------------------------- */
674 1 : START_TEST(test_mip_get_next_tagged_int)
675 : {
676 1 : MinItemParser* mip = INITPTR;
677 1 : TSChar section[] = "EXAMPLE_STRING2 TAG = 123 3456 TEST TAG = 7890";
678 1 : int start_pos = 0;
679 1 : int length = strlen( section );
680 :
681 1 : TSChar tag[] = "TAG";
682 : int value[2];
683 : int retval;
684 :
685 1 : value[0] = 0;
686 1 : value[1] = 0;
687 :
688 1 : mip = mip_create( section, start_pos, length );
689 1 : fail_unless( mip != INITPTR,
690 : "SIP creation failed." );
691 :
692 1 : retval = mip_get_int( mip, tag, &value[0] );
693 1 : fail_unless( retval == 0,
694 : "SIP get integer failed." );
695 :
696 1 : retval = mip_get_next_tagged_int( mip, tag, &value[1] );
697 1 : fail_unless( retval == 0,
698 : "SIP get next tagged integer failed." );
699 :
700 : #ifdef CHECK_INT_DEBUG_PRINTF_OUTPUT
701 : printf( "mip_get_next_tagged_int() value = %d\n", value[1] );
702 : #endif
703 :
704 1 : mip_destroy( &mip );
705 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
706 : }
707 1 : END_TEST
708 : /* ------------------------------------------------------------------------- */
709 1 : START_TEST(test_mip_get_uint_functions)
710 : {
711 1 : MinItemParser* mip = INITPTR;
712 1 : TSChar section[] = "EXAMPLE_STRING2 TAG = 123 3456 TEST TAG = 7890";
713 1 : int start_pos = 0;
714 1 : int length = strlen( section );
715 :
716 1 : TSChar tag[] = "TAG";
717 : unsigned int value[3];
718 : int retval;
719 :
720 1 : value[0] = 0;
721 1 : value[1] = 0;
722 1 : value[2] = 0;
723 :
724 1 : mip = mip_create( section, start_pos, length );
725 1 : fail_unless( mip != INITPTR,
726 : "SIP creation failed." );
727 :
728 1 : retval = mip_get_uint( mip, tag, &value[0] );
729 1 : fail_unless( retval == 0,
730 : "SIP get unsigned integer failed." );
731 :
732 : #ifdef CHECK_UINT_DEBUG_PRINTF_OUTPUT
733 : printf( "mip_get_uint() value = %d\n", value[0] );
734 : #endif
735 :
736 1 : retval = mip_get_next_uint( mip, &value[1] );
737 1 : fail_unless( retval == 0,
738 : "SIP get next unsigned integer failed." );
739 :
740 : #ifdef CHECK_UINT_DEBUG_PRINTF_OUTPUT
741 : printf( "mip_get_next_uint() value = %d\n", value[1] );
742 : #endif
743 :
744 1 : retval = mip_get_next_tagged_uint( mip, tag, &value[2] );
745 1 : fail_unless( retval == 0,
746 : "SIP get next tagged unsigned integer failed." );
747 :
748 : #ifdef CHECK_UINT_DEBUG_PRINTF_OUTPUT
749 : printf( "mip_get_next_tagged_uint() value = %d\n", value[2] );
750 : #endif
751 :
752 1 : mip_destroy( &mip );
753 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
754 : }
755 1 : END_TEST
756 : /* ------------------------------------------------------------------------- */
757 1 : START_TEST(test_mip_get_char_functions)
758 : {
759 1 : MinItemParser* mip = INITPTR;
760 1 : TSChar section[] = " EXAMPLE_STRING1 TAG=ABC EXAMPLE_STRING2 TEST TAG=CDEF";
761 1 : int start_pos = 0;
762 1 : int length = strlen( section );
763 :
764 1 : TSChar tag[] = "TAG";
765 : TSChar chr[3];
766 : int retval;
767 :
768 1 : chr[0] = 0;
769 1 : chr[1] = 0;
770 1 : chr[2] = 0;
771 :
772 1 : mip = mip_create( section, start_pos, length );
773 1 : fail_unless( mip != INITPTR,
774 : "SIP creation failed." );
775 :
776 1 : retval = mip_get_char( mip, tag, chr[0] );
777 1 : fail_unless( retval == 0,
778 : "SIP get char failed." );
779 :
780 : #ifdef CHECK_CHAR_DEBUG_PRINTF_OUTPUT
781 : printf( "mip_get_char() chr = %c\n", chr[0] );
782 : #endif
783 :
784 1 : retval = mip_get_next_char( mip, chr[1] );
785 1 : fail_unless( retval == 0,
786 : "SIP get next char failed." );
787 :
788 : #ifdef CHECK_CHAR_DEBUG_PRINTF_OUTPUT
789 : printf( "mip_get_next_char() chr = %c\n", chr[1] );
790 : #endif
791 :
792 1 : retval = mip_get_next_tagged_char( mip, tag, chr[2] );
793 1 : fail_unless( retval == 0,
794 : "SIP get next tagged char failed." );
795 :
796 : #ifdef CHECK_CHAR_DEBUG_PRINTF_OUTPUT
797 : printf( "mip_get_next_tagged_char() chr = %c\n", chr[2] );
798 : #endif
799 :
800 1 : mip_destroy( &mip );
801 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
802 : }
803 1 : END_TEST
804 : /* ------------------------------------------------------------------------- */
805 1 : START_TEST(test_mip_get_remainder)
806 : {
807 1 : MinItemParser* mip = INITPTR;
808 1 : TSChar section[] = " EXAMPLE_STRING1 EXAMPLE_STRING2 ";
809 1 : int start_pos = 0;
810 1 : int length = strlen( section );
811 1 : TSChar* string = INITPTR;
812 1 : int retval = 0;
813 :
814 1 : mip = mip_create( section, start_pos, length );
815 1 : fail_unless( mip != INITPTR,
816 : "SIP creation failed." );
817 :
818 1 : mip->item_skip_and_mark_pos_ = mip->item_line_section_;
819 :
820 1 : retval = mip_get_remainder( mip, &string );
821 1 : fail_unless( retval == 0,
822 : "SIP get remainder failed." );
823 :
824 : #ifdef CHECK_REMAINDER_DEBUG_PRINTF_OUTPUT
825 : printf("mip_get_remainder = %s\n", string );
826 : #endif
827 :
828 1 : mip_destroy( &mip );
829 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
830 : }
831 1 : END_TEST
832 : /* ------------------------------------------------------------------------- */
833 1 : START_TEST(test_mip_set_parsing_type)
834 : {
835 1 : MinItemParser* mip = INITPTR;
836 1 : TSChar section[] = " TAG = EXAMPLE_STRING1 ";
837 1 : int start_pos = 0;
838 1 : int length = strlen( section );
839 1 : int retval = 0;
840 :
841 :
842 1 : retval = mip_set_parsing_type( INITPTR, EQuoteStyleParsing );
843 1 : fail_unless( retval == -1,
844 : "SIP set parsing type with mip INITPTR failed." );
845 :
846 1 : mip = mip_create( section, start_pos, length );
847 1 : fail_unless( mip != INITPTR,
848 : "SIP creation failed." );
849 :
850 1 : retval = mip_set_parsing_type( mip, EQuoteStyleParsing );
851 1 : fail_unless( retval == 0,
852 : "SIP set parsing type failed." );
853 :
854 1 : fail_unless( mip->parsing_type_ == EQuoteStyleParsing,
855 : "SIP set parsing type to Quete Style Parsing failed." );
856 :
857 1 : mip_destroy( &mip );
858 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
859 : }
860 1 : END_TEST
861 : /* ------------------------------------------------------------------------- */
862 1 : START_TEST(test_mip_get_parsing_type)
863 : {
864 1 : MinItemParser* mip = INITPTR;
865 1 : TSChar section[] = " TAG = EXAMPLE_STRING1 ";
866 1 : int start_pos = 0;
867 1 : int length = strlen( section );
868 1 : TParsingType type = ENormalParsing;
869 1 : int retval = 0;
870 :
871 1 : type = mip_get_parsing_type( INITPTR );
872 1 : fail_unless( type == -1,
873 : "SIP get parsing type with mip INITPTR failed." );
874 :
875 1 : mip = mip_create( section, start_pos, length );
876 1 : fail_unless( mip != INITPTR,
877 : "SIP creation failed." );
878 :
879 1 : retval = mip_set_parsing_type( mip, EQuoteStyleParsing );
880 1 : fail_unless( retval == 0,
881 : "SIP set parsing type failed." );
882 :
883 1 : type = mip_get_parsing_type( mip );
884 1 : fail_unless( type == EQuoteStyleParsing,
885 : "SIP get parsing test Quete Style Parsing value failed." );
886 :
887 1 : mip_destroy( &mip );
888 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
889 : }
890 1 : END_TEST
891 : /* ------------------------------------------------------------------------- */
892 0 : START_TEST(test_mip_get_next_string_end_bug)
893 : {
894 0 : MinItemParser* mip = INITPTR;
895 0 : TSChar section[] = "[Test]\ntitle testi1\ncreate jeesTestModule.so foo\nfoo Example with a lot of pa ra me ters 1 2 3 4 5 666\0delete foo\n[Endtest]";
896 :
897 : /* TAG1 = EXAMPLE_STRING1 TAG2 = EXAMPLE_STRING2 TAG3 = EXAMPLE_STRING3" */
898 0 : int start_pos = 0;
899 0 : int length = strlen( section );
900 :
901 0 : TSChar tag[] = "foo";
902 0 : TSChar* string = INITPTR;
903 0 : int retval = 0;
904 : int i;
905 :
906 0 : mip = mip_create( section, start_pos, length );
907 0 : fail_unless( mip != INITPTR,
908 : "SIP creation failed." );
909 :
910 0 : retval = mip_get_string( mip, tag, &string );
911 0 : fail_unless( retval == 0,
912 : "SIP get string failed." );
913 :
914 0 : while ( mip_get_next_string( mip, &string ) == 0 ) {
915 0 : printf("DEBUG%d: retval=%d string={%s}\n", i, retval, string);
916 : }
917 :
918 0 : if ( string != INITPTR ) DELETE( string );
919 :
920 0 : mip_destroy( &mip );
921 0 : fail_unless( mip == INITPTR, "SIP destroying failed." );
922 : }
923 0 : END_TEST
924 : /* ------------------------------------------------------------------------- */
925 :
926 0 : START_TEST(test_mip_get_string_with_quotes_end_bug)
927 : {
928 0 : MinItemParser* mip = INITPTR;
929 0 : TSChar section[] = "TAG1 = \"HELLO WORLD 1\" TAG2 = \"HELLO WORLD 2\" TAG3 = \"HELLO WORLD 3 ";
930 0 : int start_pos = 0;
931 0 : int length = strlen( section );
932 :
933 0 : TSChar* string = INITPTR;
934 0 : int retval = 0;
935 : int i;
936 :
937 0 : mip = mip_create( section, start_pos, length );
938 0 : fail_unless( mip != INITPTR,
939 : "SIP creation failed." );
940 :
941 0 : retval = mip_get_string( mip, "TAG1", &string );
942 0 : fail_unless( retval == 0, "SIP get string failed." );
943 :
944 0 : retval = mip_get_string( mip, "TAG2", &string );
945 0 : fail_unless( retval == 0, "SIP get string failed." );
946 :
947 0 : retval = mip_get_next_string( mip, &string );
948 0 : fail_unless( retval == 0, "SIP get string failed." );
949 :
950 0 : retval = mip_get_string( mip, "TAG3", &string );
951 0 : fail_unless( retval == 0, "SIP get string failed." );
952 :
953 0 : mip_destroy( &mip );
954 0 : fail_unless( mip == INITPTR, "SIP destroying failed." );
955 : }
956 0 : END_TEST
957 : /* ------------------------------------------------------------------------- */
958 1 : START_TEST(test_mip_get_next_tagged_string_bug_hunting)
959 : {
960 1 : MinItemParser* mip = INITPTR;
961 1 : TSChar section[] = "TEST TAG1 = \"EXAMPLE1 WORD1\" TAG2 = \"EXAMPLE2 STRING\" EXAMPLE WORD2";
962 1 : int start_pos = 0;
963 1 : int length = strlen( section );
964 :
965 1 : TSChar* string = INITPTR;
966 1 : int retval = 0;
967 :
968 1 : mip = mip_create( section, start_pos, length );
969 1 : fail_unless( mip != INITPTR, "SIP creation failed." );
970 :
971 : // mip_set_parsing_type( mip, ENormalParsing );
972 1 : mip_set_parsing_type( mip, EQuoteStyleParsing );
973 :
974 1 : retval = mip_get_string( mip, "TAG1", &string );
975 : // fail_unless( retval == 0, "SIP get string failed." );
976 :
977 1 : retval = mip_get_next_tagged_string( mip, "TAG2", &string );
978 : // fail_unless( retval == 0, "SIP get string failed." );
979 :
980 1 : if ( string != INITPTR ) DELETE( string );
981 :
982 1 : mip_destroy( &mip );
983 1 : fail_unless( mip == INITPTR, "SIP destroying failed." );
984 : }
985 1 : END_TEST
986 : /* ------------------------------------------------------------------------- */
987 1 : START_TEST(test_mip_replace1)
988 : {
989 1 : int retval = mip_replace(INITPTR,"ala","makota");
990 1 : fail_unless(retval==-1,"Result differs from expected: %d",retval);
991 : }
992 1 : END_TEST
993 : /* ------------------------------------------------------------------------- */
994 1 : START_TEST(test_mip_replace2)
995 : {
996 1 : int foo = 5;
997 1 : int retval = mip_replace(&foo,INITPTR,"makota");
998 1 : fail_unless(retval==-1,"Result differs from expected: %d",retval);
999 : }
1000 1 : END_TEST
1001 : /* ------------------------------------------------------------------------- */
1002 1 : START_TEST(test_mip_replace3)
1003 : {
1004 1 : int foo = 5;
1005 1 : int retval = mip_replace(&foo,"ala",INITPTR);
1006 1 : fail_unless(retval==-1,"Result differs from expected: %d",retval);
1007 : }
1008 1 : END_TEST
1009 : /* ------------------------------------------------------------------------- */
1010 1 : START_TEST(test_mip_replace4)
1011 : {
1012 1 : MinItemParser* mip = INITPTR;
1013 1 : TSChar section[] = "create BAZ foo";
1014 1 : int start_pos = 0;
1015 1 : int length = strlen( section );
1016 1 : int retval = 0;
1017 :
1018 1 : mip = mip_create( section, start_pos, length );
1019 1 : retval = mip_replace( mip, "WWW", "FOO" );
1020 1 : fail_unless(retval==0,"Result differ from expected %d",retval);
1021 : }
1022 1 : END_TEST
1023 : /* ------------------------------------------------------------------------- */
1024 1 : START_TEST(test_mip_replace5)
1025 : {
1026 1 : MinItemParser* mip = INITPTR;
1027 1 : TSChar section[] = "create BAZ foo";
1028 1 : int start_pos = 0;
1029 1 : int length = strlen( section );
1030 1 : int retval = 0;
1031 :
1032 1 : mip = mip_create( section, start_pos, length );
1033 1 : retval = mip_replace( mip, "WWW", "FOO" );
1034 1 : fail_unless( strcmp(mip->item_line_section_,section)==0
1035 : , "Result differs from expected [%s]!=[%s]"
1036 : , mip->item_line_section_,section);
1037 : }
1038 1 : END_TEST
1039 : /* ------------------------------------------------------------------------- */
1040 1 : START_TEST(test_mip_replace6)
1041 : {
1042 1 : MinItemParser* mip = INITPTR;
1043 1 : TSChar section[] = "create BAZ foo";
1044 1 : int start_pos = 0;
1045 1 : int length = strlen( section );
1046 1 : int retval = 0;
1047 :
1048 1 : mip = mip_create( section, start_pos, length );
1049 1 : retval = mip_replace( mip, "BAZ", "FOO" );
1050 1 : fail_unless( strcmp(mip->item_line_section_,"create FOO foo")==0
1051 : , "Result differs from expected [%s]!=[%s]"
1052 : , mip->item_line_section_,"create FOO foo");
1053 : }
1054 1 : END_TEST
1055 : /* ------------------------------------------------------------------------- */
1056 1 : START_TEST(test_mip_replace7)
1057 : {
1058 1 : MinItemParser* mip = INITPTR;
1059 1 : TSChar section[] = "create BAZ foo";
1060 1 : int start_pos = 0;
1061 1 : int length = strlen( section );
1062 1 : int retval = 0;
1063 :
1064 1 : mip = mip_create( section, start_pos, length );
1065 1 : retval = mip_replace( mip, "BAZ", "FO" );
1066 1 : fail_unless( strcmp(mip->item_line_section_,"create FO foo")==0
1067 : , "Result differs from expected [%s]!=[%s]"
1068 : , mip->item_line_section_,"create FO foo");
1069 : }
1070 1 : END_TEST
1071 : /* ------------------------------------------------------------------------- */
1072 1 : START_TEST(test_mip_replace8)
1073 : {
1074 1 : MinItemParser* mip = INITPTR;
1075 1 : TSChar section[] = "create BAZ foo";
1076 1 : int start_pos = 0;
1077 1 : int length = strlen( section );
1078 1 : int retval = 0;
1079 :
1080 1 : mip = mip_create( section, start_pos, length );
1081 1 : retval = mip_replace( mip, "BAZ", "FOOO" );
1082 1 : fail_unless( strcmp(mip->item_line_section_,"create FOOO foo")==0
1083 : , "Result differs from expected [%s]!=[%s]"
1084 : , mip->item_line_section_,"create FOOO foo");
1085 : }
1086 1 : END_TEST
1087 : /* ------------------------------------------------------------------------- */
1088 : /* ========================== FUNCTIONS ==================================== */
1089 : /* ------------------------------------------------------------------------- */
1090 : Suite* min_item_parser_suite()
1091 36 : {
1092 36 : Suite * s = suite_create ( "min_item_parser" );
1093 :
1094 : /* Core test case */
1095 36 : TCase *tc_core = tcase_create ( "Core" );
1096 :
1097 : /* SIP creation function tests */
1098 36 : tcase_add_test ( tc_core, test_mip_create_ok );
1099 36 : tcase_add_test ( tc_core, test_mip_create_initptr );
1100 36 : tcase_add_test ( tc_core, test_mip_create_null );
1101 36 : tcase_add_test ( tc_core, test_mip_create_start_pos_negative );
1102 36 : tcase_add_test ( tc_core, test_mip_create_start_pos_over_length );
1103 36 : tcase_add_test ( tc_core, test_mip_create_length_negative );
1104 :
1105 : /* SIP parsing start and edn position function tests */
1106 36 : tcase_add_test ( tc_core, test_mip_parse_start_and_end_pos_ok );
1107 36 : tcase_add_test ( tc_core, test_mip_parse_start_and_end_pos_initptr );
1108 36 : tcase_add_test ( tc_core, test_mip_parse_start_and_end_pos_only_tag );
1109 36 : tcase_add_test ( tc_core, test_mip_get_string_with_backlashes );
1110 36 : tcase_add_test ( tc_core, test_mip_get_string_with_backlashes_without_comments );
1111 36 : tcase_add_test ( tc_core, test_mip_get_string_with_quotes );
1112 36 : tcase_add_test ( tc_core, test_mip_get_string_with_first_quote );
1113 :
1114 : /* SIP get string function tests */
1115 36 : tcase_add_test ( tc_core, test_mip_get_string );
1116 36 : tcase_add_test ( tc_core, test_mip_get_string_initptr );
1117 36 : tcase_add_test ( tc_core, test_mip_get_string_length_zero );
1118 36 : tcase_add_test ( tc_core, test_mip_get_next_string );
1119 36 : tcase_add_test ( tc_core, test_mip_get_next_tagged_string );
1120 :
1121 : /* SIP get integer value function tests */
1122 36 : tcase_add_test ( tc_core, test_mip_get_int );
1123 36 : tcase_add_test ( tc_core, test_mip_get_next_int );
1124 36 : tcase_add_test ( tc_core, test_mip_get_next_tagged_int );
1125 :
1126 : /* SIP get unsigned integer value function tests */
1127 36 : tcase_add_test ( tc_core, test_mip_get_uint_functions );
1128 36 : tcase_add_test ( tc_core, test_mip_get_char_functions );
1129 36 : tcase_add_test ( tc_core, test_mip_get_remainder );
1130 :
1131 : /* SIP parsing type tests */
1132 36 : tcase_add_test ( tc_core, test_mip_set_parsing_type );
1133 36 : tcase_add_test ( tc_core, test_mip_get_parsing_type );
1134 :
1135 : /* For possible bug testing... */
1136 : /*
1137 : tcase_add_test ( tc_core, test_mip_get_next_string_end_bug );
1138 : tcase_add_test ( tc_core, test_mip_get_string_with_quotes_end_bug );
1139 : */
1140 36 : tcase_add_test ( tc_core, test_mip_get_next_tagged_string_bug_hunting );
1141 :
1142 : /* mip_replace */
1143 36 : tcase_add_test ( tc_core, test_mip_replace1 );
1144 36 : tcase_add_test ( tc_core, test_mip_replace2 );
1145 36 : tcase_add_test ( tc_core, test_mip_replace3 );
1146 36 : tcase_add_test ( tc_core, test_mip_replace4 );
1147 36 : tcase_add_test ( tc_core, test_mip_replace5 );
1148 36 : tcase_add_test ( tc_core, test_mip_replace6 );
1149 36 : tcase_add_test ( tc_core, test_mip_replace7 );
1150 36 : tcase_add_test ( tc_core, test_mip_replace8 );
1151 :
1152 36 : suite_add_tcase ( s, tc_core );
1153 :
1154 36 : return s;
1155 : }
1156 : /* ------------------------------------------------------------------------- */
1157 : int min_item_parser_tests()
1158 36 : {
1159 36 : int number_failed = 0;
1160 36 : Suite * s = min_item_parser_suite ();
1161 36 : SRunner * sr = srunner_create (s);
1162 36 : srunner_run_all(sr, CK_NORMAL);
1163 1 : number_failed = srunner_ntests_failed(sr);
1164 1 : srunner_free(sr);
1165 1 : return number_failed;
1166 : }
1167 : /* ------------------------------------------------------------------------- */
1168 : /* End of file */
|