Skip to content

Commit cabe1b6

Browse files
authored
Adds remaining macros (#42)
1 parent ea6c3f4 commit cabe1b6

1 file changed

Lines changed: 22 additions & 13 deletions

File tree

CppUnit2Gtest.hpp

Lines changed: 22 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@
44
#include <gtest/gtest.h>
55

66
#define CppUnit2Gtest
7-
8-
#define CPPUNIT_NS ::CppUnit
7+
#define CppUnit2Gtest_VERSION "0.0.0"
8+
#define CPPUNIT_VERSION "CppUnit2Gtest"
9+
#define CPPUNIT_NS ::CppUnit
10+
#define CPPUNIT_NS_BEGIN namespace CppUnit {
11+
#define CPPUNIT_NS_END }
912

1013
namespace CppUnit {
1114

@@ -287,21 +290,27 @@ namespace to { namespace gtest {
287290
#define CPPUNIT_ASSERT_LESSEQUAL_MESSAGE(msg, expected, actual) CppUnit2Gtest_assertion_wrapper_(LE, (actual, expected) << msg)
288291
#define CPPUNIT_ASSERT_GREATEREQUAL_MESSAGE(msg, expected, actual) CppUnit2Gtest_assertion_wrapper_(GE, (actual, expected) << msg)
289292

290-
#define CppUnit2Gtest_FailCompilation_NotSupported static_assert(false, \
291-
"This CppUnit macro is not supported. Please rewrite this test in GTest or with normal macros")
293+
#define CppUnit2Gtest_FailCompilation_NotSupported_ static_assert(false, \
294+
"This CppUnit macro is not supported. Please rewrite this test in GTest or with implmented macros")
292295

293-
// Things like assert failed are intentionally not added
294-
// We can add them but behaviour could be buggy
295-
// (I think an inline lambda counts as a function and therefor ASSERT won't end the function
296-
// early so we'd call the lambda, return to outer function then `ASSERT_TRUE(HasFailure());` (?)
297-
// Alternatively we can add the gtest header for testing extenstions (see internal tests) and use that.
298-
// Neither seem like a good idea
296+
// Some macros are intentionally not added
297+
// Most are to allow users to define them themselves if they wish
298+
// CPPUNIT_TEST_SUITE_PROPERTY
299+
// Some however should really be re-written
299300
// These include:
300-
#define CPPUNIT_TEST_SUITE_ADD_TEST(test) CppUnit2Gtest_FailCompilation_NotSupported
301-
302-
// Does nothing, these were for exporting plugins (not adding a main).
301+
#define CPPUNIT_TEST_SUITE_ADD_TEST(t) CppUnit2Gtest_FailCompilation_NotSupported_
302+
#define CPPUNIT_ASSERT_ASSERTION_FAIL(t) CppUnit2Gtest_FailCompilation_NotSupported_
303+
#define CPPUNIT_EXTRACT_EXCEPTION_TYPE_(t) CppUnit2Gtest_FailCompilation_NotSupported_
304+
#define CPPUNIT_ASSERT_ASSERTION_FAIL_MESSAGE(t) CppUnit2Gtest_FailCompilation_NotSupported_
305+
#define CppUnit2Gtest_BadCast_ static_assert(false, "This did a C style cast and is unlikely to be what you wanted")
306+
#define CPPUNIT_STATIC_CAST(a, b) CppUnit2Gtest_BadCast_
307+
#define CPPUNIT_CONST_CAST(a,b) CppUnit2Gtest_BadCast_
308+
309+
// Macros that (now) do nothing have been implemented as such
310+
// These were for exporting plugins (not adding a main).
303311
#define CPPUNIT_PLUGIN_IMPLEMENT_MAIN()
304312
#define CPPUNIT_PLUGIN_IMPLEMENT()
313+
#define CPPUNIT_WRAP_COLUMN 1
305314

306315
#if defined(Cpp2Unit2Gtest_EnableMainHelperClasses)
307316

0 commit comments

Comments
 (0)