From a8ecd27427740ccef9c2419d4f314b3e39dd8262 Mon Sep 17 00:00:00 2001 From: Snaipe Date: Tue, 8 Sep 2015 23:55:11 +0200 Subject: [PATCH] Updated asserts sample --- samples/asserts.c | 5 +++++ samples/asserts.c.bin.err.expected | 8 ++++---- samples/asserts.cc | 5 +++++ samples/asserts.cc.bin.err.expected | 12 ++++++------ 4 files changed, 20 insertions(+), 10 deletions(-) diff --git a/samples/asserts.c b/samples/asserts.c index 2318944..1d5d83e 100644 --- a/samples/asserts.c +++ b/samples/asserts.c @@ -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"); diff --git a/samples/asserts.c.bin.err.expected b/samples/asserts.c.bin.err.expected index 5ee803c..2488aa8 100644 --- a/samples/asserts.c.bin.err.expected +++ b/samples/asserts.c.bin.err.expected @@ -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  diff --git a/samples/asserts.cc b/samples/asserts.cc index 98cd394..46c22af 100644 --- a/samples/asserts.cc +++ b/samples/asserts.cc @@ -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"); diff --git a/samples/asserts.cc.bin.err.expected b/samples/asserts.cc.bin.err.expected index d18db61..3ef1647 100644 --- a/samples/asserts.cc.bin.err.expected +++ b/samples/asserts.cc.bin.err.expected @@ -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