Updated asserts sample

This commit is contained in:
Snaipe 2015-09-08 23:55:11 +02:00
parent 8ac4911f19
commit a8ecd27427
4 changed files with 20 additions and 10 deletions

View file

@ -6,6 +6,8 @@ Test(asserts, base) {
cr_assert(true, "Assertions may take failure messages");
cr_assert(true, "Or even %d format string %s", 1, "with parameters");
cr_expect(false, "assert is fatal, expect isn't");
cr_assert(false, "This assert runs");
cr_assert(false, "This does not");
@ -17,6 +19,9 @@ Test(asserts, old_school) {
}
Test(asserts, string) {
cr_assert_str_empty("");
cr_assert_str_not_empty("foo");
cr_assert_str_eq("hello", "hello");
cr_assert_str_neq("hello", "olleh");

View file

@ -1,7 +1,7 @@
[----] asserts.c:9: Assertion failed: assert is fatal, expect isn't
[----] asserts.c:10: Assertion failed: This assert runs
[----] asserts.c:11: Assertion failed: assert is fatal, expect isn't
[----] asserts.c:12: Assertion failed: This assert runs
[FAIL] asserts::base: (0.00s)
[----] asserts.c:15: Assertion failed: You can fail an assertion with a message from anywhere
[----] asserts.c:16: Assertion failed: The condition for this assertion were not met.
[----] asserts.c:17: Assertion failed: You can fail an assertion with a message from anywhere
[----] asserts.c:18: Assertion failed: The condition for this assertion were not met.
[FAIL] asserts::old_school: (0.00s)
[====] Synthesis: Tested: 6 | Passing: 4 | Failing: 2 | Crashing: 0 

View file

@ -8,6 +8,8 @@ Test(asserts, base) {
cr_assert(true, "Assertions may take failure messages");
cr_assert(true, "Or even %d format string %s", 1, "with parameters");
cr_expect(false, "assert is fatal, expect isn't");
cr_assert(false, "This assert runs");
cr_assert(false, "This does not");
@ -19,6 +21,9 @@ Test(asserts, old_school) {
}
Test(asserts, string) {
cr_assert_str_empty("");
cr_assert_str_not_empty("foo");
cr_assert_str_eq("hello", "hello");
cr_assert_str_neq("hello", "olleh");

View file

@ -1,11 +1,11 @@
[----] asserts.cc:78: Assertion failed: (&s1)[0 .. 2] == (&s2)[0 .. 2]
[----] asserts.cc:83: Assertion failed: (&s1)[0 .. 2] == (&s2)[0 .. 2]
[FAIL] asserts::array: (0.00s)
[----] asserts.cc:11: Assertion failed: assert is fatal, expect isn't
[----] asserts.cc:12: Assertion failed: This assert runs
[----] asserts.cc:13: Assertion failed: assert is fatal, expect isn't
[----] asserts.cc:14: Assertion failed: This assert runs
[FAIL] asserts::base: (0.00s)
[----] asserts.cc:84: Assertion failed: The condition for this assertion were not met.
[----] asserts.cc:89: Assertion failed: The condition for this assertion were not met.
[FAIL] asserts::exception: (0.00s)
[----] asserts.cc:17: Assertion failed: You can fail an assertion with a message from anywhere
[----] asserts.cc:18: Assertion failed: The condition for this assertion were not met.
[----] asserts.cc:19: Assertion failed: You can fail an assertion with a message from anywhere
[----] asserts.cc:20: Assertion failed: The condition for this assertion were not met.
[FAIL] asserts::old_school: (0.00s)
[====] Synthesis: Tested: 7 | Passing: 3 | Failing: 4 | Crashing: 0