forked from CxxTest/cxxtest
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Finally merged Oliviers-OSS-patchs_oc_5.
Added tests for the functionality added in the branch. Resolved conflicts. Merging pull request.
- Loading branch information
Showing
5 changed files
with
234 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,3 +7,8 @@ guide.pdf | |
guide.html | ||
parsetab.py | ||
TEST-cxxtest.xml | ||
TestGpp_* | ||
TestClang_* | ||
TestGppPy_* | ||
*.dSYM | ||
TestCpp_* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,112 @@ | ||
#include <cxxtest/TestSuite.h> | ||
|
||
// | ||
// A test for issue 122/123, where TS_ASSERT_EQUALS and TS_ASSERT_DIFFERS were | ||
// both true at the same time. | ||
// | ||
|
||
// not const on purpose | ||
static char non_const_value_1[] = { "toto" }; | ||
static char non_const_value_2[] = { "toto" }; // different pointers from value1 | ||
static char non_const_value_3[] = { "nekobus" }; | ||
class CharAssertions : public CxxTest::TestSuite { | ||
public: | ||
template <typename T1, typename T2> void differs_must_succeed_generator() | ||
{ | ||
T1 str1 = non_const_value_1; | ||
T2 str2 = non_const_value_3; | ||
TS_ASSERT_DIFFERS(str1, str2); | ||
} | ||
template <typename T1, typename T2> void differs_must_fail_generator() | ||
{ | ||
T1 str1 = non_const_value_1; | ||
T2 str2 = non_const_value_2; | ||
TS_ASSERT_DIFFERS(str1, str2); | ||
} | ||
template <typename T1, typename T2> void equals_must_succeed_generator() | ||
{ | ||
T1 str1 = non_const_value_1; | ||
T2 str2 = non_const_value_2; | ||
TS_ASSERT_EQUALS(str1, str2); | ||
} | ||
template <typename T1, typename T2> void equals_must_fail_generator() | ||
{ | ||
T1 str1 = non_const_value_1; | ||
T2 str2 = non_const_value_3; | ||
TS_ASSERT_EQUALS(str1, str2); | ||
} | ||
|
||
// we must test the entire matrix | ||
// naming scheme is test_[de][sf][cm][cm], where: | ||
// - d or e are for 'differs' and 'equals' | ||
// - s or f are for 'expect to succeed' or 'expect to fail' | ||
// - c or m are for 'const' or 'mutable' chars. | ||
void test_dscc() | ||
{ | ||
differs_must_succeed_generator<char const* const, char const* const>(); | ||
} | ||
void test_dscm() | ||
{ | ||
differs_must_succeed_generator<char const* const, char const*>(); | ||
} | ||
void test_dsmc() | ||
{ | ||
differs_must_succeed_generator<char const*, char const* const>(); | ||
} | ||
void test_dsmm() | ||
{ | ||
differs_must_succeed_generator<char const*, char const*>(); | ||
} | ||
|
||
void test_dfcc() | ||
{ | ||
differs_must_fail_generator<char const* const, char const* const>(); | ||
} | ||
void test_dfcm() | ||
{ | ||
differs_must_fail_generator<char const* const, char const*>(); | ||
} | ||
void test_dfmc() | ||
{ | ||
differs_must_fail_generator<char const*, char const* const>(); | ||
} | ||
void test_dfmm() | ||
{ | ||
differs_must_fail_generator<char const*, char const*>(); | ||
} | ||
|
||
|
||
void test_escc() | ||
{ | ||
equals_must_succeed_generator<char const* const, char const* const>(); | ||
} | ||
void test_escm() | ||
{ | ||
equals_must_succeed_generator<char const* const, char const*>(); | ||
} | ||
void test_esmc() | ||
{ | ||
equals_must_succeed_generator<char const*, char const* const>(); | ||
} | ||
void test_esmm() | ||
{ | ||
equals_must_succeed_generator<char const*, char const*>(); | ||
} | ||
|
||
void test_efcc() | ||
{ | ||
equals_must_fail_generator<char const* const, char const* const>(); | ||
} | ||
void test_efcm() | ||
{ | ||
equals_must_fail_generator<char const* const, char const*>(); | ||
} | ||
void test_efmc() | ||
{ | ||
equals_must_fail_generator<char const*, char const* const>(); | ||
} | ||
void test_efmm() | ||
{ | ||
equals_must_fail_generator<char const*, char const*>(); | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
Running cxxtest tests (16 tests).... | ||
In CharAssertions::test_dfcc: | ||
CharAssertions.h:24: Error: Expected (str1 != str2), found (toto) | ||
In CharAssertions::test_dfcm: | ||
CharAssertions.h:24: Error: Expected (str1 != str2), found (toto) | ||
In CharAssertions::test_dfmc: | ||
CharAssertions.h:24: Error: Expected (str1 != str2), found (toto) | ||
In CharAssertions::test_dfmm: | ||
CharAssertions.h:24: Error: Expected (str1 != str2), found (toto) | ||
.... | ||
In CharAssertions::test_efcc: | ||
CharAssertions.h:36: Error: Expected (str1 == str2), found (toto != nekobus) | ||
In CharAssertions::test_efcm: | ||
CharAssertions.h:36: Error: Expected (str1 == str2), found (toto != nekobus) | ||
In CharAssertions::test_efmc: | ||
CharAssertions.h:36: Error: Expected (str1 == str2), found (toto != nekobus) | ||
In CharAssertions::test_efmm: | ||
CharAssertions.h:36: Error: Expected (str1 == str2), found (toto != nekobus) | ||
Failed 8 and Skipped 0 of 16 tests | ||
Success rate: 50% | ||
Error level = 8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters