nrun = srunner_ntests_run(fixture_sr);
nfail = srunner_ntests_failed(fixture_sr);
- fail_unless (nrun == 1 && nfail == 1,
+ ck_assert_msg (nrun == 1 && nfail == 1,
"Counts for run and fail for fixture failure not correct");
}
END_TEST
char *srstat = sr_stat_str(fixture_sr);
const char *exp = "0%: Checks: 1, Failures: 1, Errors: 0";
- fail_unless(strcmp(srstat, exp) == 0,
+ ck_assert_msg(strcmp(srstat, exp) == 0,
"SRunner stat string incorrect with setup failure");
free(srstat);
}
tcase_add_checked_fixture(tc,sub_ch_setup_norm,sub_ch_teardown_norm);
srunner_run_all(sr, CK_VERBOSE);
- fail_unless(srunner_ntests_failed(sr) == 0,
+ ck_assert_msg(srunner_ntests_failed(sr) == 0,
"Checked setup not being run correctly");
srunner_free(sr);
START_TEST(test_sub_pass)
{
- fail_unless(1 == 1, "Always pass");
+ ck_assert_msg(1 == 1, "Always pass");
}
END_TEST
sr = srunner_create(s);
srunner_run_all(sr,CK_VERBOSE);
- fail_unless (srunner_ntests_run(sr) == 1,
+ ck_assert_msg (srunner_ntests_run(sr) == 1,
"Test run counts not correct for checked setup failure");
- fail_unless (srunner_ntests_failed(sr) == 1,
+ ck_assert_msg (srunner_ntests_failed(sr) == 1,
"Failure counts not correct for checked setup failure");
strstat= sr_stat_str(sr);
- fail_unless(strcmp(strstat,
+ ck_assert_msg(strcmp(strstat,
"0%: Checks: 1, Failures: 1, Errors: 0") == 0,
"SRunner stat string incorrect with checked setup failure");
srunner_set_fork_status(sr, CK_NOFORK);
srunner_run_all(sr, CK_VERBOSE);
- fail_unless (srunner_ntests_run(sr) == 1,
+ ck_assert_msg (srunner_ntests_run(sr) == 1,
"Test run counts not correct for checked setup failure");
- fail_unless (srunner_ntests_failed(sr) == 1,
+ ck_assert_msg (srunner_ntests_failed(sr) == 1,
"Failure counts not correct for checked setup failure");
}
END_TEST
srunner_set_fork_status(sr, CK_NOFORK);
srunner_run_all(sr, CK_VERBOSE);
- fail_unless (srunner_ntests_run(sr) == 1,
+ ck_assert_msg (srunner_ntests_run(sr) == 1,
"Test run counts not correct for checked setup failure");
- fail_unless (srunner_ntests_failed(sr) == 1,
+ ck_assert_msg (srunner_ntests_failed(sr) == 1,
"Failure counts not correct for checked setup failure");
}
END_TEST
testval_up = 1;
testval_down = 1;
srunner_run_all(sr, CK_VERBOSE);
- fail_unless(testval_up == 7, "Multiple setups failed");
- fail_unless(testval_down == 7, "Multiple teardowns failed");
+ ck_assert_msg(testval_up == 7, "Multiple setups failed");
+ ck_assert_msg(testval_down == 7, "Multiple teardowns failed");
- fail_unless (srunner_ntests_run(sr) == 1,
+ ck_assert_msg (srunner_ntests_run(sr) == 1,
"Test run counts not correct for checked setup failure");
- fail_unless (srunner_ntests_failed(sr) == 0,
+ ck_assert_msg (srunner_ntests_failed(sr) == 0,
"Failure counts not correct for checked setup failure");
}
END_TEST
sr = srunner_create(s);
srunner_run_all(sr,CK_VERBOSE);
- fail_unless (srunner_ntests_failed(sr) == 1,
+ ck_assert_msg (srunner_ntests_failed(sr) == 1,
"Failure counts not correct for checked setup signal");
- fail_unless (srunner_ntests_run(sr) == 1,
+ ck_assert_msg (srunner_ntests_run(sr) == 1,
"Test run counts not correct for checked setup signal");
strstat= sr_stat_str(sr);
- fail_unless(strcmp(strstat,
+ ck_assert_msg(strcmp(strstat,
"0%: Checks: 1, Failures: 0, Errors: 1") == 0,
"SRunner stat string incorrect with checked setup signal");
static void sub_ch_setup_dual_1(void)
{
- fail_unless(testval_up == 1, "Wrong start value");
+ ck_assert_msg(testval_up == 1, "Wrong start value");
testval_up += 2;
}
static void sub_ch_setup_dual_2(void)
{
- fail_unless(testval_up == 3, "First setup failed");
+ ck_assert_msg(testval_up == 3, "First setup failed");
testval_up += 3;
}
START_TEST(test_sub_two_setups)
{
- fail_unless(testval_up == 6, "Multiple setups failed");
+ ck_assert_msg(testval_up == 6, "Multiple setups failed");
}
END_TEST
testval_up = 1;
srunner_run_all(sr, CK_VERBOSE);
- fail_unless(srunner_ntests_failed(sr) == 0,
+ ck_assert_msg(srunner_ntests_failed(sr) == 0,
"Problem with several setups");
srunner_free(sr);
sr = srunner_create(s);
srunner_run_all(sr,CK_VERBOSE);
- fail_unless (srunner_ntests_failed(sr) == 1,
+ ck_assert_msg (srunner_ntests_failed(sr) == 1,
"Failure counts not correct for checked teardown failure");
- fail_unless (srunner_ntests_run(sr) == 1,
+ ck_assert_msg (srunner_ntests_run(sr) == 1,
"Test run counts not correct for checked teardown failure");
strstat= sr_stat_str(sr);
- fail_unless(strcmp(strstat,
+ ck_assert_msg(strcmp(strstat,
"0%: Checks: 1, Failures: 1, Errors: 0") == 0,
"SRunner stat string incorrect with checked setup failure");
sr = srunner_create(s);
srunner_run_all(sr,CK_VERBOSE);
- fail_unless (srunner_ntests_failed(sr) == 1,
+ ck_assert_msg (srunner_ntests_failed(sr) == 1,
"Failure counts not correct for checked teardown signal");
- fail_unless (srunner_ntests_run(sr) == 1,
+ ck_assert_msg (srunner_ntests_run(sr) == 1,
"Test run counts not correct for checked teardown signal");
strstat= sr_stat_str(sr);
- fail_unless(strcmp(strstat,
+ ck_assert_msg(strcmp(strstat,
"0%: Checks: 1, Failures: 0, Errors: 1") == 0,
"SRunner stat string incorrect with checked teardown signal");
/* Teardowns are run in reverse order */
static void sub_ch_teardown_dual_1(void)
{
- fail_unless(testval_down == 6, "Second teardown failed");
+ ck_assert_msg(testval_down == 6, "Second teardown failed");
}
static void sub_ch_teardown_dual_2(void)
{
- fail_unless(testval_down == 3, "First teardown failed");
+ ck_assert_msg(testval_down == 3, "First teardown failed");
testval_down += 3;
}
}
free(tra);
}
- fail_unless(nr_of_failures == 0, "Problem with several teardowns\n %s",
+ ck_assert_msg(nr_of_failures == 0, "Problem with several teardowns\n %s",
errm);
srunner_free(sr);
START_TEST(test_nofork_sideeffects)
{
- fail_unless(counter == 1,
+ ck_assert_msg(counter == 1,
"Side effects not seen across tests");
}
END_TEST
START_TEST(test_nofork_pid)
{
- fail_unless(mypid == getpid(),
+ ck_assert_msg(mypid == getpid(),
"Unit test is in a different adresss space from setup code");
}
END_TEST
START_TEST(test_default_fork)
{
- fail_unless(srunner_fork_status(fork_dummy_sr) == CK_FORK,
+ ck_assert_msg(srunner_fork_status(fork_dummy_sr) == CK_FORK,
"Default fork status not set correctly");
}
END_TEST
START_TEST(test_set_fork)
{
srunner_set_fork_status(fork_dummy_sr, CK_NOFORK);
- fail_unless(srunner_fork_status(fork_dummy_sr) == CK_NOFORK,
+ ck_assert_msg(srunner_fork_status(fork_dummy_sr) == CK_NOFORK,
"Fork status not changed correctly");
}
END_TEST
START_TEST(test_env)
{
putenv((char *) "CK_FORK=no");
- fail_unless(srunner_fork_status(fork_dummy_sr) == CK_NOFORK,
+ ck_assert_msg(srunner_fork_status(fork_dummy_sr) == CK_NOFORK,
"Fork status does not obey environment variable");
}
END_TEST
{
putenv((char *) "CK_FORK=no");
srunner_set_fork_status(fork_dummy_sr, CK_FORK);
- fail_unless(srunner_fork_status(fork_dummy_sr) == CK_FORK,
+ ck_assert_msg(srunner_fork_status(fork_dummy_sr) == CK_FORK,
"Explicit setting of fork status should override env");
}
END_TEST
START_TEST(test_nofork)
{
- fail_unless(srunner_ntests_failed(fork_sr) == 0,
+ ck_assert_msg(srunner_ntests_failed(fork_sr) == 0,
"Errors on nofork test");
}
END_TEST
START_TEST(test_summary)
{
- fail_unless(strcmp(sr_stat_str(sr),
+ ck_assert_msg(strcmp(sr_stat_str(sr),
"100%: Checks: 0, Failures: 0, Errors: 0") == 0,
"Bad statistics string for empty suite");
}
srunner_set_log (sr, "test_log");
- fail_unless (srunner_has_log (sr), "SRunner not logging");
- fail_unless (strcmp(srunner_log_fname(sr), "test_log") == 0,
+ ck_assert_msg (srunner_has_log (sr), "SRunner not logging");
+ ck_assert_msg (strcmp(srunner_log_fname(sr), "test_log") == 0,
"Bad file name returned");
}
END_TEST
SRunner *sr = srunner_create(s);
/* check that setting log file via environment variable works */
- fail_unless(save_set_env("CK_LOG_FILE_NAME", "test_log", &old_val) == 0,
+ ck_assert_msg(save_set_env("CK_LOG_FILE_NAME", "test_log", &old_val) == 0,
"Failed to set environment variable");
- fail_unless (srunner_has_log (sr), "SRunner not logging");
- fail_unless (strcmp(srunner_log_fname(sr), "test_log") == 0,
+ ck_assert_msg (srunner_has_log (sr), "SRunner not logging");
+ ck_assert_msg (strcmp(srunner_log_fname(sr), "test_log") == 0,
"Bad file name returned");
/* check that explicit call to srunner_set_log()
overrides environment variable */
srunner_set_log (sr, "test2_log");
- fail_unless (srunner_has_log (sr), "SRunner not logging");
- fail_unless (strcmp(srunner_log_fname(sr), "test2_log") == 0,
+ ck_assert_msg (srunner_has_log (sr), "SRunner not logging");
+ ck_assert_msg (strcmp(srunner_log_fname(sr), "test2_log") == 0,
"Bad file name returned");
/* restore old environment */
- fail_unless(restore_env("CK_LOG_FILE_NAME", old_val) == 0,
+ ck_assert_msg(restore_env("CK_LOG_FILE_NAME", old_val) == 0,
"Failed to restore environment variable");
}
END_TEST
Suite *s = suite_create("Suite");
SRunner *sr = srunner_create(s);
- fail_unless (!srunner_has_log (sr), "SRunner not logging");
- fail_unless (srunner_log_fname(sr) == NULL, "Bad file name returned");
+ ck_assert_msg (!srunner_has_log (sr), "SRunner not logging");
+ ck_assert_msg (srunner_log_fname(sr) == NULL, "Bad file name returned");
}
END_TEST
srunner_set_log (sr, "test_log");
srunner_set_log (sr, "test2_log");
- fail_unless(strcmp(srunner_log_fname(sr), "test_log") == 0,
+ ck_assert_msg(strcmp(srunner_log_fname(sr), "test_log") == 0,
"Log file is initialize only and shouldn't be changeable once set");
}
END_TEST
srunner_set_xml (sr, "test_log.xml");
- fail_unless (srunner_has_xml (sr), "SRunner not logging XML");
- fail_unless (strcmp(srunner_xml_fname(sr), "test_log.xml") == 0,
+ ck_assert_msg (srunner_has_xml (sr), "SRunner not logging XML");
+ ck_assert_msg (strcmp(srunner_xml_fname(sr), "test_log.xml") == 0,
"Bad file name returned");
}
END_TEST
SRunner *sr = srunner_create(s);
/* check that setting XML log file via environment variable works */
- fail_unless(save_set_env("CK_XML_LOG_FILE_NAME", "test_log.xml", &old_val) == 0,
+ ck_assert_msg(save_set_env("CK_XML_LOG_FILE_NAME", "test_log.xml", &old_val) == 0,
"Failed to set environment variable");
- fail_unless (srunner_has_xml (sr), "SRunner not logging XML");
- fail_unless (strcmp(srunner_xml_fname(sr), "test_log.xml") == 0,
+ ck_assert_msg (srunner_has_xml (sr), "SRunner not logging XML");
+ ck_assert_msg (strcmp(srunner_xml_fname(sr), "test_log.xml") == 0,
"Bad file name returned");
/* check that explicit call to srunner_set_xml()
overrides environment variable */
srunner_set_xml (sr, "test2_log.xml");
- fail_unless (srunner_has_xml (sr), "SRunner not logging XML");
- fail_unless (strcmp(srunner_xml_fname(sr), "test2_log.xml") == 0,
+ ck_assert_msg (srunner_has_xml (sr), "SRunner not logging XML");
+ ck_assert_msg (strcmp(srunner_xml_fname(sr), "test2_log.xml") == 0,
"Bad file name returned");
/* restore old environment */
- fail_unless(restore_env("CK_XML_LOG_FILE_NAME", old_val) == 0,
+ ck_assert_msg(restore_env("CK_XML_LOG_FILE_NAME", old_val) == 0,
"Failed to restore environment variable");
}
END_TEST
Suite *s = suite_create("Suite");
SRunner *sr = srunner_create(s);
- fail_unless (!srunner_has_xml (sr), "SRunner not logging XML");
- fail_unless (srunner_xml_fname(sr) == NULL, "Bad file name returned");
+ ck_assert_msg (!srunner_has_xml (sr), "SRunner not logging XML");
+ ck_assert_msg (srunner_xml_fname(sr) == NULL, "Bad file name returned");
}
END_TEST
srunner_set_xml (sr, "test_log.xml");
srunner_set_xml (sr, "test2_log.xml");
- fail_unless(strcmp(srunner_xml_fname(sr), "test_log.xml") == 0,
+ ck_assert_msg(strcmp(srunner_xml_fname(sr), "test_log.xml") == 0,
"XML Log file is initialize only and shouldn't be changeable once set");
}
END_TEST
first_log = list_val(sr->loglst);
fail_if (first_log == NULL, "log is NULL");
list_advance(sr->loglst);
- fail_unless(list_at_end(sr->loglst), "More than one entry in log list");
- fail_unless(first_log->lfun == subunit_lfun,
+ ck_assert_msg(list_at_end(sr->loglst), "More than one entry in log list");
+ ck_assert_msg(first_log->lfun == subunit_lfun,
"Log function is not the subunit lfun.");
srunner_end_logging(sr);
srunner_free(sr);
failed++;
}
}
- fail_unless (sub_nfailed == failed,
+ ck_assert_msg (sub_nfailed == failed,
"Unexpected number of failures received, %d, expected %d.",
sub_nfailed, failed);
}
START_TEST(test_check_ntests_run)
{
- fail_unless (sub_ntests == nr_of_master_tests,
+ ck_assert_msg (sub_ntests == nr_of_master_tests,
"Unexpected number of tests run, %d.", sub_ntests);
}
END_TEST
fail_if(i - passed > sub_nfailed, NULL);
tr = tr_fail_array[i - passed];
- fail_unless(tr != NULL, NULL);
+ ck_assert_msg(tr != NULL, NULL);
got_msg = tr_msg(tr);
expected_msg = master_tests[i].msg;
if (strcmp(got_msg, expected_msg) != 0) {
fail_if(i - passed > sub_nfailed, NULL);
tr = tr_fail_array[i - passed];
- fail_unless(tr != NULL, NULL);
+ ck_assert_msg(tr != NULL, NULL);
line_no = master_tests_lineno[i];
if (line_no > 0 && tr_lno(tr) != line_no) {
char *emsg = malloc(MAXSTR);
fail_if(i - passed > sub_nfailed, NULL);
tr = tr_fail_array[i - passed];
- fail_unless(tr != NULL, NULL);
- fail_unless(master_tests[i].failure_type == tr_rtype(tr),
+ ck_assert_msg(tr != NULL, NULL);
+ ck_assert_msg(master_tests[i].failure_type == tr_rtype(tr),
"Failure type wrong for test %d", i);
}
}
int i;
for (i = 0; i < sub_nfailed; i++) {
TestResult *tr = tr_fail_array[i];
- fail_unless(tr != NULL, NULL);
- fail_unless(tr_lfile(tr) != NULL, "Bad file name for test %d", i);
- fail_unless(strstr(tr_lfile(tr), "check_check_sub.c") != 0,
+ ck_assert_msg(tr != NULL, NULL);
+ ck_assert_msg(tr_lfile(tr) != NULL, "Bad file name for test %d", i);
+ ck_assert_msg(strstr(tr_lfile(tr), "check_check_sub.c") != 0,
"Bad file name for test %d", i);
}
}
START_TEST(test_check_all_ftypes)
{
- fail_unless(master_tests[_i].failure_type == tr_rtype(tr_all_array[_i]),
+ ck_assert_msg(master_tests[_i].failure_type == tr_rtype(tr_all_array[_i]),
"Failure type wrong for test %d", _i);
}
END_TEST
START_TEST(test_setup)
{
- fail_unless (test_fixture_val == 1,
+ ck_assert_msg (test_fixture_val == 1,
"Value not setup or changed across tests correctly");
test_fixture_val = 2;
}
START_TEST(test_teardown)
{
- fail_unless (test_fixture_val == 3,
+ ck_assert_msg (test_fixture_val == 3,
"Value not changed correctly in teardown");
}
END_TEST
tr = receive_test_result(0);
teardown_messaging();
- fail_unless (tr != NULL,
+ ck_assert_msg (tr != NULL,
"No test result received");
- fail_unless (tr_ctx(tr) == CK_CTX_TEST,
+ ck_assert_msg (tr_ctx(tr) == CK_CTX_TEST,
"Bad CTX received");
- fail_unless (strcmp(tr_msg(tr), "Oops") == 0,
+ ck_assert_msg (strcmp(tr_msg(tr), "Oops") == 0,
"Bad failure msg received");
- fail_unless (strcmp(tr_lfile(tr), "abc125.c") == 0,
+ ck_assert_msg (strcmp(tr_lfile(tr), "abc125.c") == 0,
"Bad loc file received");
- fail_unless (tr_lno(tr) == 25,
+ ck_assert_msg (tr_lno(tr) == 25,
"Bad loc line received");
if (tr != NULL)
free(tr);
tr = receive_test_result(0);
teardown_messaging();
- fail_unless (tr != NULL,
+ ck_assert_msg (tr != NULL,
"No test result received");
- fail_unless (tr_ctx(tr) == CK_CTX_TEST,
+ ck_assert_msg (tr_ctx(tr) == CK_CTX_TEST,
"Bad CTX received");
- fail_unless (strcmp(tr_lfile(tr), "abc124.c") == 0,
+ ck_assert_msg (strcmp(tr_lfile(tr), "abc124.c") == 0,
"Bad loc file received");
- fail_unless (tr_lno(tr) == i -1,
+ ck_assert_msg (tr_lno(tr) == i -1,
"Bad loc line received");
if (tr != NULL)
free(tr);
tr = receive_test_result(1);
teardown_messaging();
- fail_unless (tr != NULL,
+ ck_assert_msg (tr != NULL,
"No test result received");
- fail_unless (tr_ctx(tr) == CK_CTX_TEST,
+ ck_assert_msg (tr_ctx(tr) == CK_CTX_TEST,
"Bad CTX received");
- fail_unless (strcmp(tr_lfile(tr), "abc125.c") == 0,
+ ck_assert_msg (strcmp(tr_lfile(tr), "abc125.c") == 0,
"Bad loc file received");
- fail_unless (tr_lno(tr) == 25,
+ ck_assert_msg (tr_lno(tr) == 25,
"Bad loc line received");
if (tr != NULL)
free(tr);
tr = receive_test_result(0);
teardown_messaging();
- fail_unless (tr != NULL,
+ ck_assert_msg (tr != NULL,
"No test result received");
- fail_unless (tr_ctx(tr) == CK_CTX_TEST,
+ ck_assert_msg (tr_ctx(tr) == CK_CTX_TEST,
"Bad CTX received");
- fail_unless (tr_msg(tr) == NULL,
+ ck_assert_msg (tr_msg(tr) == NULL,
"Bad failure msg received");
- fail_unless (strcmp(tr_lfile(tr), "abc125.c") == 0,
+ ck_assert_msg (strcmp(tr_lfile(tr), "abc125.c") == 0,
"Bad loc file received");
- fail_unless (tr_lno(tr) == 25,
+ ck_assert_msg (tr_lno(tr) == 25,
"Bad loc line received");
if (tr != NULL)
free(tr);
tr = receive_test_result(1);
teardown_messaging();
- fail_unless (tr != NULL,
+ ck_assert_msg (tr != NULL,
"No test result received");
- fail_unless (tr_ctx(tr) == CK_CTX_TEARDOWN,
+ ck_assert_msg (tr_ctx(tr) == CK_CTX_TEARDOWN,
"Bad CTX received");
- fail_unless (tr_msg(tr) == NULL,
+ ck_assert_msg (tr_msg(tr) == NULL,
"Bad failure msg received");
- fail_unless (strcmp(tr_lfile(tr), "abc126.c") == 0,
+ ck_assert_msg (strcmp(tr_lfile(tr), "abc126.c") == 0,
"Bad loc file received");
- fail_unless (tr_lno(tr) == 54,
+ ck_assert_msg (tr_lno(tr) == 54,
"Bad loc line received");
if (tr != NULL)
free(tr);
fmsg->msg = (char *) "";
upack (buf, (CheckMsg *) fmsg, &type);
- fail_unless (type == CK_MSG_FAIL,
+ ck_assert_msg (type == CK_MSG_FAIL,
"Bad type unpacked for FailMsg");
if (strcmp (fmsg->msg, "Hello, world!") != 0) {
lmsg->line = 0;
upack (buf, (CheckMsg *) lmsg, &type);
- fail_unless (type == CK_MSG_LOC,
+ ck_assert_msg (type == CK_MSG_LOC,
"Bad type unpacked for LocMsg");
if (lmsg->line != 125) {
cmsg.ctx = CK_CTX_TEARDOWN;
upack (buf, (CheckMsg *) &cmsg, &type);
- fail_unless (type == CK_MSG_CTX,
+ ck_assert_msg (type == CK_MSG_CTX,
"Bad type unpacked for CtxMsg");
if (cmsg.ctx != CK_CTX_SETUP) {
cmsg.ctx = CK_CTX_TEST;
n = pack (CK_MSG_CTX, &buf, (CheckMsg *) &cmsg);
- fail_unless (n > 0, "Return val from pack not set correctly");
+ ck_assert_msg (n > 0, "Return val from pack not set correctly");
/* Value below may change with different implementations of pack */
- fail_unless (n == 8, "Return val from pack not correct");
+ ck_assert_msg (n == 8, "Return val from pack not correct");
n = 0;
n = upack (buf, (CheckMsg *) &cmsg, &type);
if (n != 8) {
fmsg.msg = (char *) "abc";
upack (buf, (CheckMsg *) &fmsg, &type);
free (buf);
- fail_unless (strcmp (fmsg.msg, "") == 0,
+ ck_assert_msg (strcmp (fmsg.msg, "") == 0,
"Empty string not handled properly");
free (fmsg.msg);
pack (CK_MSG_LOC, &buf, (CheckMsg *) &lmsg);
lmsg.file = (char *) "abc";
upack (buf, (CheckMsg *) &lmsg, &type);
- fail_unless (strcmp (lmsg.file, "") == 0,
+ ck_assert_msg (strcmp (lmsg.file, "") == 0,
"Empty string not handled properly");
free (lmsg.file);
lmsg.file = NULL;
close (filedes[1]);
rmsg = punpack (filedes[0]);
- fail_unless (rmsg != NULL,
+ ck_assert_msg (rmsg != NULL,
"Return value from ppack should always be malloc'ed");
- fail_unless (rmsg->lastctx == CK_CTX_TEST,
+ ck_assert_msg (rmsg->lastctx == CK_CTX_TEST,
"CTX not set correctly in ppack");
- fail_unless (rmsg->fixture_line == -1,
+ ck_assert_msg (rmsg->fixture_line == -1,
"Default fixture loc not correct");
- fail_unless (rmsg->fixture_file == NULL,
+ ck_assert_msg (rmsg->fixture_file == NULL,
"Default fixture loc not correct");
- fail_unless (rmsg->test_line == 10,
+ ck_assert_msg (rmsg->test_line == 10,
"Test line not received correctly");
- fail_unless (strcmp(rmsg->test_file,"abc123.c") == 0,
+ ck_assert_msg (strcmp(rmsg->test_file,"abc123.c") == 0,
"Test file not received correctly");
- fail_unless (strcmp(rmsg->msg, "oops") == 0,
+ ck_assert_msg (strcmp(rmsg->msg, "oops") == 0,
"Failure message not received correctly");
free(rmsg);
close (filedes[1]);
rmsg = punpack (filedes[0]);
- fail_unless (rmsg == NULL,
+ ck_assert_msg (rmsg == NULL,
"Result should be NULL with no CTX");
if (rmsg != NULL)
close (filedes[1]);
rmsg = punpack (filedes[0]);
- fail_unless (rmsg->msg == NULL,
+ ck_assert_msg (rmsg->msg == NULL,
"Result message should be NULL with only CTX");
- fail_unless (rmsg->fixture_line == -1,
+ ck_assert_msg (rmsg->fixture_line == -1,
"Result loc line should be -1 with only CTX");
- fail_unless (rmsg->test_line == -1,
+ ck_assert_msg (rmsg->test_line == -1,
"Result loc line should be -1 with only CTX");
if (rmsg != NULL)
close (filedes[1]);
rmsg = punpack (filedes[0]);
- fail_unless (rmsg->test_line == 5,
+ ck_assert_msg (rmsg->test_line == 5,
"Test loc not being preserved on CTX change");
- fail_unless (rmsg->fixture_line == -1,
+ ck_assert_msg (rmsg->fixture_line == -1,
"Fixture not reset on CTX change");
if (rmsg != NULL)
free (rmsg);
close (filedes[1]);
rmsg = punpack (filedes[0]);
- fail_unless (rmsg->msg == NULL,
+ ck_assert_msg (rmsg->msg == NULL,
"Failure result should be NULL with no failure message");
if (rmsg != NULL)
free (rmsg);
close (filedes[1]);
rmsg = punpack (filedes[0]);
- fail_unless (rmsg != NULL,
+ ck_assert_msg (rmsg != NULL,
"Return value from ppack should always be malloc'ed");
- fail_unless (rmsg->lastctx == CK_CTX_TEST,
+ ck_assert_msg (rmsg->lastctx == CK_CTX_TEST,
"CTX not set correctly in ppack");
- fail_unless (rmsg->test_line == 10,
+ ck_assert_msg (rmsg->test_line == 10,
"Test line not received correctly");
- fail_unless (strcmp (rmsg->test_file, lmsg.file) == 0,
+ ck_assert_msg (strcmp (rmsg->test_file, lmsg.file) == 0,
"Test file not received correctly");
- fail_unless (strcmp (rmsg->msg, fmsg.msg) == 0,
+ ck_assert_msg (strcmp (rmsg->msg, fmsg.msg) == 0,
"Failure message not received correctly");
free (rmsg);
NULL, /* NULL tcase name. */
CK_VERBOSE);
- fail_unless (srunner_ntests_run(sr) == 3,
+ ck_assert_msg (srunner_ntests_run(sr) == 3,
"Not all tests were executed.");
reset_executed ();
NULL, /* NULL tcase name. */
CK_VERBOSE);
- fail_unless (test_tc11_executed
+ ck_assert_msg (test_tc11_executed
&& test_tc12_executed
&& !test_tc21_executed,
"Expected tests were not executed.");
"tcase12",
CK_VERBOSE);
- fail_unless (!test_tc11_executed
+ ck_assert_msg (!test_tc11_executed
&& test_tc12_executed
&& !test_tc21_executed,
"Expected tests were not executed.");
"tcase21",
CK_VERBOSE);
- fail_unless (!test_tc11_executed
+ ck_assert_msg (!test_tc11_executed
&& !test_tc12_executed
&& test_tc21_executed,
"Expected tests were not executed.");
setenv ("CK_RUN_SUITE", "suite1", 1);
srunner_run_all (sr, CK_VERBOSE);
- fail_unless (test_tc11_executed
+ ck_assert_msg (test_tc11_executed
&& test_tc12_executed
&& !test_tc21_executed,
"Expected tests were not executed.");
setenv ("CK_RUN_CASE", "tcase12", 1);
srunner_run_all (sr, CK_VERBOSE);
- fail_unless (!test_tc11_executed
+ ck_assert_msg (!test_tc11_executed
&& test_tc12_executed
&& !test_tc21_executed,
"Expected tests were not executed.");
setenv ("CK_RUN_CASE", "tcase21", 1);
srunner_run_all (sr, CK_VERBOSE);
- fail_unless (!test_tc11_executed
+ ck_assert_msg (!test_tc11_executed
&& !test_tc12_executed
&& test_tc21_executed,
"Expected tests were not executed.");
END_TEST
START_TEST(test_pass)
{
- fail_unless(1 == 1, "This test should pass");
- fail_unless(9999, "This test should pass");
+ ck_assert_msg(1 == 1, "This test should pass");
+ ck_assert_msg(9999, "This test should pass");
}
END_TEST
if((pid = fork()) < 0) {
ck_abort_msg("Failed to fork new process");
} else if (pid > 0) {
- fail_unless(1, NULL);
+ ck_assert_msg(1, NULL);
kill(pid, SIGKILL);
} else {
for (;;) {
} else if (pid > 0) {
check_waitpid_and_exit(pid);
} else {
- fail_unless(1, NULL);
+ ck_assert_msg(1, NULL);
check_waitpid_and_exit(0);
}
}
if((pid2 = check_fork()) < 0) {
ck_abort_msg("Failed to fork new process");
} else if (pid2 == 0) {
- fail_unless(1, NULL);
+ ck_assert_msg(1, NULL);
check_waitpid_and_exit(0);
}
check_waitpid_and_exit(pid2);
SRunner *sr;
s = suite_create("Check Servant3");
- fail_unless(s != NULL, NULL);
+ ck_assert_msg(s != NULL, NULL);
sr = srunner_create(NULL);
- fail_unless(sr != NULL, NULL);
+ ck_assert_msg(sr != NULL, NULL);
srunner_add_suite(sr, s);
srunner_free(sr);
sr = srunner_create(NULL);
- fail_unless(sr != NULL, NULL);
+ ck_assert_msg(sr != NULL, NULL);
srunner_add_suite(sr, NULL);
srunner_free(sr);
s = suite_create("Check Servant3");
- fail_unless(s != NULL, NULL);
+ ck_assert_msg(s != NULL, NULL);
sr = srunner_create(s);
- fail_unless(sr != NULL, NULL);
+ ck_assert_msg(sr != NULL, NULL);
srunner_free(sr);
}
END_TEST
{
List *lp = NULL;
- fail_unless (list_val(lp) == NULL,
+ ck_assert_msg (list_val(lp) == NULL,
"Current list value should be NULL for NULL list");
lp = check_list_create();
- fail_unless (list_val(lp) == NULL,
+ ck_assert_msg (list_val(lp) == NULL,
"Current list value should be NULL for newly created list");
- fail_unless (list_at_end(lp),
+ ck_assert_msg (list_at_end(lp),
"Newly created list should be at end");
list_advance(lp);
- fail_unless (list_at_end(lp),
+ ck_assert_msg (list_at_end(lp),
"Advancing a list at end should produce a list at end");
list_free (lp);
}
list_add_end (lp, tval);
- fail_unless (list_val (lp) != NULL,
+ ck_assert_msg (list_val (lp) != NULL,
"List current val should not be null after new insertion");
- fail_unless (!list_at_end (lp),
+ ck_assert_msg (!list_at_end (lp),
"List should be at end after new insertion");
- fail_unless (strcmp(tval, (char *) list_val (lp)) == 0,
+ ck_assert_msg (strcmp(tval, (char *) list_val (lp)) == 0,
"List current val should equal newly inserted val");
list_free (lp);
}
list_add_front (lp, tval);
- fail_unless (list_val (lp) != NULL,
+ ck_assert_msg (list_val (lp) != NULL,
"List current val should not be null after new insertion");
- fail_unless (strcmp(tval, (char *) list_val (lp)) == 0,
+ ck_assert_msg (strcmp(tval, (char *) list_val (lp)) == 0,
"List current val should equal newly inserted val");
list_free (lp);
}
list_add_end (lp, tval1);
list_add_end (lp, tval2);
list_front(lp);
- fail_unless (strcmp (tval1, list_val (lp)) == 0,
+ ck_assert_msg (strcmp (tval1, list_val (lp)) == 0,
"List head val should equal first inserted val");
list_advance (lp);
- fail_unless (!list_at_end (lp),
+ ck_assert_msg (!list_at_end (lp),
"List should not be at end after two adds and one next");
- fail_unless (strcmp (tval2, list_val (lp)) == 0,
+ ck_assert_msg (strcmp (tval2, list_val (lp)) == 0,
"List val should equal second inserted val");
list_advance(lp);
- fail_unless (list_at_end (lp),
+ ck_assert_msg (list_at_end (lp),
"List should be at and after two adds and two nexts");
list_free (lp);
}
list_add_front (lp, tval1);
list_add_front (lp, tval2);
list_front(lp);
- fail_unless (strcmp (tval2, list_val (lp)) == 0,
+ ck_assert_msg (strcmp (tval2, list_val (lp)) == 0,
"List head val should equal last inserted val");
list_advance (lp);
- fail_unless (!list_at_end (lp),
+ ck_assert_msg (!list_at_end (lp),
"List should not be at end after two adds and one next");
- fail_unless (strcmp (tval1, list_val (lp)) == 0,
+ ck_assert_msg (strcmp (tval1, list_val (lp)) == 0,
"List val should equal first inserted val");
list_advance(lp);
- fail_unless (list_at_end (lp),
+ ck_assert_msg (list_at_end (lp),
"List should be at and after two adds and two nexts");
list_free (lp);
}
START_TEST(test_pass)
{
- fail_unless(1,"Shouldn't see this message");
+ ck_assert_msg(1,"Shouldn't see this message");
}
END_TEST
unsigned int i;
for (i = 0; i < 999; i++)
{
- fail_unless (1, "Shouldn't see this message");
+ ck_assert_msg (1, "Shouldn't see this message");
}
return NULL;
}
START_TEST(test_pass)
{
- fail_unless (1==1, "Shouldn't see this");
+ ck_assert_msg (1==1, "Shouldn't see this");
}
END_TEST
START_TEST(test_pass2)
{
- fail_unless (1==1, "Shouldn't see this");
+ ck_assert_msg (1==1, "Shouldn't see this");
}
END_TEST
START_TEST(test_pass)
{
- fail_unless (1==1, "Shouldn't see this");
+ ck_assert_msg (1==1, "Shouldn't see this");
}
END_TEST
START_TEST(test_pass)
{
- fail_unless (1==1, "Shouldn't see this");
+ ck_assert_msg (1==1, "Shouldn't see this");
}
END_TEST
START_TEST(test_pass2)
{
- fail_unless (1==1, "Shouldn't see this");
+ ck_assert_msg (1==1, "Shouldn't see this");
}
END_TEST
START_TEST(test_loop)
{
- fail_unless (_i==1, "Iteration %d failed", _i);
+ ck_assert_msg (_i==1, "Iteration %d failed", _i);
}
END_TEST