• R/O
  • SSH
  • HTTPS

iutest: 提交


Commit MetaInfo

修訂1441 (tree)
時間2021-09-27 11:06:07
作者srz_zumix

Log Message

Merge remote-tracking branch 'origin/develop'

git@6b05c78076fb5882f5e925d96f01b6b879a076ff
https://github.com/srz-zumix/iutest/commit/6b05c78076fb5882f5e925d96f01b6b879a076ff


Merge pull request #620 from srz-zumix/develop

update github actions
git@949391ddcd30604310aa6c0fbde397362099f9ba


Merge pull request #619 from srz-zumix/github/matrix_test

include only
git@9510a24f8d439b7c787a98c4c79f847d6ef4692a


include only

git@59e119928929ed2d1b61934ae07bbe60c585eade


up composite action (#617)

git@1e6767afb7bd84eaea873f57c8cf8f8806b41d12

Change Summary

差異

--- trunk/CHANGES.md (revision 1440)
+++ trunk/CHANGES.md (revision 1441)
@@ -4,7 +4,11 @@
44
55 ## Changes for 1.17.99
66
7+* New
8+ * IUTEST_*_COMPLEX_EQ アサーションを追加
9+
710 * Improved
11+ * IUTEST_*_ALMOST_EQ が ::std::complex に対応
812 * 例外発生時にも SCOPED_TRACE のメッセージを出力するように変更
913 * 空のテストスイート名・テスト名に static_assert を追加
1014 * GoogleTest の GTEST_REMOVE_LEGACY_TEST_CASEAPI_ に対応
--- trunk/bitrise.yml (revision 1440)
+++ trunk/bitrise.yml (revision 1441)
@@ -117,9 +117,7 @@
117117 #!/usr/bin/env bash
118118 set -ex
119119 env
120- ls /opt/android-ndk
121- envman add --key ANDROID_NDK_ROOT --value /opt/android-ndk
122- envman add --key ANDROID_NDK_HOME --value /opt/android-ndk
120+ envman add --key ANDROID_NDK_ROOT --value ${ANDROID_NDK_HOME}
123121 - script:
124122 title: CMake
125123 inputs:
--- trunk/docs/cover.html (revision 1440)
+++ trunk/docs/cover.html (revision 1441)
@@ -23,7 +23,7 @@
2323 <div class="contents">
2424 <h1>IUTEST</h1>
2525 <div class="text_block">
26-Iris Unit Test Framework : 2020 / 01 / 02<br />
26+Iris Unit Test Framework : 2021 / 09 / 14<br />
2727 <br />
2828 </div>
2929 <h2>はじめに</h2>
@@ -96,7 +96,7 @@
9696 <pre>
9797 BSD 3-Clause License
9898
99- Copyright (c) 2011-2020, Takazumi Shirayanagi
99+ Copyright (c) 2011-2021, Takazumi Shirayanagi
100100 All rights reserved.
101101
102102 Redistribution and use in source and binary forms, with or without
@@ -129,7 +129,7 @@
129129 </div> <!-- end of contents -->
130130
131131 <br />
132-<div class="copyright">Copyright (c) 2011-2020, Takazumi-Shirayanagi, All rights reserved.</div>
132+<div class="copyright">Copyright (c) 2011-2021, Takazumi-Shirayanagi, All rights reserved.</div>
133133
134134 </body>
135135 </html>
--- trunk/docs/primer.html (revision 1440)
+++ trunk/docs/primer.html (revision 1441)
@@ -146,6 +146,7 @@
146146 <li><a name="ext_assert_ex" id="ext_assert_ex">アサーションの拡張</a><br />
147147 <ul>
148148 <li>IUTEST_ASSERT_ALMOST_EQ</li>
149+ <li>IUTEST_ASSERT_COMPLEX_EQ</li>
149150 <li>IUTEST_ASSERT_EQ_RANGE</li>
150151 <li>IUTEST_ASSERT_NE_RANGE</li>
151152 <li>IUTEST_ASSERT_EQ_COLLECTIONS</li>
@@ -707,7 +708,7 @@
707708 </div> <!-- end of contents -->
708709
709710 <br />
710-<div class="copyright">Copyright (c) 2011-2020, Takazumi-Shirayanagi, All rights reserved.</div>
711+<div class="copyright">Copyright (c) 2011-2021, Takazumi-Shirayanagi, All rights reserved.</div>
711712
712713 </body>
713714 </html>
--- trunk/include/gtest/iutest_switch_for_gtest.hpp (revision 1440)
+++ trunk/include/gtest/iutest_switch_for_gtest.hpp (revision 1441)
@@ -6,7 +6,7 @@
66 *
77 * @author t.shirayanagi
88 * @par copyright
9- * Copyright (C) 2011-2020, Takazumi Shirayanagi\n
9+ * Copyright (C) 2011-2021, Takazumi Shirayanagi\n
1010 * This software is released under the new BSD License,
1111 * see LICENSE
1212 */
@@ -536,7 +536,7 @@
536536 #if IUTEST_HAS_PRINT_TO
537537
538538 template <typename T>
539-inline void GTestStreamToHelperForCompatible(std::ostream* os, const T& val) {
539+inline void GTestStreamToHelperForCompatible(::std::ostream* os, const T& val) {
540540 *os << val;
541541 }
542542
@@ -556,6 +556,11 @@
556556 {
557557 *os << val;
558558 }
559+template<typename T>
560+inline void GTestStreamTo(std::ostream* os, const ::std::complex<T>& val)
561+{
562+ *os << val;
563+}
559564 inline void GTestStreamTo(std::ostream* os, const char* const val)
560565 {
561566 *os << val;
--- trunk/include/gtest/switch/iutest_switch_assert.hpp (revision 1440)
+++ trunk/include/gtest/switch/iutest_switch_assert.hpp (revision 1441)
@@ -2,11 +2,11 @@
22 //-----------------------------------------------------------------------
33 /**
44 * @file iutest_switch_assert.hpp
5- * @brief ASSERT フレーバー切り替え ファイル
5+ * @brief ASSERT flavor iutest/gtest switch file
66 *
77 * @author t.shirayanagi
88 * @par copyright
9- * Copyright (C) 2012-2019, Takazumi Shirayanagi\n
9+ * Copyright (C) 2012-2021, Takazumi Shirayanagi\n
1010 * This software is released under the new BSD License,
1111 * see LICENSE
1212 */
@@ -71,6 +71,7 @@
7171 #define ASSERT_NEAR IUTEST_ASSERT_NEAR
7272 #define ASSERT_FLOAT_EQ IUTEST_ASSERT_FLOAT_EQ
7373 #define ASSERT_DOUBLE_EQ IUTEST_ASSERT_DOUBLE_EQ
74+#define ASSERT_COMPLEX_EQ IUTEST_ASSERT_COMPLEX_EQ
7475 #define ASSERT_STREQ IUTEST_ASSERT_STREQ
7576 #define ASSERT_STRNE IUTEST_ASSERT_STRNE
7677 #define ASSERT_STRCASEEQ IUTEST_ASSERT_STRCASEEQ
@@ -125,6 +126,7 @@
125126 #undef IUTEST_ASSERT_SAME
126127 #undef IUTEST_ASSERT_FLOAT_EQ
127128 #undef IUTEST_ASSERT_DOUBLE_EQ
129+#undef IUTEST_ASSERT_COMPLEX_EQ
128130 #undef IUTEST_ASSERT_STREQ
129131 #undef IUTEST_ASSERT_STRNE
130132 #undef IUTEST_ASSERT_STRCASEEQ
@@ -177,6 +179,7 @@
177179 #define IUTEST_ASSERT_SAME(v1, v2) ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperSame, v1, v2)
178180 #define IUTEST_ASSERT_FLOAT_EQ ASSERT_FLOAT_EQ
179181 #define IUTEST_ASSERT_DOUBLE_EQ ASSERT_DOUBLE_EQ
182+#define IUTEST_ASSERT_COMPLEX_EQ(v1, v2) ASSERT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointComplexEQ, v1, v2)
180183 #define IUTEST_ASSERT_STREQ ASSERT_STREQ
181184 #define IUTEST_ASSERT_STRNE ASSERT_STRNE
182185 #define IUTEST_ASSERT_STRCASEEQ ASSERT_STRCASEEQ
@@ -210,6 +213,7 @@
210213 #endif // !defined(IUTEST_USE_GTEST)
211214
212215 #define ASSERT_ALMOST_EQ IUTEST_ASSERT_ALMOST_EQ
216+#define ASSERT_COMPLEX_EQ IUTEST_ASSERT_COMPLEX_EQ
213217 #define ASSERT_NULL IUTEST_ASSERT_NULL
214218 #define ASSERT_NOTNULL IUTEST_ASSERT_NOTNULL
215219 #define ASSERT_SAME IUTEST_ASSERT_SAME
--- trunk/include/gtest/switch/iutest_switch_assume.hpp (revision 1440)
+++ trunk/include/gtest/switch/iutest_switch_assume.hpp (revision 1441)
@@ -2,11 +2,11 @@
22 //-----------------------------------------------------------------------
33 /**
44 * @file iutest_switch_assume.hpp
5- * @brief ASSUME フレーバー切り替え ファイル
5+ * @brief ASSUME flavor iutest/gtest switch file
66 *
77 * @author t.shirayanagi
88 * @par copyright
9- * Copyright (C) 2013-2019, Takazumi Shirayanagi\n
9+ * Copyright (C) 2013-2021, Takazumi Shirayanagi\n
1010 * This software is released under the new BSD License,
1111 * see LICENSE
1212 */
@@ -30,6 +30,7 @@
3030 #define ASSUME_NEAR IUTEST_ASSUME_NEAR
3131 #define ASSUME_FLOAT_EQ IUTEST_ASSUME_FLOAT_EQ
3232 #define ASSUME_DOUBLE_EQ IUTEST_ASSUME_DOUBLE_EQ
33+#define ASSUME_COMPLEX_EQ IUTEST_ASSUME_COMPLEX_EQ
3334 #define ASSUME_STREQ IUTEST_ASSUME_STREQ
3435 #define ASSUME_STRNE IUTEST_ASSUME_STRNE
3536 #define ASSUME_STRCASEEQ IUTEST_ASSUME_STRCASEEQ
@@ -84,6 +85,7 @@
8485 #undef IUTEST_ASSUME_SAME
8586 #undef IUTEST_ASSUME_FLOAT_EQ
8687 #undef IUTEST_ASSUME_DOUBLE_EQ
88+#undef IUTEST_ASSUME_COMPLEX_EQ
8789 #undef IUTEST_ASSUME_STREQ
8890 #undef IUTEST_ASSUME_STRNE
8991 #undef IUTEST_ASSUME_STRCASEEQ
@@ -175,6 +177,9 @@
175177 #define ASSUME_DOUBLE_EQ(expected, actual)\
176178 ASSUME_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
177179 expected, actual)
180+#define ASSUME_COMPLEX_EQ(expected, actual)\
181+ ASSUME_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointComplexEQ, \
182+ expected, actual)
178183 #define ASSUME_NEAR(val1, val2, abs_error)\
179184 ASSUME_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
180185 val1, val2, abs_error)
@@ -207,6 +212,7 @@
207212 #define IUTEST_ASSUME_NEAR ASSUME_NEAR
208213 #define IUTEST_ASSUME_FLOAT_EQ ASSUME_FLOAT_EQ
209214 #define IUTEST_ASSUME_DOUBLE_EQ ASSUME_DOUBLE_EQ
215+#define IUTEST_ASSUME_COMPLEX_EQ ASSUME_COMPLEX_EQ
210216 #define IUTEST_ASSUME_STREQ ASSUME_STREQ
211217 #define IUTEST_ASSUME_STRNE ASSUME_STRNE
212218 #define IUTEST_ASSUME_STRCASEEQ ASSUME_STRCASEEQ
--- trunk/include/gtest/switch/iutest_switch_cmphelper.hpp (revision 1440)
+++ trunk/include/gtest/switch/iutest_switch_cmphelper.hpp (revision 1441)
@@ -2,11 +2,11 @@
22 //-----------------------------------------------------------------------
33 /**
44 * @file iutest_switch_cmphelper.hpp
5- * @brief gtest 用 比較ヘルパー関数 ファイル
5+ * @brief compare helper for gtest
66 *
77 * @author t.shirayanagi
88 * @par copyright
9- * Copyright (C) 2012-2019, Takazumi Shirayanagi\n
9+ * Copyright (C) 2012-2021, Takazumi Shirayanagi\n
1010 * This software is released under the new BSD License,
1111 * see LICENSE
1212 */
@@ -35,9 +35,49 @@
3535 using ::iutest_type_traits::enable_if;
3636 #endif
3737
38-//======================================================================
39-// class
38+template<typename RawType>
39+inline AssertionResult CmpHelperFloatingPointComplexEQ(const char* expr1, const char* expr2
40+ , const ::std::complex<RawType>& val1, const ::std::complex<RawType>& val2)
41+{
42+ AssertionResult real = CmpHelperFloatingPointEQ<RawType>(expr1, expr2, val1.real(), val2.real());
43+ AssertionResult imag = CmpHelperFloatingPointEQ<RawType>(expr1, expr2, val1.imag(), val2.imag());
44+ if( real && imag )
45+ {
46+ return real;
47+ }
48+ return EqFailure(expr1, expr2
49+ , FormatForComparisonFailureMessage(val1, val2).c_str()
50+ , FormatForComparisonFailureMessage(val2, val1).c_str()
51+ , true);
52+}
4053
54+template<typename R1, typename R2>
55+inline AssertionResult CmpHelperFloatingPointComplexEQ(const char* expr1, const char* expr2
56+ , const ::std::complex<R1>& val1, const ::std::complex<R2>& val2)
57+{
58+ if( sizeof(R1) > sizeof(R2) )
59+ {
60+ return CmpHelperFloatingPointComplexEQ<R1>(expr1, expr2, val1, val2);
61+ }
62+ else
63+ {
64+ return CmpHelperFloatingPointComplexEQ<R2>(expr1, expr2, val1, val2);
65+ }
66+}
67+
68+template<typename R1, typename R2>
69+inline AssertionResult CmpHelperFloatingPointComplexEQ(const char* expr1, const char* expr2
70+ , R1 val1, const ::std::complex<R2>& val2)
71+{
72+ return CmpHelperFloatingPointComplexEQ(expr1, expr2, ::std::complex<R2>(val1, R2()), val2);
73+}
74+template<typename R1, typename R2>
75+inline AssertionResult CmpHelperFloatingPointComplexEQ(const char* expr1, const char* expr2
76+ , const ::std::complex<R1>& val1, R2 val2)
77+{
78+ return CmpHelperFloatingPointComplexEQ(expr1, expr2, val1, ::std::complex<R1>(val2, R1()));
79+}
80+
4181 namespace backward
4282 {
4383
@@ -102,22 +142,45 @@
102142 template<bool lhs_is_null_literal>
103143 class AlmostEqHelper : public EqHelper<lhs_is_null_literal>
104144 {
145+ struct CmpHelper
146+ {
147+ template<typename T1, typename T2>
148+ static AssertionResult Compare(const char* expr1, const char* expr2, const T1& val1, const T2& val2)
149+ {
150+ return EqHelper<false>::Compare(expr1, expr2, val1, static_cast<T1>(val2));
151+ }
152+ template<typename T>
153+ static AssertionResult Compare(const char* expr1, const char* expr2, const float& val1, const T& val2)
154+ {
155+ return CmpHelperFloatingPointEQ<float>(expr1, expr2, val1, static_cast<float>(val2));
156+ }
157+ template<typename T>
158+ static AssertionResult Compare(const char* expr1, const char* expr2, const double& val1, const T& val2)
159+ {
160+ return CmpHelperFloatingPointEQ<double>(expr1, expr2, val1, static_cast<double>(val2));
161+ }
162+ };
105163 public:
106164 template<typename T1, typename T2>
107165 static AssertionResult Compare(const char* expr1, const char* expr2, const T1& val1, const T2& val2)
108166 {
109- return EqHelper<false>::Compare(expr1, expr2, val1, static_cast<T1>(val2));
167+ return CmpHelper::Compare(expr1, expr2, val1, val2);
110168 }
111- template<typename T>
112- static AssertionResult Compare(const char* expr1, const char* expr2, const float& val1, const T& val2)
169+ template<typename T, typename U>
170+ static AssertionResult Compare(const char* expr1, const char* expr2, const ::std::complex<T>& val1, const ::std::complex<U>& val2)
113171 {
114- return CmpHelperFloatingPointEQ<float>(expr1, expr2, val1, static_cast<float>(val2));
172+ return CmpHelperFloatingPointComplexEQ(expr1, expr2, val1, val2);
115173 }
116- template<typename T>
117- static AssertionResult Compare(const char* expr1, const char* expr2, const double& val1, const T& val2)
174+ template<typename T, typename U>
175+ static AssertionResult Compare(const char* expr1, const char* expr2, const T& val1, const ::std::complex<U>& val2)
118176 {
119- return CmpHelperFloatingPointEQ<double>(expr1, expr2, val1, static_cast<double>(val2));
177+ return CmpHelperFloatingPointComplexEQ(expr1, expr2, val1, val2);
120178 }
179+ template<typename T, typename U>
180+ static AssertionResult Compare(const char* expr1, const char* expr2, const ::std::complex<T>& val1, const U& val2)
181+ {
182+ return CmpHelperFloatingPointComplexEQ(expr1, expr2, val1, val2);
183+ }
121184 };
122185
123186 template<>
@@ -127,9 +190,6 @@
127190
128191 } // end of namespace backward
129192
130-//======================================================================
131-// function
132-
133193 template<typename T1, typename T2>
134194 inline AssertionResult CmpHelperSame(const char* expected_str, const char* actual_str
135195 , const T1& expected, const T2& actual)
--- trunk/include/gtest/switch/iutest_switch_expect.hpp (revision 1440)
+++ trunk/include/gtest/switch/iutest_switch_expect.hpp (revision 1441)
@@ -2,11 +2,11 @@
22 //-----------------------------------------------------------------------
33 /**
44 * @file iutest_switch_expect.hpp
5- * @brief EXPECT フレーバー切り替え ファイル
5+ * @brief EXPECT flavor iutest/gtest switch file
66 *
77 * @author t.shirayanagi
88 * @par copyright
9- * Copyright (C) 2012-2019, Takazumi Shirayanagi\n
9+ * Copyright (C) 2012-2021, Takazumi Shirayanagi\n
1010 * This software is released under the new BSD License,
1111 * see LICENSE
1212 */
@@ -71,6 +71,7 @@
7171 #define EXPECT_NEAR IUTEST_EXPECT_NEAR
7272 #define EXPECT_FLOAT_EQ IUTEST_EXPECT_FLOAT_EQ
7373 #define EXPECT_DOUBLE_EQ IUTEST_EXPECT_DOUBLE_EQ
74+#define EXPECT_COMPLEX_EQ IUTEST_EXPECT_COMPLEX_EQ
7475 #define EXPECT_STREQ IUTEST_EXPECT_STREQ
7576 #define EXPECT_STRNE IUTEST_EXPECT_STRNE
7677 #define EXPECT_STRCASEEQ IUTEST_EXPECT_STRCASEEQ
@@ -125,6 +126,7 @@
125126 #undef IUTEST_EXPECT_SAME
126127 #undef IUTEST_EXPECT_FLOAT_EQ
127128 #undef IUTEST_EXPECT_DOUBLE_EQ
129+#undef IUTEST_EXPECT_COMPLEX_EQ
128130 #undef IUTEST_EXPECT_STREQ
129131 #undef IUTEST_EXPECT_STRNE
130132 #undef IUTEST_EXPECT_STRCASEEQ
@@ -176,6 +178,7 @@
176178 #define IUTEST_EXPECT_SAME(v1, v2) EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperSame, v1, v2)
177179 #define IUTEST_EXPECT_FLOAT_EQ EXPECT_FLOAT_EQ
178180 #define IUTEST_EXPECT_DOUBLE_EQ EXPECT_DOUBLE_EQ
181+#define IUTEST_EXPECT_COMPLEX_EQ(v1, v2) EXPECT_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointComplexEQ, v1, v2)
179182 #define IUTEST_EXPECT_STREQ EXPECT_STREQ
180183 #define IUTEST_EXPECT_STRNE EXPECT_STRNE
181184 #define IUTEST_EXPECT_STRCASEEQ EXPECT_STRCASEEQ
@@ -210,6 +213,7 @@
210213 #endif // !defined(IUTEST_USE_GTEST)
211214
212215 #define EXPECT_ALMOST_EQ IUTEST_EXPECT_ALMOST_EQ
216+#define EXPECT_COMPLEX_EQ IUTEST_EXPECT_COMPLEX_EQ
213217 #define EXPECT_NULL IUTEST_EXPECT_NULL
214218 #define EXPECT_NOTNULL IUTEST_EXPECT_NOTNULL
215219 #define EXPECT_SAME IUTEST_EXPECT_SAME
--- trunk/include/gtest/switch/iutest_switch_inform.hpp (revision 1440)
+++ trunk/include/gtest/switch/iutest_switch_inform.hpp (revision 1441)
@@ -2,7 +2,7 @@
22 //-----------------------------------------------------------------------
33 /**
44 * @file iutest_switch_inform.hpp
5- * @brief INFORM フレーバー切り替え ファイル
5+ * @brief INFORM flavor iutest/gtest switch file
66 *
77 * @author t.shirayanagi
88 * @par copyright
@@ -30,6 +30,7 @@
3030 #define INFORM_NEAR IUTEST_INFORM_NEAR
3131 #define INFORM_FLOAT_EQ IUTEST_INFORM_FLOAT_EQ
3232 #define INFORM_DOUBLE_EQ IUTEST_INFORM_DOUBLE_EQ
33+#define INFORM_COMPLEX_EQ IUTEST_INFORM_COMPLEX_EQ
3334 #define INFORM_STREQ IUTEST_INFORM_STREQ
3435 #define INFORM_STRNE IUTEST_INFORM_STRNE
3536 #define INFORM_STRCASEEQ IUTEST_INFORM_STRCASEEQ
@@ -84,6 +85,7 @@
8485 #undef IUTEST_INFORM_SAME
8586 #undef IUTEST_INFORM_FLOAT_EQ
8687 #undef IUTEST_INFORM_DOUBLE_EQ
88+#undef IUTEST_INFORM_COMPLEX_EQ
8789 #undef IUTEST_INFORM_STREQ
8890 #undef IUTEST_INFORM_STRNE
8991 #undef IUTEST_INFORM_STRCASEEQ
@@ -182,6 +184,9 @@
182184 #define INFORM_DOUBLE_EQ(expected, actual)\
183185 INFORM_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointEQ<double>, \
184186 expected, actual)
187+#define INFORM_COMPLEX_EQ(expected, actual)\
188+ INFORM_PRED_FORMAT2(::testing::internal::CmpHelperFloatingPointComplexEQ, \
189+ expected, actual)
185190 #define INFORM_NEAR(val1, val2, abs_error)\
186191 INFORM_PRED_FORMAT3(::testing::internal::DoubleNearPredFormat, \
187192 val1, val2, abs_error)
@@ -214,6 +219,7 @@
214219 #define IUTEST_INFORM_NEAR INFORM_NEAR
215220 #define IUTEST_INFORM_FLOAT_EQ INFORM_FLOAT_EQ
216221 #define IUTEST_INFORM_DOUBLE_EQ INFORM_DOUBLE_EQ
222+#define IUTEST_INFORM_COMPLEX_EQ INFORM_COMPLEX_EQ
217223 #define IUTEST_INFORM_STREQ INFORM_STREQ
218224 #define IUTEST_INFORM_STRNE INFORM_STRNE
219225 #define IUTEST_INFORM_STRCASEEQ INFORM_STRCASEEQ
--- trunk/include/internal/iutest_internal.hpp (revision 1440)
+++ trunk/include/internal/iutest_internal.hpp (revision 1441)
@@ -533,6 +533,10 @@
533533
534534 #endif
535535
536+#define IUTEST_TEST_COMPLEX_EQ(expected, actual, on_failure) \
537+ IUTEST_PRED_FORMAT2_( ::iutest::internal::CmpHelperFloatingPointComplexEQ \
538+ , expected, actual, on_failure )
539+
536540 #define IUTEST_TEST_NEAR(v1, v2, abs_v, on_failure) \
537541 IUTEST_PRED_FORMAT3_( ::iutest::internal::CmpHelperNear \
538542 , v1, v2, abs_v, on_failure )
--- trunk/include/internal/iutest_stdlib_defs.hpp (revision 1440)
+++ trunk/include/internal/iutest_stdlib_defs.hpp (revision 1441)
@@ -34,6 +34,7 @@
3434 #include <cstdlib>
3535 #include <cstddef>
3636 #include <limits>
37+#include <complex>
3738
3839 // <version> header
3940 #if !defined(IUTEST_HAS_CXX_HDR_VERSION)
--- trunk/include/internal/iutest_string_stream.hpp (revision 1440)
+++ trunk/include/internal/iutest_string_stream.hpp (revision 1441)
@@ -384,7 +384,7 @@
384384 }
385385 #endif
386386 #if IUTEST_HAS_FLOAT128
387- inline _Myt& operator<< (detail::Float128::Float v)
387+ inline _Myt& operator<< (internal::Float128::Float v)
388388 {
389389 _Elem a[64];
390390 const double d = static_cast<double>(v);
--- trunk/include/iutest.hpp (revision 1440)
+++ trunk/include/iutest.hpp (revision 1441)
@@ -450,6 +450,17 @@
450450
451451 /**
452452 * @ingroup IUTEST_ASSERT_
453+ * @brief float の比較 テスト
454+ * @param expected = 期待値
455+ * @param actual = 検査対象
456+*/
457+#ifndef IUTEST_ASSERT_COMPLEX_EQ
458+# define IUTEST_ASSERT_COMPLEX_EQ(expected, actual) \
459+ IUTEST_TEST_COMPLEX_EQ(expected, actual, IUTEST_ASSERT_FAILURE)
460+#endif
461+
462+/**
463+ * @ingroup IUTEST_ASSERT_
453464 * @brief 2値の差の範囲 テスト
454465 * @param v1 = 値1
455466 * @param v2 = 値2
@@ -850,6 +861,17 @@
850861
851862 /**
852863 * @ingroup IUTEST_EXPECT_
864+ * @brief std::complex の比較 テスト
865+ * @param expected = 期待値
866+ * @param actual = 検査対象
867+*/
868+#ifndef IUTEST_EXPECT_COMPLEX_EQ
869+# define IUTEST_EXPECT_COMPLEX_EQ(expected, actual) \
870+ IUTEST_TEST_COMPLEX_EQ(expected, actual, IUTEST_EXPECT_FAILURE)
871+#endif
872+
873+/**
874+ * @ingroup IUTEST_EXPECT_
853875 * @brief 2値の差の範囲 テスト
854876 * @param v1 = 値1
855877 * @param v2 = 値2
@@ -1257,6 +1279,16 @@
12571279 IUTEST_TEST_LONG_DOUBLE_EQ(expected, actual, IUTEST_INFORM_FAILURE)
12581280 #endif
12591281 #endif
1282+/**
1283+ * @ingroup IUTEST_INFORM_
1284+ * @brief float の比較 テスト
1285+ * @param expected = 期待値
1286+ * @param actual = 検査対象
1287+*/
1288+#ifndef IUTEST_INFORM_COMPLEX_EQ
1289+# define IUTEST_INFORM_COMPLEX_EQ(expected, actual) \
1290+ IUTEST_TEST_COMPLEX_EQ(expected, actual, IUTEST_INFORM_FAILURE)
1291+#endif
12601292
12611293 /**
12621294 * @ingroup IUTEST_INFORM_
@@ -1652,6 +1684,17 @@
16521684
16531685 /**
16541686 * @ingroup IUTEST_ASSUME_
1687+ * @brief float の比較 テスト
1688+ * @param expected = 期待値
1689+ * @param actual = 検査対象
1690+*/
1691+#ifndef IUTEST_ASSUME_COMPLEX_EQ
1692+# define IUTEST_ASSUME_COMPLEX_EQ(expected, actual) \
1693+ IUTEST_TEST_COMPLEX_EQ(expected, actual, IUTEST_ASSUME_FAILURE)
1694+#endif
1695+
1696+/**
1697+ * @ingroup IUTEST_ASSUME_
16551698 * @brief 2値の差の範囲 テスト
16561699 * @param v1 = 値1
16571700 * @param v2 = 値2
--- trunk/include/iutest_assertion.hpp (revision 1440)
+++ trunk/include/iutest_assertion.hpp (revision 1441)
@@ -6,7 +6,7 @@
66 *
77 * @author t.shirayanagi
88 * @par copyright
9- * Copyright (C) 2011-2020, Takazumi Shirayanagi\n
9+ * Copyright (C) 2011-2021, Takazumi Shirayanagi\n
1010 * This software is released under the new BSD License,
1111 * see LICENSE
1212 */
@@ -719,6 +719,43 @@
719719 , detail::ShowStringQuoted(FormatForComparisonFailureMessage(f2, f1)));
720720 }
721721
722+template<typename RawType>
723+inline AssertionResult CmpHelperFloatingPointComplexEQ(const char* expr1, const char* expr2
724+ , const ::std::complex<RawType>& val1, const ::std::complex<RawType>& val2)
725+{
726+ floating_point<RawType> real1(val1.real()), real2(val2.real());
727+ floating_point<RawType> imag1(val1.imag()), imag2(val2.imag());
728+ if IUTEST_COND_LIKELY( real1.AlmostEquals(real2) && imag1.AlmostEquals(imag2) )
729+ {
730+ return AssertionSuccess();
731+ }
732+ return EqFailure(expr1, expr2
733+ , detail::ShowStringQuoted(FormatForComparisonFailureMessage(val1, val2))
734+ , detail::ShowStringQuoted(FormatForComparisonFailureMessage(val2, val1)));
735+}
736+
737+template<typename R1, typename R2>
738+inline AssertionResult CmpHelperFloatingPointComplexEQ(const char* expr1, const char* expr2
739+ , const ::std::complex<R1>& val1, const ::std::complex<R2>& val2)
740+{
741+ typedef typename detail::conditional<(sizeof(R1) > sizeof(R2)), R1, R2>::type RawType;
742+ return CmpHelperFloatingPointComplexEQ<RawType>(expr1, expr2, ::std::complex<RawType>(val1), ::std::complex<RawType>(val2));
743+}
744+
745+template<typename R1, typename R2>
746+inline AssertionResult CmpHelperFloatingPointComplexEQ(const char* expr1, const char* expr2
747+ , R1 val1, const ::std::complex<R2>& val2)
748+{
749+ return CmpHelperFloatingPointComplexEQ(expr1, expr2, ::std::complex<R2>(val1, R2()), val2);
750+}
751+template<typename R1, typename R2>
752+inline AssertionResult CmpHelperFloatingPointComplexEQ(const char* expr1, const char* expr2
753+ , const ::std::complex<R1>& val1, R2 val2)
754+{
755+ return CmpHelperFloatingPointComplexEQ(expr1, expr2, val1, ::std::complex<R1>(val2, R1()));
756+}
757+
758+
722759 /**
723760 * @brief backward
724761 */
@@ -803,22 +840,45 @@
803840 template<bool IsNullLiteral>
804841 class AlmostEqHelper : public EqHelper<false>
805842 {
843+ struct CmpHelper
844+ {
845+ template<typename T1, typename T2>
846+ static AssertionResult Compare(const char* expr1, const char* expr2, const T1& val1, const T2& val2)
847+ {
848+ return EqHelper<false>::Compare(expr1, expr2, val1, static_cast<T1>(val2));
849+ }
850+ template<typename T>
851+ static AssertionResult Compare(const char* expr1, const char* expr2, const float& val1, const T& val2)
852+ {
853+ return CmpHelperFloatingPointEQ<float>(expr1, expr2, val1, static_cast<float>(val2));
854+ }
855+ template<typename T>
856+ static AssertionResult Compare(const char* expr1, const char* expr2, const double& val1, const T& val2)
857+ {
858+ return CmpHelperFloatingPointEQ<double>(expr1, expr2, val1, static_cast<double>(val2));
859+ }
860+ };
806861 public:
807862 template<typename T1, typename T2>
808863 static AssertionResult Compare(const char* expr1, const char* expr2, const T1& val1, const T2& val2)
809864 {
810- return EqHelper<false>::Compare(expr1, expr2, val1, static_cast<T1>(val2));
865+ return CmpHelper::Compare(expr1, expr2, val1, val2);
811866 }
812- template<typename T>
813- static AssertionResult Compare(const char* expr1, const char* expr2, const float& val1, const T& val2)
867+ template<typename T, typename U>
868+ static AssertionResult Compare(const char* expr1, const char* expr2, const ::std::complex<T>& val1, const ::std::complex<U>& val2)
814869 {
815- return CmpHelperFloatingPointEQ<float>(expr1, expr2, val1, static_cast<float>(val2));
870+ return CmpHelperFloatingPointComplexEQ(expr1, expr2, val1, val2);
816871 }
817- template<typename T>
818- static AssertionResult Compare(const char* expr1, const char* expr2, const double& val1, const T& val2)
872+ template<typename T, typename U>
873+ static AssertionResult Compare(const char* expr1, const char* expr2, const T& val1, const ::std::complex<U>& val2)
819874 {
820- return CmpHelperFloatingPointEQ<double>(expr1, expr2, val1, static_cast<double>(val2));
875+ return CmpHelperFloatingPointComplexEQ(expr1, expr2, val1, val2);
821876 }
877+ template<typename T, typename U>
878+ static AssertionResult Compare(const char* expr1, const char* expr2, const ::std::complex<T>& val1, const U& val2)
879+ {
880+ return CmpHelperFloatingPointComplexEQ(expr1, expr2, val1, val2);
881+ }
822882 };
823883
824884 /**
--- trunk/include/iutest_defs.hpp (revision 1440)
+++ trunk/include/iutest_defs.hpp (revision 1441)
@@ -469,7 +469,7 @@
469469
470470 // googletest compat
471471
472-namespace detail
472+namespace internal
473473 {
474474
475475 template<typename T>
@@ -489,7 +489,7 @@
489489 typedef FloatingPoint<__float128> Float128;
490490 #endif
491491
492-} // end of namespace detail
492+} // end of namespace internal
493493
494494 //======================================================================
495495 // typedef
--- trunk/include/iutest_printers.hpp (revision 1440)
+++ trunk/include/iutest_printers.hpp (revision 1441)
@@ -370,7 +370,7 @@
370370 PrintToFloatingPoint(f, os);
371371 }
372372 template<typename T>
373-inline void PrintTo(const FloatingPoint<T>& f, iu_ostream* os)
373+inline void PrintTo(const internal::FloatingPoint<T>& f, iu_ostream* os)
374374 {
375375 PrintToFloatingPoint(f, os);
376376 }
@@ -412,7 +412,7 @@
412412 }
413413
414414 // NOTE: need libquadmath
415-inline void PrintTo(const detail::Float128::Float v, iu_ostream* os)
415+inline void PrintTo(const internal::Float128::Float v, iu_ostream* os)
416416 {
417417 PrintToFloat128(v, os);
418418 }
--- trunk/include/iutest_ver.hpp (revision 1440)
+++ trunk/include/iutest_ver.hpp (revision 1441)
@@ -17,11 +17,11 @@
1717
1818 //======================================================================
1919 // define
20-#define IUTEST_VER 0x01179910u //!< iutest version 1.17.99.10
20+#define IUTEST_VER 0x01179911u //!< iutest version 1.17.99.11
2121 #define IUTEST_MAJORVER 0x01u //!< Major Version
2222 #define IUTEST_MINORVER 0x17u //!< Minor Version
2323 #define IUTEST_MICROVER 0x99u //!< Micro Version
24-#define IUTEST_REVISION 0x10u //!< Revision
24+#define IUTEST_REVISION 0x11u //!< Revision
2525
2626 #define IUTEST_BUILD IUTEST_MICROVER //!< @deprecated
2727
@@ -123,6 +123,8 @@
123123 <ul>
124124 <li>v1.18.0.0
125125 <ul>
126+ <li>IUTEST_*_COMPLEX_EQ アサーションを追加</li>
127+ <li>IUTEST_*_ALMOST_EQ が ::std::complex に対応</li>
126128 <li>TestCase の別名 TestSuite に対応(iutest はどちらもサポートし続けます)</li>
127129 <li>例外発生時にも SCOPED_TRACE のメッセージを出力するように変更</li>
128130 <li>空のテストスイート名・テスト名に static_assert を追加</li>
--- trunk/include/util/iutest_util_assertion.hpp (revision 1440)
+++ trunk/include/util/iutest_util_assertion.hpp (revision 1441)
@@ -914,13 +914,13 @@
914914 {
915915
916916 template<typename T>
917-::iutest::detail::FloatingPoint<float> CastToFloatingPoint(const T& x)
917+::iutest::internal::FloatingPoint<float> CastToFloatingPoint(const T& x)
918918 {
919- return ::iutest::detail::FloatingPoint<float>(static_cast<float>(x));
919+ return ::iutest::internal::FloatingPoint<float>(static_cast<float>(x));
920920 }
921-inline ::iutest::detail::FloatingPoint<double> CastToFloatingPoint(const double& x)
921+inline ::iutest::internal::FloatingPoint<double> CastToFloatingPoint(const double& x)
922922 {
923- return ::iutest::detail::FloatingPoint<double>(x);
923+ return ::iutest::internal::FloatingPoint<double>(x);
924924 }
925925
926926 } // end of namespace floationg_point_helper
--- trunk/include/util/iutest_util_no_yoda.hpp (revision 1440)
+++ trunk/include/util/iutest_util_no_yoda.hpp (revision 1441)
@@ -6,7 +6,7 @@
66 *
77 * @author t.shirayanagi
88 * @par copyright
9- * Copyright (C) 2015-2018, Takazumi Shirayanagi\n
9+ * Copyright (C) 2015-2021, Takazumi Shirayanagi\n
1010 * This software is released under the new BSD License,
1111 * see LICENSE
1212 */
@@ -85,6 +85,23 @@
8585 # define IUTEST_ASSUME_LONG_DOUBLE_EQ(actual, expected) IUTEST_TEST_LONG_DOUBLE_EQ(expected, actual, IUTEST_ASSUME_FAILURE)
8686 #endif
8787
88+#ifdef IUTEST_ASSERT_COMPLEX_EQ
89+# undef IUTEST_ASSERT_COMPLEX_EQ
90+# define IUTEST_ASSERT_COMPLEX_EQ(actual, expected) IUTEST_TEST_COMPLEX_EQ(expected, actual, IUTEST_ASSERT_FAILURE)
91+#endif
92+#ifdef IUTEST_EXPECT_COMPLEX_EQ
93+# undef IUTEST_EXPECT_COMPLEX_EQ
94+# define IUTEST_EXPECT_COMPLEX_EQ(actual, expected) IUTEST_TEST_COMPLEX_EQ(expected, actual, IUTEST_EXPECT_FAILURE)
95+#endif
96+#ifdef IUTEST_INFORM_COMPLEX_EQ
97+# undef IUTEST_INFORM_COMPLEX_EQ
98+# define IUTEST_INFORM_COMPLEX_EQ(actual, expected) IUTEST_TEST_COMPLEX_EQ(expected, actual, IUTEST_INFORM_FAILURE)
99+#endif
100+#ifdef IUTEST_ASSUME_COMPLEX_EQ
101+# undef IUTEST_ASSUME_COMPLEX_EQ
102+# define IUTEST_ASSUME_COMPLEX_EQ(actual, expected) IUTEST_TEST_COMPLEX_EQ(expected, actual, IUTEST_ASSUME_FAILURE)
103+#endif
104+
88105 #ifdef IUTEST_ASSERT_STREQ
89106 # undef IUTEST_ASSERT_STREQ
90107 # define IUTEST_ASSERT_STREQ(actual, expected) IUTEST_TEST_STREQ(expected, actual, IUTEST_ASSERT_FAILURE)
--- trunk/test/assertion_tests.cpp (revision 1440)
+++ trunk/test/assertion_tests.cpp (revision 1441)
@@ -6,7 +6,7 @@
66 *
77 * @author t.shirayanagi
88 * @par copyright
9- * Copyright (C) 2012-2016, Takazumi Shirayanagi\n
9+ * Copyright (C) 2012-2021, Takazumi Shirayanagi\n
1010 * This software is released under the new BSD License,
1111 * see LICENSE
1212 */
@@ -227,6 +227,18 @@
227227
228228 #endif
229229
230+IUTEST(AssertionTest, Complex)
231+{
232+ ::std::complex<float> cf0(0.0f, 2.0f);
233+ ::std::complex<float> cf1(1.0f, 0.0f);
234+ ::std::complex<double> cd1(1.0, 0.0);
235+ IUTEST_ASSERT_COMPLEX_EQ(::std::complex<float>(1.0f, 0.0f), cf1);
236+ IUTEST_EXPECT_COMPLEX_EQ(::std::complex<float>(0.0f, 2.0f), cf0);
237+ IUTEST_INFORM_COMPLEX_EQ(1.0f, cf1);
238+ IUTEST_INFORM_COMPLEX_EQ(cf1, 1.0f);
239+ IUTEST_INFORM_COMPLEX_EQ(cf1, cd1);
240+}
241+
230242 IUTEST(AssertionTest, Near)
231243 {
232244 IUTEST_ASSERT_NEAR(0, 1, 1.5);
--- trunk/test/filepath_tests.cpp (revision 1440)
+++ trunk/test/filepath_tests.cpp (revision 1441)
@@ -143,6 +143,7 @@
143143 }
144144 }
145145
146+#if !defined(IUTEST_USE_GTEST)
146147 IUTEST(FilePath, GetExtention)
147148 {
148149 {
@@ -158,6 +159,7 @@
158159 IUTEST_EXPECT_EQ(".txt", path.GetExtension());
159160 }
160161 }
162+#endif
161163
162164 IUTEST(FilePath, RemoveExtension)
163165 {
--- trunk/test/no_yoda_tests.cpp (revision 1440)
+++ trunk/test/no_yoda_tests.cpp (revision 1441)
@@ -6,7 +6,7 @@
66 *
77 * @author t.shirayanagi
88 * @par copyright
9- * Copyright (C) 2015-2016, Takazumi Shirayanagi\n
9+ * Copyright (C) 2015-2021, Takazumi Shirayanagi\n
1010 * This software is released under the new BSD License,
1111 * see LICENSE
1212 */
@@ -32,6 +32,10 @@
3232 int ga = 0;
3333 float gf = 0.0f;
3434 double gd = 0.0;
35+#if IUTEST_HAS_LONG_DOUBLE
36+long double gl = 0.0l;
37+#endif
38+::std::complex<float> gc(1.0f, 1.0f);
3539 char gx[] = "Hoge";
3640 char gy[] = "Test";
3741
@@ -53,6 +57,22 @@
5357 IUTEST_ASSERT_NONFATAL_FAILURE( IUTEST_EXPECT_DOUBLE_EQ(gd, 1.0), "Expected: 1.0" );
5458 }
5559
60+#if IUTEST_HAS_LONG_DOUBLE
61+
62+IUTEST(NoYodaTest, LongDoubleEq)
63+{
64+ IUTEST_ASSERT_FATAL_FAILURE ( IUTEST_ASSERT_LONG_DOUBLE_EQ(gl, 1.0l), "Expected: 1.0" );
65+ IUTEST_ASSERT_NONFATAL_FAILURE( IUTEST_EXPECT_LONG_DOUBLE_EQ(gl, 1.0l), "Expected: 1.0" );
66+}
67+
68+#endif
69+
70+IUTEST(NoYodaTest, ComplexEq)
71+{
72+ IUTEST_ASSERT_FATAL_FAILURE ( IUTEST_ASSERT_COMPLEX_EQ(gc, 1.0f), "Expected: 1.0" );
73+ IUTEST_ASSERT_NONFATAL_FAILURE( IUTEST_EXPECT_COMPLEX_EQ(gc, 1.0f), "Expected: 1.0" );
74+}
75+
5676 IUTEST(NoYodaTest, StrEq)
5777 {
5878 IUTEST_ASSERT_FATAL_FAILURE ( IUTEST_ASSERT_STREQ(gx, "hoge"), "Expected: \"hoge\"" );
--- trunk/test/printers_tests.cpp (revision 1440)
+++ trunk/test/printers_tests.cpp (revision 1441)
@@ -32,8 +32,9 @@
3232 (void)(expect); \
3333 (void)(val)
3434
35-// unused
36-// #define IUTEST_PRINTTOSTRING_CONTAIN(expect, val)
35+#define IUTEST_PRINTTOSTRING_CONTAIN(expect, val) \
36+ (void)(expect); \
37+ (void)(val)
3738
3839 #endif
3940
@@ -93,7 +94,7 @@
9394 IUTEST(PrintToTest, FloatingPoint)
9495 {
9596 ::iutest::floating_point<float> f = 1.0f;
96- ::iutest::detail::FloatingPoint<float> F(1.0f);
97+ ::iutest::internal::FloatingPoint<float> F(1.0f);
9798 IUTEST_ASSERT_STREQ(::iutest::PrintToString(f), ::iutest::PrintToString(F));
9899 }
99100
@@ -124,7 +125,7 @@
124125 #if IUTEST_HAS_LONG_DOUBLE
125126 IUTEST(PrintToTest, LongDouble)
126127 {
127- ::iutest::detail::LongDouble ld(static_cast< ::iutest::detail::LongDouble::Float>(1.0f));
128+ ::iutest::internal::LongDouble ld(static_cast< ::iutest::internal::LongDouble::Float>(1.0f));
128129 LogChecker ck("1");
129130 IUTEST_PRINTTOSTRING_CONTAIN(ck, ld);
130131 IUTEST_STREAMOUT_CHECK(ld);
@@ -134,7 +135,7 @@
134135 #if IUTEST_HAS_FLOAT128
135136 IUTEST(PrintToTest, Float128)
136137 {
137- ::iutest::detail::Float128 f128(static_cast< ::iutest::detail::Float128::Float>(1.0f));
138+ ::iutest::internal::Float128 f128(static_cast< ::iutest::internal::Float128::Float>(1.0f));
138139 LogChecker ck("1");
139140 IUTEST_PRINTTOSTRING_CONTAIN(ck, f128);
140141 IUTEST_STREAMOUT_CHECK(f128);
--- trunk/test/spi_tests_decl.cpp (revision 1440)
+++ trunk/test/spi_tests_decl.cpp (revision 1441)
@@ -62,6 +62,7 @@
6262 FAILURE_MACRO( FLAVOR(_LONG_DOUBLE_EQ)(Div(0.0l, lda), Div(0.0l, lda)), "(0x" );
6363 // FAILURE_MACRO( FLAVOR(_PRED_FORMAT2)(::iutest::LongDoubleLE, 2, 0), "(0x" );
6464 #endif
65+ FAILURE_MACRO( FLAVOR(_COMPLEX_EQ)(::std::complex<float>(1.0f, 1.0f), 1.0f), "" );
6566 FAILURE_MACRO( FLAVOR(_NEAR)(0, 100, 2), "" );
6667
6768 FAILURE_MACRO( FLAVOR(_STREQ)("A", "a"), "" );
--- trunk/test/syntax_gtest_tests.cpp (revision 1440)
+++ trunk/test/syntax_gtest_tests.cpp (revision 1441)
@@ -204,6 +204,35 @@
204204 ASSUME_DOUBLE_EQ(1.0, d) << d;
205205 }
206206
207+#if IUTEST_HAS_LONG_DOUBLE
208+
209+TEST(SyntaxTest, LongDouble)
210+{
211+ if( long double d = 1.0l )
212+ ASSERT_LONG_DOUBLE_EQ(1.0l, d) << d;
213+ if( long double d = 1.0l )
214+ EXPECT_LONG_DOUBLE_EQ(1.0l, d) << d;
215+ if( long double d = 1.0l )
216+ INFORM_LONG_DOUBLE_EQ(1.0l, d) << d;
217+ if( long double d = 1.0l )
218+ ASSUME_LONG_DOUBLE_EQ(1.0l, d) << d;
219+}
220+
221+#endif
222+
223+TEST(SyntaxTest, Complex)
224+{
225+ ::std::complex<float> c(1.0f, 1.0f);
226+ if( float d = 1.0f )
227+ ASSERT_COMPLEX_EQ(::std::complex<float>(d, d), c) << c;
228+ if( float d = 1.0f )
229+ EXPECT_COMPLEX_EQ(::std::complex<float>(d, d), c) << c;
230+ if( float d = 1.0f )
231+ INFORM_COMPLEX_EQ(::std::complex<float>(d, d), c) << c;
232+ if( float d = 1.0f )
233+ ASSUME_COMPLEX_EQ(::std::complex<float>(d, d), c) << c;
234+}
235+
207236 TEST(GTestSyntaxTest, Near)
208237 {
209238 if( int x = 1 )
@@ -252,6 +281,35 @@
252281 ASSUME_ALMOST_EQ(1.0, x);
253282 }
254283
284+#if IUTEST_HAS_LONG_DOUBLE
285+
286+TEST(SyntaxTest, AlmostLongDoubleEq)
287+{
288+ if( long double x = 1.0l )
289+ ASSERT_ALMOST_EQ(1.0l, x);
290+ if( long double x = 1.0l )
291+ EXPECT_ALMOST_EQ(1.0l, x);
292+ if( long double x = 1.0l )
293+ INFORM_ALMOST_EQ(1.0l, x);
294+ if( long double x = 1.0l )
295+ ASSUME_ALMOST_EQ(1.0l, x);
296+}
297+
298+#endif
299+
300+TEST(SyntaxTest, AlmostComplexEq)
301+{
302+ ::std::complex<double> c(1.0, 0.0);
303+ if( double x = 1.0 )
304+ ASSERT_ALMOST_EQ(c, x);
305+ if( double x = 1.0 )
306+ EXPECT_ALMOST_EQ(x, c);
307+ if( double x = 1.0 )
308+ INFORM_ALMOST_EQ(::std::complex<double>(x, x), c);
309+ if( double x = 1.0 )
310+ ASSUME_ALMOST_EQ(c, ::std::complex<double>(x, x));
311+}
312+
255313 TEST(GTestSyntaxTest, Null)
256314 {
257315 int* p = NULL;
--- trunk/test/syntax_tests.cpp (revision 1440)
+++ trunk/test/syntax_tests.cpp (revision 1441)
@@ -246,6 +246,35 @@
246246 IUTEST_ASSUME_DOUBLE_EQ(1.0, d) << d;
247247 }
248248
249+#if IUTEST_HAS_LONG_DOUBLE
250+
251+IUTEST(SyntaxTest, LongDouble)
252+{
253+ if( long double d = 1.0l )
254+ IUTEST_ASSERT_LONG_DOUBLE_EQ(1.0l, d) << d;
255+ if( long double d = 1.0l )
256+ IUTEST_EXPECT_LONG_DOUBLE_EQ(1.0l, d) << d;
257+ if( long double d = 1.0l )
258+ IUTEST_INFORM_LONG_DOUBLE_EQ(1.0l, d) << d;
259+ if( long double d = 1.0l )
260+ IUTEST_ASSUME_LONG_DOUBLE_EQ(1.0l, d) << d;
261+}
262+
263+#endif
264+
265+IUTEST(SyntaxTest, Complex)
266+{
267+ ::std::complex<float> c(1.0f, 1.0f);
268+ if( float d = 1.0 )
269+ IUTEST_ASSERT_COMPLEX_EQ(::std::complex<float>(d, d), c) << c;
270+ if( float d = 1.0 )
271+ IUTEST_EXPECT_COMPLEX_EQ(::std::complex<float>(d, d), c) << c;
272+ if( float d = 1.0 )
273+ IUTEST_INFORM_COMPLEX_EQ(::std::complex<float>(d, d), c) << c;
274+ if( float d = 1.0 )
275+ IUTEST_ASSUME_COMPLEX_EQ(::std::complex<float>(d, d), c) << c;
276+}
277+
249278 IUTEST(SyntaxTest, Near)
250279 {
251280 if( int x = 1 )
@@ -294,6 +323,35 @@
294323 IUTEST_ASSUME_ALMOST_EQ(1.0, x);
295324 }
296325
326+#if IUTEST_HAS_LONG_DOUBLE
327+
328+IUTEST(SyntaxTest, AlmostLongDoubleEq)
329+{
330+ if( long double x = 1.0l )
331+ IUTEST_ASSERT_ALMOST_EQ(1.0l, x);
332+ if( long double x = 1.0l )
333+ IUTEST_EXPECT_ALMOST_EQ(1.0l, x);
334+ if( long double x = 1.0l )
335+ IUTEST_INFORM_ALMOST_EQ(1.0l, x);
336+ if( long double x = 1.0l )
337+ IUTEST_ASSUME_ALMOST_EQ(1.0l, x);
338+}
339+
340+#endif
341+
342+IUTEST(SyntaxTest, AlmostComplexEq)
343+{
344+ ::std::complex<double> c(1.0, 0.0);
345+ if( double x = 1.0 )
346+ IUTEST_ASSERT_ALMOST_EQ(c, x);
347+ if( double x = 1.0 )
348+ IUTEST_EXPECT_ALMOST_EQ(x, c);
349+ if( double x = 1.0 )
350+ IUTEST_INFORM_ALMOST_EQ(::std::complex<double>(x, x), c);
351+ if( double x = 1.0 )
352+ IUTEST_ASSUME_ALMOST_EQ(c, ::std::complex<double>(x, x));
353+}
354+
297355 IUTEST(SyntaxTest, Null)
298356 {
299357 int* p = NULL;
Show on old repository browser