From 8b3f0246a9e470f15b9d40b2fa03ff4e639e7383 Mon Sep 17 00:00:00 2001 From: heinrich5991 Date: Tue, 12 Mar 2019 02:06:54 +0100 Subject: [PATCH] Use `EXPECT_*` rather than `ASSERT_*` in tests `EXPECT_*` allows the test to continue even in the case of failure. Use this where it makes sense to continue. --- src/test/git_revision.cpp | 2 +- src/test/name_ban.cpp | 26 +++++++++++++------------- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/test/git_revision.cpp b/src/test/git_revision.cpp index 4f635356f..95504bf1b 100644 --- a/src/test/git_revision.cpp +++ b/src/test/git_revision.cpp @@ -7,6 +7,6 @@ TEST(GitRevision, ExistsOrNull) { if(GIT_SHORTREV_HASH) { - ASSERT_STRNE(GIT_SHORTREV_HASH, ""); + EXPECT_STRNE(GIT_SHORTREV_HASH, ""); } } diff --git a/src/test/name_ban.cpp b/src/test/name_ban.cpp index 7aa02a2a8..6bfaf85a5 100644 --- a/src/test/name_ban.cpp +++ b/src/test/name_ban.cpp @@ -4,26 +4,26 @@ TEST(NameBan, Empty) { - ASSERT_FALSE(IsNameBanned("", 0, 0)); - ASSERT_FALSE(IsNameBanned("abc", 0, 0)); + EXPECT_FALSE(IsNameBanned("", 0, 0)); + EXPECT_FALSE(IsNameBanned("abc", 0, 0)); } TEST(NameBan, Equality) { CNameBan Abc0("abc", 0, 0); - ASSERT_TRUE(IsNameBanned("abc", &Abc0, 1)); - ASSERT_TRUE(IsNameBanned(" abc", &Abc0, 1)); - ASSERT_TRUE(IsNameBanned("abc ", &Abc0, 1)); - ASSERT_TRUE(IsNameBanned("abc foo", &Abc0, 1)); // Maximum name length. - ASSERT_TRUE(IsNameBanned("äbc", &Abc0, 1)); // Confusables - ASSERT_FALSE(IsNameBanned("def", &Abc0, 1)); - ASSERT_FALSE(IsNameBanned("abcdef", &Abc0, 1)); + EXPECT_TRUE(IsNameBanned("abc", &Abc0, 1)); + EXPECT_TRUE(IsNameBanned(" abc", &Abc0, 1)); + EXPECT_TRUE(IsNameBanned("abc ", &Abc0, 1)); + EXPECT_TRUE(IsNameBanned("abc foo", &Abc0, 1)); // Maximum name length. + EXPECT_TRUE(IsNameBanned("äbc", &Abc0, 1)); // Confusables + EXPECT_FALSE(IsNameBanned("def", &Abc0, 1)); + EXPECT_FALSE(IsNameBanned("abcdef", &Abc0, 1)); } TEST(NameBan, Substring) { CNameBan Xyz("xyz", 0, 1); - ASSERT_TRUE(IsNameBanned("abcxyz", &Xyz, 1)); - ASSERT_TRUE(IsNameBanned("abcxyzdef", &Xyz, 1)); - ASSERT_FALSE(IsNameBanned("abcdef", &Xyz, 1)); -} \ No newline at end of file + EXPECT_TRUE(IsNameBanned("abcxyz", &Xyz, 1)); + EXPECT_TRUE(IsNameBanned("abcxyzdef", &Xyz, 1)); + EXPECT_FALSE(IsNameBanned("abcdef", &Xyz, 1)); +}