Skip to content

Commit

Permalink
add static_assert (#446)
Browse files Browse the repository at this point in the history
* add static_assert

* fix

* fix
  • Loading branch information
srz-zumix committed May 23, 2020
1 parent f3a5094 commit 7ea67f0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
3 changes: 3 additions & 0 deletions fused-src/Makefile
Expand Up @@ -4,5 +4,8 @@
fused:
make -C ../tools/fused

clean:
make -C ../tools/fused clean

ls:
ls -lh .
2 changes: 1 addition & 1 deletion include/iutest_static_assertion.hpp
Expand Up @@ -66,7 +66,7 @@ static bool StaticAssertTypeEq()
# define IUTEST_STATIC_ASSERT_MSG(B, Msg) static_assert(B, Msg)
#endif
#else
# define IIUT_STATIC_ASSERT_SIZECHECK(B) sizeof(::iutest::detail::static_assert_failure< (bool)B >) // NOLINT
# define IIUT_STATIC_ASSERT_SIZECHECK(B) sizeof(::iutest::detail::static_assert_failure< (bool)(B) >) // NOLINT
# define IUTEST_STATIC_ASSERT_MSG(B, Msg) \
typedef ::iutest::detail::StaticAssertionTest< IIUT_STATIC_ASSERT_SIZECHECK(B) > \
IUTEST_PP_CAT(iutest_static_assert_typedef_, IUTEST_PP_COUNTER) IUTEST_ATTRIBUTE_UNUSED_
Expand Down
4 changes: 3 additions & 1 deletion include/iutest_typed_tests.hpp
Expand Up @@ -6,7 +6,7 @@
*
* @author t.shirayanagi
* @par copyright
* Copyright (C) 2011-2019, Takazumi Shirayanagi\n
* Copyright (C) 2011-2020, Takazumi Shirayanagi\n
* This software is released under the new BSD License,
* see LICENSE
*/
Expand Down Expand Up @@ -225,6 +225,8 @@
static ::iutest::detail::TypedTestCasePState IIUT_TYPED_TEST_CASE_PSTATE_NAME_(testcase_)

#define IIUT_TYPED_TEST_P_(testcase_, testname_) \
IUTEST_STATIC_ASSERT_MSG(sizeof(IUTEST_PP_TOSTRING(testcase_)) > 1, "testcase_ must not be empty"); \
IUTEST_STATIC_ASSERT_MSG(sizeof(IUTEST_PP_TOSTRING(testname_)) > 1, "testname_ must not be empty"); \
namespace IIUT_TYPED_TEST_P_NAMESPACE_(testcase_) { \
template<typename iutest_TypeParam> \
class testname_ : public testcase_<iutest_TypeParam> { \
Expand Down
3 changes: 2 additions & 1 deletion projects/vscode/iutest.code-workspace
Expand Up @@ -111,5 +111,6 @@
}
],
"compounds": []
}
},
"C_Cpp.default.cppStandard": "c++17",
}

0 comments on commit 7ea67f0

Please sign in to comment.