diff --git a/samples/asserts.c b/samples/asserts.c index abd20b0..627f778 100644 --- a/samples/asserts.c +++ b/samples/asserts.c @@ -1,54 +1,54 @@ #include Test(asserts, base) { - assert(true); - expect(true); + cr_assert(true); + cr_expect(true); - assert(true, "Assertions may take failure messages"); + cr_assert(true, "Assertions may take failure messages"); - assert(true, .msg = "You can use explicit named arguments"); + cr_assert(true, .msg = "You can use explicit named arguments"); - expect(false, "assert is fatal, expect isn't"); - assert(false, "This assert runs"); - assert(false, "This does not"); + cr_expect(false, "assert is fatal, expect isn't"); + cr_assert(false, "This assert runs"); + cr_assert(false, "This does not"); } Test(asserts, old_school) { if (false) - abort_test("You can abort the test with a message from anywhere"); + cr_abort_test("You can abort the test with a message from anywhere"); - abort_test(NULL); // or without a message + cr_abort_test(NULL); // or without a message } Test(asserts, string) { - assert_strings_eq("hello", "hello"); - assert_strings_neq("hello", "olleh"); + cr_assert_strings_eq("hello", "hello"); + cr_assert_strings_neq("hello", "olleh"); - assert_strings_gt("hello", "hell"); - assert_strings_geq("hello", "hell"); - assert_strings_geq("hello", "hello"); + cr_assert_strings_gt("hello", "hell"); + cr_assert_strings_geq("hello", "hell"); + cr_assert_strings_geq("hello", "hello"); - assert_strings_lt("hell", "hello"); - assert_strings_leq("hell", "hello"); - assert_strings_leq("hello", "hello"); + cr_assert_strings_lt("hell", "hello"); + cr_assert_strings_leq("hell", "hello"); + cr_assert_strings_leq("hello", "hello"); } Test(asserts, native) { - assert_eq(1, 1); - assert_neq(1, 2); + cr_assert_eq(1, 1); + cr_assert_neq(1, 2); - assert_lt(1, 2); - assert_leq(1, 2); - assert_leq(2, 2); + cr_assert_lt(1, 2); + cr_assert_leq(1, 2); + cr_assert_leq(2, 2); - assert_gt(2, 1); - assert_geq(2, 1); - assert_geq(2, 2); + cr_assert_gt(2, 1); + cr_assert_geq(2, 1); + cr_assert_geq(2, 2); } Test(asserts, float) { - assert_neq(0.1 * 0.1, 0.01); - assert_float_eq(0.1 * 0.1, 0.01, 0.001); + cr_assert_neq(0.1 * 0.1, 0.01); + cr_assert_float_eq(0.1 * 0.1, 0.01, 0.001); } struct dummy_struct { @@ -72,9 +72,9 @@ Test(asserts, array) { s2[1].a = 2; s2[1].b = 4; - assert_arrays_eq(arr1, arr1, 4); - assert_arrays_neq(arr1, arr2, 4); + cr_assert_arrays_eq(arr1, arr1, 4); + cr_assert_arrays_neq(arr1, arr2, 4); - assert_arrays_neq(s1, s2, 2); - assert_arrays_eq_cmp(s1, s2, 2, eq_dummy); + cr_assert_arrays_neq(s1, s2, 2); + cr_assert_arrays_eq_cmp(s1, s2, 2, eq_dummy); } diff --git a/samples/description.c b/samples/description.c index 335036b..55b7b49 100644 --- a/samples/description.c +++ b/samples/description.c @@ -1,7 +1,7 @@ #include Test(misc, failing, .description = "Just a failing test") { - assert(0); + cr_assert(0); } Test(misc, skipped, .description = "This one is skipped", .disabled = true) { diff --git a/samples/fixtures.c b/samples/fixtures.c index e077d8e..1f7851c 100644 --- a/samples/fixtures.c +++ b/samples/fixtures.c @@ -10,5 +10,5 @@ void teardown(void) { } Test(simple, fixtures, .init = setup, .fini = teardown) { - assert(1); + cr_assert(1); } diff --git a/samples/long-messages.c b/samples/long-messages.c index fc4c194..02472e1 100644 --- a/samples/long-messages.c +++ b/samples/long-messages.c @@ -1,5 +1,5 @@ #include Test(sample, long_msg) { - assert(0, "This is\nA long message\nSpawning multiple lines.\n\nFormatting is respected."); + cr_assert(0, "This is\nA long message\nSpawning multiple lines.\n\nFormatting is respected."); } diff --git a/samples/more-suites.c b/samples/more-suites.c index 1b2f14e..95d7039 100644 --- a/samples/more-suites.c +++ b/samples/more-suites.c @@ -9,11 +9,11 @@ void teardown_suite(void) { TestSuite(suite1, .init = setup_suite, .fini = teardown_suite); Test(suite1, test) { - assert(1); + cr_assert(1); } Test(suite2, test) { - assert(1); + cr_assert(1); } TestSuite(disabled, .disabled = true); diff --git a/samples/other-crashes.c b/samples/other-crashes.c index a1baa27..ab689bb 100644 --- a/samples/other-crashes.c +++ b/samples/other-crashes.c @@ -6,9 +6,9 @@ void crash(void) { } Test(misc, setup_crash, .init = crash) { - assert(true); + cr_assert(true); } Test(misc, teardown_crash, .fini = crash) { - assert(true); + cr_assert(true); } diff --git a/samples/report.c b/samples/report.c index 5c92b90..4c7a849 100644 --- a/samples/report.c +++ b/samples/report.c @@ -2,8 +2,8 @@ #include Test(sample, test) { - expect(0); - assert(1); + cr_expect(0); + cr_assert(1); } ReportHook(PRE_INIT)(struct criterion_test *test) { diff --git a/samples/simple.c b/samples/simple.c index c9dfa27..d5916f5 100644 --- a/samples/simple.c +++ b/samples/simple.c @@ -1,9 +1,9 @@ #include Test(misc, failing) { - assert(0); + cr_assert(0); } Test(misc, passing) { - assert(1); + cr_assert(1); } diff --git a/samples/suites.c b/samples/suites.c index 50edf6e..d19d7b2 100644 --- a/samples/suites.c +++ b/samples/suites.c @@ -1,9 +1,9 @@ #include Test(first_suite, test) { - assert(1); + cr_assert(1); } Test(second_suite, test) { - assert(1); + cr_assert(1); } diff --git a/samples/with-time.c b/samples/with-time.c index 1d67a01..65958f5 100644 --- a/samples/with-time.c +++ b/samples/with-time.c @@ -1,5 +1,5 @@ #include Test(samples, timed) { - assert(0); + cr_assert(0); }