Blob Blame History Raw
/*
 * DO NOT EDIT THIS FILE. Generated by checkmk.
 * Edit the original source file "in" instead.
 */

#include <check.h>

#line 1 "in"
/* Multiple everything... */

#include <stdlib.h>
#include <errno.h>
#include <stdio.h>

void print_message(const char *msg, size_t msgsz)
{
    int nc;

    nc = printf("%s", msg);
    fail_unless(nc == msgsz, "failed to print completely: %s",
                strerror(errno));
}



START_TEST(hello_world)
{
#line 21
    const char msg[] = "Hello, world!\n";
    print_message(msg, sizeof msg - 1);

}
END_TEST

START_TEST(neverending_story)
{
#line 25
    const char msg[] = "Bastian Balthazar Bux\n";
    print_message(msg, sizeof msg - 1);

}
END_TEST

START_TEST(math_problem)
{
#line 31
    fail_unless(1 + 1 == 2, "Something's broken...");

}
END_TEST


START_TEST(more_math)
{
#line 38
    fail_unless(2/2 == 1, "Another weird math result");

}
END_TEST

START_TEST(weave)
{
#line 43
    int i;
    const char msg[] = "###\n";

    for (i=0; i != 3; ++i)
        print_message(row, sizeof row - 1);
}
END_TEST

int main(void)
{
    Suite *s1 = suite_create("A Suite");
    TCase *tc1_1 = tcase_create("A Test Case");
    TCase *tc1_2 = tcase_create("Another Test Case");
    Suite *s2 = suite_create("Another Suite");
    TCase *tc2_1 = tcase_create("A Test Case for Another Suite");
    TCase *tc2_2 = tcase_create("A Basket Case");
    SRunner *sr = srunner_create(s1);
    int nf;

    suite_add_tcase(s1, tc1_1);
    tcase_add_test(tc1_1, hello_world);
    tcase_add_test(tc1_1, neverending_story);
    suite_add_tcase(s1, tc1_2);
    tcase_add_test(tc1_2, math_problem);
    suite_add_tcase(s2, tc2_1);
    tcase_add_test(tc2_1, more_math);
    suite_add_tcase(s2, tc2_2);
    tcase_add_test(tc2_2, weave);

    srunner_add_suite(sr, s2);

    srunner_run_all(sr, CK_ENV);
    nf = srunner_ntests_failed(sr);
    srunner_free(sr);

    return nf == 0 ? 0 : 1;
}