| 1 |
/* |
| 2 |
* DO NOT EDIT THIS FILE. Generated by checkmk. |
| 3 |
* Edit the original source file "in" instead. |
| 4 |
*/ |
| 5 |
|
| 6 |
#include <check.h> |
| 7 |
|
| 8 |
#line 1 "in" |
| 9 |
/* Multiple everything... */ |
| 10 |
|
| 11 |
#include <stdlib.h> |
| 12 |
#include <errno.h> |
| 13 |
#include <stdio.h> |
| 14 |
|
| 15 |
void print_message(const char *msg, size_t msgsz) |
| 16 |
{ |
| 17 |
int nc; |
| 18 |
|
| 19 |
nc = printf("%s", msg); |
| 20 |
fail_unless(nc == msgsz, "failed to print completely: %s", |
| 21 |
strerror(errno)); |
| 22 |
} |
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
START_TEST(hello_world) |
| 27 |
{ |
| 28 |
#line 21 |
| 29 |
const char msg[] = "Hello, world!\n"; |
| 30 |
print_message(msg, sizeof msg - 1); |
| 31 |
|
| 32 |
} |
| 33 |
END_TEST |
| 34 |
|
| 35 |
START_TEST(neverending_story) |
| 36 |
{ |
| 37 |
#line 25 |
| 38 |
const char msg[] = "Bastian Balthazar Bux\n"; |
| 39 |
print_message(msg, sizeof msg - 1); |
| 40 |
|
| 41 |
} |
| 42 |
END_TEST |
| 43 |
|
| 44 |
START_TEST(math_problem) |
| 45 |
{ |
| 46 |
#line 31 |
| 47 |
fail_unless(1 + 1 == 2, "Something's broken..."); |
| 48 |
|
| 49 |
} |
| 50 |
END_TEST |
| 51 |
|
| 52 |
|
| 53 |
START_TEST(more_math) |
| 54 |
{ |
| 55 |
#line 38 |
| 56 |
fail_unless(2/2 == 1, "Another weird math result"); |
| 57 |
|
| 58 |
} |
| 59 |
END_TEST |
| 60 |
|
| 61 |
START_TEST(weave) |
| 62 |
{ |
| 63 |
#line 43 |
| 64 |
int i; |
| 65 |
const char msg[] = "###\n"; |
| 66 |
|
| 67 |
for (i=0; i != 3; ++i) |
| 68 |
print_message(row, sizeof row - 1); |
| 69 |
} |
| 70 |
END_TEST |
| 71 |
|
| 72 |
int main(void) |
| 73 |
{ |
| 74 |
Suite *s1 = suite_create("A Suite"); |
| 75 |
TCase *tc1_1 = tcase_create("A Test Case"); |
| 76 |
TCase *tc1_2 = tcase_create("Another Test Case"); |
| 77 |
Suite *s2 = suite_create("Another Suite"); |
| 78 |
TCase *tc2_1 = tcase_create("A Test Case for Another Suite"); |
| 79 |
TCase *tc2_2 = tcase_create("A Basket Case"); |
| 80 |
SRunner *sr = srunner_create(s1); |
| 81 |
int nf; |
| 82 |
|
| 83 |
suite_add_tcase(s1, tc1_1); |
| 84 |
tcase_add_test(tc1_1, hello_world); |
| 85 |
tcase_add_test(tc1_1, neverending_story); |
| 86 |
suite_add_tcase(s1, tc1_2); |
| 87 |
tcase_add_test(tc1_2, math_problem); |
| 88 |
suite_add_tcase(s2, tc2_1); |
| 89 |
tcase_add_test(tc2_1, more_math); |
| 90 |
suite_add_tcase(s2, tc2_2); |
| 91 |
tcase_add_test(tc2_2, weave); |
| 92 |
|
| 93 |
srunner_add_suite(sr, s2); |
| 94 |
|
| 95 |
srunner_run_all(sr, CK_ENV); |
| 96 |
nf = srunner_ntests_failed(sr); |
| 97 |
srunner_free(sr); |
| 98 |
|
| 99 |
return nf == 0 ? 0 : 1; |
| 100 |
} |