| 3290 | } |
| 3291 | |
| 3292 | void |
| 3293 | test_multiple3 (const struct message *r1, const struct message *r2, const struct message *r3) |
| 3294 | { |
| 3295 | int message_count = count_parsed_messages(3, r1, r2, r3); |
| 3296 | |
| 3297 | char total[ strlen(r1->raw) |
| 3298 | + strlen(r2->raw) |
| 3299 | + strlen(r3->raw) |
| 3300 | + 1 |
| 3301 | ]; |
| 3302 | total[0] = '\0'; |
| 3303 | |
| 3304 | strcat(total, r1->raw); |
| 3305 | strcat(total, r2->raw); |
| 3306 | strcat(total, r3->raw); |
| 3307 | |
| 3308 | parser_init(r1->type); |
| 3309 | |
| 3310 | size_t read; |
| 3311 | |
| 3312 | read = parse(total, strlen(total)); |
| 3313 | |
| 3314 | if (parser->upgrade) { |
| 3315 | upgrade_message_fix(total, read, 3, r1, r2, r3); |
| 3316 | goto test; |
| 3317 | } |
| 3318 | |
| 3319 | if (read != strlen(total)) { |
| 3320 | print_error(total, read); |
| 3321 | abort(); |
| 3322 | } |
| 3323 | |
| 3324 | read = parse(NULL, 0); |
| 3325 | |
| 3326 | if (read != 0) { |
| 3327 | print_error(total, read); |
| 3328 | abort(); |
| 3329 | } |
| 3330 | |
| 3331 | test: |
| 3332 | |
| 3333 | if (message_count != num_messages) { |
| 3334 | fprintf(stderr, "\n\n*** Parser didn't see 3 messages only %d *** \n", num_messages); |
| 3335 | abort(); |
| 3336 | } |
| 3337 | |
| 3338 | if (!message_eq(0, r1)) abort(); |
| 3339 | if (message_count > 1 && !message_eq(1, r2)) abort(); |
| 3340 | if (message_count > 2 && !message_eq(2, r3)) abort(); |
| 3341 | |
| 3342 | parser_free(); |
| 3343 | } |
| 3344 | |
| 3345 | /* SCAN through every possible breaking to make sure the |
| 3346 | * parser can handle getting the content in any chunks that |
no test coverage detected