Skip to content

Commit

Permalink
Merge 77d1057 into 02dbb04
Browse files Browse the repository at this point in the history
  • Loading branch information
srz-zumix committed Jan 17, 2020
2 parents 02dbb04 + 77d1057 commit 4627136
Show file tree
Hide file tree
Showing 30 changed files with 558 additions and 112 deletions.
14 changes: 10 additions & 4 deletions .ci/azure_pipelines/template-make-disabled-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,22 @@ jobs:
# DISABLED_CONFIG: IUTEST_HAS_IGNORE_TEST
Disable_Matchers:
DISABLED_CONFIG: IUTEST_HAS_MATCHERS
Disable_MatchersAllOfAndAnyOf:
Disable_MatcherAllOfAndAnyOf:
DISABLED_CONFIG: IUTEST_HAS_MATCHER_ALLOF_AND_ANYOF
Disable_MatchersElementsAre:
Disable_MatcherEach:
DISABLED_CONFIG: IUTEST_HAS_MATCHER_EACH
Disable_MatcherElementsAre:
DISABLED_CONFIG: IUTEST_HAS_MATCHER_ELEMENTSARE
Disable_MatchersElementsAreArrayForward:
Disable_MatcherElementsAreArrayForward:
DISABLED_CONFIG: IUTEST_HAS_MATCHER_ELEMENTSAREARRAYFORWARD
Disable_MatcherFloatingPointNear:
DISABLED_CONFIG: IUTEST_HAS_MATCHER_FLOATINGPOINT_NEAR
Disable_MatchersRegex:
Disable_MatcherPointwise:
DISABLED_CONFIG: IUTEST_HAS_MATCHER_POINTWISE
Disable_MatcherRegex:
DISABLED_CONFIG: IUTEST_HAS_MATCHER_REGEX
Disable_MatcherVariadic:
DISABLED_CONFIG: IUTEST_HAS_MATCHER_VARIADIC
Disable_Package:
DISABLED_CONFIG: IUTEST_HAS_PACKAGE
Disable_Peep:
Expand Down
11 changes: 5 additions & 6 deletions .drone.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,11 @@ steps:
environment:
GTEST_EXPECT_VERSION: 0x01060000
commands: *gtest-compatible-commands
# https://github.com/srz-zumix/iutest/issues/355
# - name: release-1.5.0
# image: srzzumix/googletest:release-1.5.0
# environment:
# GTEST_EXPECT_VERSION: 0x01050000
# commands: *gtest-compatible-commands
- name: release-1.5.0
image: srzzumix/googletest:release-1.5.0
environment:
GTEST_EXPECT_VERSION: 0x01050000
commands: *gtest-compatible-commands
# https://github.com/srz-zumix/docker-googletest/issues/2
# - name: release-1.4.0
# image: srzzumix/googletest:release-1.4.0
Expand Down
173 changes: 119 additions & 54 deletions include/gtest/iutest_switch_for_gtest.hpp
Original file line number Diff line number Diff line change
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 All @@ -30,12 +30,19 @@
# ifndef _VARIADIC_MAX
# define _VARIADIC_MAX 10
# endif
#endif

#if defined(_MSC_VER) && _MSC_VER >= 1700
// old googletest using std::tr1::tuple
#include <tuple>
namespace std {
namespace tr1
{
using ::std::tuple;
using ::std::tuple;
using ::std::tuple_size;
using ::std::tuple_element;
using ::std::make_tuple;
using ::std::get;
}
}
#endif
Expand All @@ -51,6 +58,15 @@ namespace tr1
//======================================================================
// include
#include "../iutest_ver.hpp"

// gtest 1.5 or less compatible
#if !IUTEST_HAS_CONCEPTS
#include <gtest/internal/gtest-internal.h>
#define GTestStreamToHelper GTestStreamToHelperForCompatible
template <typename T>
void GTestStreamToHelper(std::ostream* os, const T& val);
#endif

#include <gtest/gtest.h>
#if defined(IUTEST_USE_GMOCK)
#include <gmock/gmock.h>
Expand Down Expand Up @@ -180,7 +196,11 @@ namespace tr1
#endif
#define IUTEST_HAS_TESTNAME_ALIAS 0
#define IUTEST_HAS_TESTNAME_ALIAS_JP 0
#define IUTEST_HAS_STREAM_RESULT 1
#if GTEST_VER < 0x01060000
# define IUTEST_HAS_STREAM_RESULT 0
#else
# define IUTEST_HAS_STREAM_RESULT 1
#endif

#define IUTEST_HAS_STREAM_BUFFER 0

Expand All @@ -196,28 +216,24 @@ namespace tr1
#define IUTEST_HAS_SEH GTEST_HAS_SEH
#define IUTEST_HAS_LONG_DOUBLE 0

#if GTEST_VER < 0x01080000
# define IUTEST_NO_ENV_XML_OUTPUT_FILE
#endif

#if GTEST_VER < 0x01070000
# define IUTEST_NO_RECORDPROPERTY_OUTSIDE_TESTMETHOD_LIFESPAN
# define IUTEST_NO_UNITEST_AD_HOC_TEST_RESULT_ACCESSOR
# define IUTEST_NO_TESTCASE_AD_HOC_TEST_RESULT_ACCESSOR
#endif

#if GTEST_VER < 0x01060000
# define IUTEST_NO_AD_HOC_TEST_RESULT
#endif

#include "../internal/iutest_compiler.hpp"
#include "../internal/iutest_type_traits.hpp"
#include "../internal/iutest_compatible_defs.hpp"

#if GTEST_VER < 0x01100000

namespace iutest_type_traits
{

template<bool b, typename T = type_defined_void>
struct enable_if;

}

#endif

#include "switch/iutest_switch_port.hpp"
#include "switch/iutest_switch_core.hpp"

Expand Down Expand Up @@ -384,7 +400,7 @@ struct is_pointer<T* volatile> : public true_type {};
// ostream
typedef ::std::ostream iu_ostream;

/* gtest 1.5 or less compatible...
// gtest 1.5 or less compatible...
#if !IUTEST_HAS_PRINT_TO
namespace internal
{
Expand All @@ -411,60 +427,46 @@ namespace internal
}
os << ">";
}
}

namespace print_internal
{
template<typename T>
iu_ostream& operator << (iu_ostream& os, const T& value)
{
const unsigned char* buf = const_cast<const unsigned char*>(
reinterpret_cast<const volatile unsigned char*>(&value));
const size_t size = sizeof(T);
internal::PrintBytesInObjectTo(buf, size, os);
return os;
}
}
#if IUTEST_HAS_CONCEPTS

namespace internal
{
#if IUTEST_HAS_NULLPTR
// template<>
// String StreamableToString<::std::nullptr_t>(const ::std::nullptr_t&)
// {
// return (Message() << "nullptr").GetString();
// }
#endif
#if IUTEST_HAS_DECLTYPE
template<typename T>
char is_ostreamable(const T&);
template<typename T>
auto is_ostreamable(const T& val) -> decltype((StrStream() << val), int());
concept printable = requires (T x) { ::std::cout << x; }; // NOLINT

template<typename T>
String StreamableToString(const T& val, typename std::enable_if<std::is_same<decltype(is_ostreamable(val)), char>::value>::type*& = iutest_type_traits::enabler::value)
requires (!printable<T>)
String StreamableToString(const T& val)
{
using namespace print_internal;
StrStream ss_;
ss_ << val;
const unsigned char* buf = const_cast<const unsigned char*>(
reinterpret_cast<const volatile unsigned char*>(&val));
const size_t size = sizeof(T);
internal::PrintBytesInObjectTo(buf, size, ss_);
return StrStreamToString(&ss_);
}

template<typename T, typename std::enable_if<std::is_same<T, ::std::nullptr_t>::value>::type* = nullptr>
String StreamableToString(const T&)
#else

namespace printer_internal
{
return (Message() << "nullptr").GetString();

template<typename T>
iu_ostream& operator << (iu_ostream& os, const T& val)
{
const unsigned char* buf = const_cast<const unsigned char*>(
reinterpret_cast<const volatile unsigned char*>(&val));
const size_t size = sizeof(T);
internal::PrintBytesInObjectTo(buf, size, os);
return os;
}

} // namespace printer_internal

#endif

}
} // end of namespace internal

#endif
*/

#if GTEST_VER < 0x01060000

Expand All @@ -486,10 +488,73 @@ using dummy_printer::PrintToString;
using dummy_printer::PrintToString;
#endif

#endif
template<typename T>
class WithParamInterface
{
public:
typedef T ParamType;
const ParamType& GetParam() const { return *parameter_; }

private:
static void SetParam(const ParamType *parameter) { parameter_ = parameter; }
static const ParamType *parameter_;
template <class TestClass>
friend class internal::ParameterizedTestFactory;
};

template<typename T>
const T* WithParamInterface<T>::parameter_ = NULL;

#endif // #if GTEST_VER < 0x01060000

} // end of namespace testing

// gtest 1.5 or less compatible...
#if !IUTEST_HAS_CONCEPTS
#if IUTEST_HAS_PRINT_TO

template <typename T>
inline void GTestStreamToHelperForCompatible(std::ostream* os, const T& val) {
*os << val;
}

#else
namespace testing
{
namespace printer_internal2
{

template<typename T>
void GTestStreamTo(std::ostream* os, const T& val)
{
using namespace ::testing::internal::printer_internal; // NOLINT
*os << val;
}
inline void GTestStreamTo(std::ostream* os, const ::std::string& val)
{
*os << val;
}
inline void GTestStreamTo(std::ostream* os, const char* const val)
{
*os << val;
}
inline void GTestStreamTo(std::ostream* os, const char val)
{
*os << val;
}

} // end of namespace printer_internal2
} // end of namespace testing


template <typename T>
inline void GTestStreamToHelperForCompatible(std::ostream* os, const T& val) {
::testing::printer_internal2::GTestStreamTo(os, val);
}

#endif
#endif // #if GTEST_VER < 0x01060000

#if defined(INCG_IRIS_IUTEST_HPP_)
// すでに iutest namespace が存在するので、define で対応
# define iutest testing
Expand Down
13 changes: 9 additions & 4 deletions include/gtest/switch/iutest_switch_assertion_return.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,19 @@
# undef IUTEST_HAS_ASSERTION_RETURN
#endif

#ifdef GTEST_MESSAGE_AT_
# undef GTEST_MESSAGE_AT_
#endif

//======================================================================
// define
#define IUTEST_HAS_ASSERTION_RETURN 1

#if defined(GTEST_MESSAGE_AT_)
# undef GTEST_MESSAGE_AT_
#else
# if defined(GTEST_MESSAGE_)
# undef GTEST_MESSAGE_
# define GTEST_MESSAGE_(message, result_type) GTEST_MESSAGE_AT_(__FILE__, __LINE__, message, result_type)
# endif
#endif

#define GTEST_MESSAGE_AT_(file, line, message, result_type) \
::testing::internal::AssertHelperEx(result_type, file, line, message) \
= ::testing::AssertionMessage()
Expand Down

0 comments on commit 4627136

Please sign in to comment.