• R/O
  • SSH
  • HTTPS

iutest: Commit


Commit MetaInfo

Revision1342 (tree)
Time2018-09-13 21:54:44
Authorsrz_zumix

Log Message

Merge remote-tracking branch 'origin/develop'

git@5bdec5eaf9670ca649b46c1aa3a2387238a911a2
https://github.com/srz-zumix/iutest/commit/5bdec5eaf9670ca649b46c1aa3a2387238a911a2

Change Summary

Incremental Difference

--- trunk/.travis.yml (revision 1341)
+++ trunk/.travis.yml (revision 1342)
@@ -24,6 +24,9 @@
2424 - python .ci/travisci/travis_blocking_stdout.py
2525 #- apt-cache search clang || true
2626 #- apt-cache search gcc || true
27+ # compiler predefined specific
28+ - if [[ "${COMPILER_CC}" != "" ]]; then export CC=${COMPILER_CC}; fi
29+ - if [[ "${COMPILER_CXX}" != "" ]]; then export CXX=${COMPILER_CXX}; fi
2730 # g++
2831 - |
2932 if [ "${CXX}" = 'g++' ] && [ "${HOST}" != 'WINE' ] && [ "${USE_COVERAGE}" != 'lcov' ]; then
@@ -44,12 +47,7 @@
4447 #update-alternatives --install /usr/bin/clang clang /usr/bin/clang-7 90
4548 #update-alternatives --install /usr/bin/clang++ clang++ /usr/bin/clang++-7 90
4649 fi
47- # mingw
48- - if [ "${MINGW}" = '1' ]; then export CXX=i686-w64-mingw32-g++; fi
49- # winegcc
50- - if [ "${WINEGCC}" = '1' ]; then export CXX=wineg++; fi
5150
52-
5351 install:
5452 # gcov/lcov
5553 - |
@@ -198,7 +196,10 @@
198196 - google-mock
199197 # MinGW
200198 # - compiler: gcc
201- # env: MINGW=1 HOST=WINE DEFS="-DIUTEST_HAS_STREAM_BUFFER=0"
199+ # env:
200+ # - MINGW=1 HOST=WINE DEFS="-DIUTEST_HAS_STREAM_BUFFER=0"
201+ # - COMPILER_CC=i686-w64-mingw32-gcc
202+ # - COMPILER_CXX=i686-w64-mingw32-g++
202203 # addons:
203204 # apt:
204205 # sources:
@@ -217,10 +218,19 @@
217218 # env: USE_LIB=1
218219 #- compiler: gcc
219220 # env: CPPCHECK=1
221+ - os: osx
222+ env: OSX=1 STDFLAG=-std=c++11
220223 - compiler: gcc
221- env: COVERITY_SCAN=1
224+ env:
225+ - COVERITY_SCAN=1
226+ - COMPILER_CC=gcc-7
227+ - COMPILER_CXX=g++-7
222228 addons:
223- apt: *apt-global
229+ apt:
230+ sources: *apt-common-sources
231+ packages:
232+ - gcc-7
233+ - g++-7
224234 coverity_scan:
225235 project:
226236 name: "srz-zumix/iutest"
@@ -227,10 +237,8 @@
227237 description: "iutest c++ testing framework"
228238 notification_email: zumix.cpp@gmail.com
229239 build_command_prepend: "cov-configure --comptype gcc --compiler gcc-7 --template && cd ./test"
230- build_command: make coverity_scan STDFLAG=-std=c++1z
231- branch_pattern: master
232- - os: osx
233- env: OSX=1 STDFLAG=-std=c++11
240+ build_command: make -j4 coverity_scan STDFLAG=-std=c++17
241+ branch_pattern: master|.*coverity_scan.*
234242 # Sanitize
235243 #- compiler: clang
236244 # env:
--- trunk/CHANGES.md (revision 1341)
+++ trunk/CHANGES.md (revision 1342)
@@ -2,6 +2,20 @@
22
33 --------------------------------------------------
44
5+## Changes for 1.16.6
6+
7+* Improved
8+ * long double に対応
9+
10+* Changes
11+ * iuwandbox: -D__WANDBOX__ コンパイラーオプションを必ずつけるように変更
12+
13+* Bug fixes
14+ * iuwandbox: dryrun オプションが失敗を返す問題を修正
15+ * いくつかのコンパイラー警告を修正
16+
17+--------------------------------------------------
18+
519 ## Changes for 1.16.5
620
721 * Improved
--- trunk/appveyor.yml (revision 1341)
+++ trunk/appveyor.yml (revision 1342)
@@ -12,8 +12,16 @@
1212 CMAKE_GENERATOR_NAME: Visual Studio 15 2017
1313 - BUILD_CYGWIN: yes
1414 USE_GNU_EXTENSION: 0
15+ CYGWIN_PATH: C:\cygwin
16+ CYGWIN_SETUP_EXE: setup-x86.exe
1517 - BUILD_CYGWIN: yes
1618 USE_GNU_EXTENSION: 1
19+ CYGWIN_PATH: C:\cygwin
20+ CYGWIN_SETUP_EXE: setup-x86.exe
21+ - BUILD_CYGWIN: yes
22+ USE_GNU_EXTENSION: 1
23+ CYGWIN_PATH: C:\cygwin64
24+ CYGWIN_SETUP_EXE: setup-x86_64.exe
1725 - BUILD_MINGW: yes
1826 MINGW_PATH: C:\mingw-w64\x86_64-6.3.0-posix-seh-rt_v5-rev1\mingw64\bin
1927 #MINGW_PATH: C:\mingw-w64\x86_64-7.2.0-posix-seh-rt_v5-rev1
@@ -90,8 +98,8 @@
9098 BUILD_CYGWIN: yes
9199 install:
92100 cmd: |
93- c:\cygwin\setup-x86.exe -qnNdO -R C:/cygwin -s http://cygwin.mirror.constant.com -l C:/cygwin/var/cache/setup -P make -P clang
94- SET PATH=%PATH%;c:\cygwin\bin
101+ %CYGWIN_PATH%\%CYGWIN_SETUP_EXE% -qnNdO -R %CYGWIN_PATH% -s http://cygwin.mirror.constant.com -l %CYGWIN_PATH%/var/cache/setup -P make -P clang
102+ SET PATH=%PATH%;%CYGWIN_PATH%\bin
95103 before_build:
96104 cmd: echo.
97105 build_script:
--- trunk/include/gtest/iutest_switch_for_gtest.hpp (revision 1341)
+++ trunk/include/gtest/iutest_switch_for_gtest.hpp (revision 1342)
@@ -121,6 +121,7 @@
121121 #undef IUTEST_HAS_RTTI
122122 #undef IUTEST_HAS_REGEX
123123 #undef IUTEST_HAS_SEH
124+#undef IUTEST_HAS_LONG_DOUBLE
124125
125126 #undef IUTEST_HAS_STREAM_BUFFER
126127
--- trunk/include/gtest/switch/iutest_switch_assert.hpp (revision 1341)
+++ trunk/include/gtest/switch/iutest_switch_assert.hpp (revision 1342)
@@ -80,6 +80,10 @@
8080 #define ASSERT_ANY_THROW IUTEST_ASSERT_ANY_THROW
8181 #define ASSERT_NO_FATAL_FAILURE IUTEST_ASSERT_NO_FATAL_FAILURE
8282
83+#if defined(IUTEST_ASSERT_LONG_DOUBLE_EQ)
84+# define ASSERT_LONG_DOUBLE_EQ IUTEST_ASSERT_LONG_DOUBLE_EQ
85+#endif
86+
8387 #ifdef IUTEST_OS_WINDOWS
8488 # define ASSERT_HRESULT_SUCCEEDED IUTEST_ASSERT_HRESULT_SUCCEEDED
8589 # define ASSERT_HRESULT_FAILED IUTEST_ASSERT_HRESULT_FAILED
--- trunk/include/gtest/switch/iutest_switch_assume.hpp (revision 1341)
+++ trunk/include/gtest/switch/iutest_switch_assume.hpp (revision 1342)
@@ -39,6 +39,10 @@
3939 #define ASSUME_ANY_THROW IUTEST_ASSUME_ANY_THROW
4040 #define ASSUME_NO_FATAL_FAILURE IUTEST_ASSUME_NO_FATAL_FAILURE
4141
42+#if defined(IUTEST_ASSUME_LONG_DOUBLE_EQ)
43+#define ASSUME_LONG_DOUBLE_EQ IUTEST_ASSUME_LONG_DOUBLE_EQ
44+#endif
45+
4246 #ifdef IUTEST_OS_WINDOWS
4347 # define ASSUME_HRESULT_SUCCEEDED IUTEST_ASSUME_HRESULT_SUCCEEDED
4448 # define ASSUME_HRESULT_FAILED IUTEST_ASSUME_HRESULT_FAILED
--- trunk/include/gtest/switch/iutest_switch_expect.hpp (revision 1341)
+++ trunk/include/gtest/switch/iutest_switch_expect.hpp (revision 1342)
@@ -80,6 +80,10 @@
8080 #define EXPECT_ANY_THROW IUTEST_EXPECT_ANY_THROW
8181 #define EXPECT_NO_FATAL_FAILURE IUTEST_EXPECT_NO_FATAL_FAILURE
8282
83+#if defined(IUTEST_EXPECT_LONG_DOUBLE_EQ)
84+# define EXPECT_LONG_DOUBLE_EQ IUTEST_EXPECT_LONG_DOUBLE_EQ
85+#endif
86+
8387 #ifdef IUTEST_OS_WINDOWS
8488 # define EXPECT_HRESULT_SUCCEEDED IUTEST_EXPECT_HRESULT_SUCCEEDED
8589 # define EXPECT_HRESULT_FAILED IUTEST_EXPECT_HRESULT_FAILED
--- trunk/include/gtest/switch/iutest_switch_gmock.hpp (revision 1341)
+++ trunk/include/gtest/switch/iutest_switch_gmock.hpp (revision 1342)
@@ -130,6 +130,16 @@
130130 template<typename T>
131131 inline internal::EqMatcher<T> Equals(T x) { return Eq(x); }
132132
133+ template<typename T>
134+ inline internal::FloatingEqMatcher<T> FloatingPointEq(T rhs) {
135+ return internal::FloatingEqMatcher<T>(rhs, false);
136+ }
137+
138+ template<typename T>
139+ inline internal::FloatingEqMatcher<T> NanSensitiveFloatingPointEq(T rhs) {
140+ return internal::FloatingEqMatcher<T>(rhs, true);
141+ }
142+
133143 #if GMOCK_VER >= 0x01070000
134144 // gmock 1.7 later
135145 using ::testing::IsEmpty;
--- trunk/include/gtest/switch/iutest_switch_inform.hpp (revision 1341)
+++ trunk/include/gtest/switch/iutest_switch_inform.hpp (revision 1342)
@@ -39,6 +39,10 @@
3939 #define INFORM_ANY_THROW IUTEST_INFORM_ANY_THROW
4040 #define INFORM_NO_FATAL_FAILURE IUTEST_INFORM_NO_FATAL_FAILURE
4141
42+#if defined(IUTEST_INFORM_LONG_DOUBLE_EQ)
43+#define INFORM_LONG_DOUBLE_EQ IUTEST_INFORM_LONG_DOUBLE_EQ
44+#endif
45+
4246 #ifdef IUTEST_OS_WINDOWS
4347 # define INFORM_HRESULT_SUCCEEDED IUTEST_INFORM_HRESULT_SUCCEEDED
4448 # define INFORM_HRESULT_FAILED IUTEST_INFORM_HRESULT_FAILED
--- trunk/include/internal/iutest_compiler.hpp (revision 1341)
+++ trunk/include/internal/iutest_compiler.hpp (revision 1342)
@@ -880,6 +880,19 @@
880880 # include <typeinfo>
881881 #endif
882882
883+//! has 128bit type
884+#if !defined(IUTEST_HAS_INT128)
885+# if defined(__SIZEOF_INT128__) && __SIZEOF_INT128__ == 16
886+# define IUTEST_HAS_INT128 1
887+# elif defined(_MSC_VER) && defined(_M_X64)
888+# define IUTEST_HAS_INT128 1
889+# endif
890+#endif
891+
892+#if !defined(IUTEST_HAS_INT128)
893+# define IUTEST_HAS_INT128 0
894+#endif
895+
883896 //! explicit instantiation access checking
884897 #if !defined(IUTEST_EXPLICIT_INSTANTIATION_ACCESS_PRIVATE_MEMBER_FUNCTION)
885898 # if defined(_MSC_VER) && ((_MSC_VER < 1600) || (_MSC_VER == 1900))
--- trunk/include/internal/iutest_internal.hpp (revision 1341)
+++ trunk/include/internal/iutest_internal.hpp (revision 1342)
@@ -6,7 +6,7 @@
66 *
77 * @author t.shirayanagi
88 * @par copyright
9- * Copyright (C) 2011-2016, Takazumi Shirayanagi\n
9+ * Copyright (C) 2011-2018, Takazumi Shirayanagi\n
1010 * This software is released under the new BSD License,
1111 * see LICENSE
1212 */
@@ -505,6 +505,14 @@
505505 IUTEST_PRED_FORMAT2_( ::iutest::internal::CmpHelperFloatingPointEQ<double> \
506506 , expected, actual, on_failure )
507507
508+#if IUTEST_HAS_LONG_DOUBLE
509+
510+#define IUTEST_TEST_LONG_DOUBLE_EQ(expected, actual, on_failure) \
511+ IUTEST_PRED_FORMAT2_( ::iutest::internal::CmpHelperFloatingPointEQ<long double> \
512+ , expected, actual, on_failure )
513+
514+#endif
515+
508516 #define IUTEST_TEST_NEAR(v1, v2, abs_v, on_failure) \
509517 IUTEST_PRED_FORMAT3_( ::iutest::internal::CmpHelperNear \
510518 , v1, v2, abs_v, on_failure )
--- trunk/include/internal/iutest_option_message.hpp (revision 1341)
+++ trunk/include/internal/iutest_option_message.hpp (revision 1342)
@@ -119,6 +119,7 @@
119119 m (IUTEST_HAS_EXCEPTIONS); \
120120 m (IUTEST_HAS_GENRAND); \
121121 m (IUTEST_HAS_IGNORE_TEST); \
122+ m (IUTEST_HAS_LONG_DOUBLE); \
122123 m (IUTEST_HAS_LIB); \
123124 m (IUTEST_HAS_MATCHERS); \
124125 m (IUTEST_HAS_MATCHER_ALLOF_AND_ANYOF); \
@@ -200,6 +201,7 @@
200201 IIUT_SHOW_MACRO(IUTEST_HAS_IF_EXISTS);
201202 IIUT_SHOW_MACRO(IUTEST_HAS_INITIALIZER_LIST);
202203 IIUT_SHOW_MACRO(IUTEST_HAS_INLINE_VARIABLE);
204+ IIUT_SHOW_MACRO(IUTEST_HAS_INT128);
203205 IIUT_SHOW_MACRO(IUTEST_HAS_LAMBDA);
204206 IIUT_SHOW_MACRO(IUTEST_HAS_LAMBDA_STATEMENTS);
205207 IIUT_SHOW_MACRO(IUTEST_HAS_NOEXCEPT);
--- trunk/include/internal/iutest_stdlib.hpp (revision 1341)
+++ trunk/include/internal/iutest_stdlib.hpp (revision 1342)
@@ -6,7 +6,7 @@
66 *
77 * @author t.shirayanagi
88 * @par copyright
9- * Copyright (C) 2012-2017, Takazumi Shirayanagi\n
9+ * Copyright (C) 2012-2018, Takazumi Shirayanagi\n
1010 * This software is released under the new BSD License,
1111 * see LICENSE
1212 */
@@ -717,6 +717,21 @@
717717 #endif
718718 };
719719
720+/** type_fit_t<8> */
721+template<>
722+struct type_fit_t<16>
723+{
724+#if IUTEST_HAS_INT128
725+#if defined(_MSC_VER)
726+ typedef __int128 Int;
727+ typedef unsigned __int128 UInt;
728+#else
729+ typedef __int128_t Int;
730+ typedef __uint128_t UInt;
731+#endif
732+#endif
733+};
734+
720735 //======================================================================
721736 // function
722737 /**
--- trunk/include/iutest.hpp (revision 1341)
+++ trunk/include/iutest.hpp (revision 1342)
@@ -396,8 +396,20 @@
396396 # define IUTEST_ASSERT_DOUBLE_EQ(expected, actual) IUTEST_TEST_DOUBLE_EQ(expected, actual, IUTEST_ASSERT_FAILURE)
397397 #endif
398398
399+#if IUTEST_HAS_LONG_DOUBLE
399400 /**
400401 * @ingroup IUTEST_ASSERT_
402+ * @brief long double の比較 テスト
403+ * @param expected = 期待値
404+ * @param actual = 検査対象
405+*/
406+#ifndef IUTEST_ASSERT_LONG_DOUBLE_EQ
407+# define IUTEST_ASSERT_LONG_DOUBLE_EQ(expected, actual) IUTEST_TEST_LONG_DOUBLE_EQ(expected, actual, IUTEST_ASSERT_FAILURE)
408+#endif
409+#endif
410+
411+/**
412+ * @ingroup IUTEST_ASSERT_
401413 * @brief 2値の差の範囲 テスト
402414 * @param v1 = 値1
403415 * @param v2 = 値2
@@ -766,8 +778,20 @@
766778 # define IUTEST_EXPECT_DOUBLE_EQ(expected, actual) IUTEST_TEST_DOUBLE_EQ(expected, actual, IUTEST_EXPECT_FAILURE)
767779 #endif
768780
781+#if IUTEST_HAS_LONG_DOUBLE
769782 /**
770783 * @ingroup IUTEST_EXPECT_
784+ * @brief long double の比較 テスト
785+ * @param expected = 期待値
786+ * @param actual = 検査対象
787+*/
788+#ifndef IUTEST_EXPECT_LONG_DOUBLE_EQ
789+# define IUTEST_EXPECT_LONG_DOUBLE_EQ(expected, actual) IUTEST_TEST_LONG_DOUBLE_EQ(expected, actual, IUTEST_EXPECT_FAILURE)
790+#endif
791+#endif
792+
793+/**
794+ * @ingroup IUTEST_EXPECT_
771795 * @brief 2値の差の範囲 テスト
772796 * @param v1 = 値1
773797 * @param v2 = 値2
@@ -1146,8 +1170,20 @@
11461170 # define IUTEST_INFORM_DOUBLE_EQ(expected, actual) IUTEST_TEST_DOUBLE_EQ(expected, actual, IUTEST_INFORM_FAILURE)
11471171 #endif
11481172
1173+#if IUTEST_HAS_LONG_DOUBLE
11491174 /**
11501175 * @ingroup IUTEST_INFORM_
1176+ * @brief long double の比較 テスト
1177+ * @param expected = 期待値
1178+ * @param actual = 検査対象
1179+*/
1180+#ifndef IUTEST_INFORM_LONG_DOUBLE_EQ
1181+# define IUTEST_INFORM_LONG_DOUBLE_EQ(expected, actual) IUTEST_TEST_LONG_DOUBLE_EQ(expected, actual, IUTEST_INFORM_FAILURE)
1182+#endif
1183+#endif
1184+
1185+/**
1186+ * @ingroup IUTEST_INFORM_
11511187 * @brief 2値の差の範囲 テスト
11521188 * @param v1 = 値1
11531189 * @param v2 = 値2
@@ -1508,8 +1544,20 @@
15081544 # define IUTEST_ASSUME_DOUBLE_EQ(expected, actual) IUTEST_TEST_DOUBLE_EQ(expected, actual, IUTEST_ASSUME_FAILURE)
15091545 #endif
15101546
1547+#if IUTEST_HAS_LONG_DOUBLE
15111548 /**
15121549 * @ingroup IUTEST_ASSUME_
1550+ * @brief long double の比較 テスト
1551+ * @param expected = 期待値
1552+ * @param actual = 検査対象
1553+*/
1554+#ifndef IUTEST_ASSUME_LONG_DOUBLE_EQ
1555+# define IUTEST_ASSUME_LONG_DOUBLE_EQ(expected, actual) IUTEST_TEST_LONG_DOUBLE_EQ(expected, actual, IUTEST_ASSUME_FAILURE)
1556+#endif
1557+#endif
1558+
1559+/**
1560+ * @ingroup IUTEST_ASSUME_
15131561 * @brief 2値の差の範囲 テスト
15141562 * @param v1 = 値1
15151563 * @param v2 = 値2
--- trunk/include/iutest_config.hpp (revision 1341)
+++ trunk/include/iutest_config.hpp (revision 1342)
@@ -490,6 +490,18 @@
490490 # endif
491491 #endif
492492
493+#if !defined(IUTEST_HAS_LONG_DOUBLE)
494+# if IUTEST_HAS_INT128
495+# define IUTEST_HAS_LONG_DOUBLE 1
496+# elif defined(__SIZEOF_FLOAT128__) && (__SIZEOF_FLOAT128__ <= 8)
497+# define IUTEST_HAS_LONG_DOUBLE 1
498+# endif
499+#endif
500+
501+#if !defined(IUTEST_HAS_LONG_DOUBLE)
502+# define IUTEST_HAS_LONG_DOUBLE 0
503+#endif
504+
493505 /**
494506 * @}
495507 */
--- trunk/include/iutest_defs.hpp (revision 1341)
+++ trunk/include/iutest_defs.hpp (revision 1342)
@@ -110,6 +110,37 @@
110110 };
111111 };
112112
113+#if IUTEST_HAS_LONG_DOUBLE
114+
115+template<size_t N>
116+struct ieee754_bits_longdouble {};
117+
118+template<>
119+struct ieee754_bits_longdouble<8u>
120+{
121+ enum {
122+ EXP = 11
123+ , FRAC = 52
124+ };
125+};
126+
127+// 80bit 精度
128+template<>
129+struct ieee754_bits_longdouble<16u>
130+{
131+ enum {
132+ EXP = 15
133+ , FRAC = 64
134+ };
135+};
136+
137+template<>
138+struct ieee754_bits<long double> : ieee754_bits_longdouble<sizeof(long double)>
139+{
140+};
141+
142+#endif
143+
113144 } // end of namespace detail
114145
115146 /**
@@ -146,6 +177,7 @@
146177 */
147178 floating_point(RawType f) // NOLINT
148179 {
180+ m_v.uv = 0;
149181 m_v.fv = f;
150182 }
151183
@@ -176,8 +208,8 @@
176208 */
177209 bool NanSensitiveAlmostEquals(const _Myt& rhs) const
178210 {
179- const UInt v1 = norm(m_v.uv);
180- const UInt v2 = norm(rhs.m_v.uv);
211+ const UInt v1 = norm(bits());
212+ const UInt v2 = norm(rhs.bits());
181213 const UInt diff = (v1 > v2) ? v1 - v2 : v2 - v1;
182214 if( diff <= kMaxUlps )
183215 {
@@ -190,7 +222,7 @@
190222 /**
191223 * @brief ビット列の取得
192224 */
193- UInt bits() const { return m_v.uv; }
225+ UInt bits() const { return m_v.uv & kEnableBitMask; }
194226
195227 /**
196228 * @brief raw データの取得
@@ -289,10 +321,12 @@
289321 static const UInt kSignMask = static_cast<UInt>(1u) << (kEXP + kFRAC);
290322 static const UInt kExpMask = ((static_cast<UInt>(1u) << kEXP) - 1) << kFRAC;
291323 static const UInt kFracMask = (static_cast<UInt>(1u) << kFRAC) - 1;
324+ static const UInt kEnableBitMask = kSignMask | kExpMask | kFracMask;
292325 #else
293326 static const UInt kSignMask;
294327 static const UInt kExpMask;
295328 static const UInt kFracMask;
329+ static const UInt kEnableBitMask;
296330 #endif
297331
298332 private:
@@ -311,6 +345,9 @@
311345 template<typename T>
312346 const typename floating_point<T>::UInt floating_point<T>::kFracMask
313347 = ((static_cast<typename floating_point<T>::UInt>(1u) << floating_point<T>::kFRAC) - 1);
348+template<typename T>
349+const typename floating_point<T>::UInt floating_point<T>::kEnableBitMask
350+ = floating_point<T>::kSignMask | floating_point<T>::kExpMask | floating_point<T>::kFracMask;
314351
315352 #endif
316353
--- trunk/include/iutest_matcher.hpp (revision 1341)
+++ trunk/include/iutest_matcher.hpp (revision 1342)
@@ -1913,6 +1913,16 @@
19131913 }
19141914
19151915 /**
1916+ * @brief Make FloatingPoint Eq matcher
1917+ * @details argument は expected とおよそ等しい
1918+*/
1919+template<typename T>
1920+inline detail::FloatingPointEqMatcher<T> FloatingPointEq(T expected)
1921+{
1922+ return detail::FloatingPointEqMatcher<T>(expected);
1923+}
1924+
1925+/**
19161926 * @brief Make Float Eq matcher
19171927 * @details argument は expected とおよそ等しい
19181928 */
@@ -1930,7 +1940,30 @@
19301940 return detail::FloatingPointEqMatcher<double>(expected);
19311941 }
19321942
1943+#if IUTEST_HAS_LONG_DOUBLE
1944+
19331945 /**
1946+ * @brief Make Long Double Eq matcher
1947+ * @details argument は expected とおよそ等しい
1948+*/
1949+inline detail::FloatingPointEqMatcher<long double> LongDoubleEq(long double expected)
1950+{
1951+ return detail::FloatingPointEqMatcher<long double>(expected);
1952+}
1953+
1954+#endif
1955+
1956+/**
1957+ * @brief Make FloatingPoint Eq matcher
1958+ * @details argument は expected とおよそ等しい
1959+*/
1960+template<typename T>
1961+inline detail::NanSensitiveFloatingPointEqMatcher<T> NanSensitiveFloatingPointEq(T expected)
1962+{
1963+ return detail::NanSensitiveFloatingPointEqMatcher<T>(expected);
1964+}
1965+
1966+/**
19341967 * @brief Make NanSensitive Float Eq matcher
19351968 * @details argument は expected とおよそ等しい(NaN 同士は等しいとされる)
19361969 */
@@ -1948,7 +1981,20 @@
19481981 return detail::NanSensitiveFloatingPointEqMatcher<double>(expected);
19491982 }
19501983
1984+#if IUTEST_HAS_LONG_DOUBLE
1985+
19511986 /**
1987+ * @brief Make NanSensitive LongDouble Eq matcher
1988+ * @details argument は expected とおよそ等しい(NaN 同士は等しいとされる)
1989+*/
1990+inline detail::NanSensitiveFloatingPointEqMatcher<long double> NanSensitiveLongDoubleEq(long double expected)
1991+{
1992+ return detail::NanSensitiveFloatingPointEqMatcher<long double>(expected);
1993+}
1994+
1995+#endif
1996+
1997+/**
19521998 * @brief Make StrEq matcher
19531999 * @details argument == expected
19542000 */
--- trunk/include/iutest_ver.hpp (revision 1341)
+++ trunk/include/iutest_ver.hpp (revision 1342)
@@ -17,11 +17,11 @@
1717
1818 //======================================================================
1919 // define
20-#define IUTEST_VER 0x01160502u //!< iutest version 1.16.5.2
20+#define IUTEST_VER 0x01160504u //!< iutest version 1.16.5.4
2121 #define IUTEST_MAJORVER 0x01u //!< Major Version
2222 #define IUTEST_MINORVER 0x16u //!< Minor Version
2323 #define IUTEST_MICROVER 0x05u //!< Micro Version
24-#define IUTEST_REVISION 0x02u //!< Revision
24+#define IUTEST_REVISION 0x04u //!< Revision
2525
2626 #define IUTEST_BUILD IUTEST_MICROVER //!< @deprecated
2727
@@ -120,9 +120,12 @@
120120 * @page CHANGELOG 変更履歴
121121 * @par Changes
122122 <ul>
123- <li>v1.16.5.0
123+ <li>v1.16.6.0
124124 <ul>
125- <li></li>
125+ <li>long double に対応</li>
126+ <li>iuwandbox: -D__WANDBOX__ コンパイラーオプションを必ずつけるように変更</li>
127+ <li>iuwandbox: dryrun オプションが失敗を返す問題を修正</li>
128+ <li>Fixed: いくつかのコンパイラー警告を修正</li>
126129 </ul>
127130 </li>
128131 <li>v1.16.5.0
@@ -132,7 +135,6 @@
132135 <li>ad_hoc_testresult の取得関数名を ad_hoc_test_result に変更</li>
133136 <li>compatibility: iuutil に ad_hoc_testresult の取得関数を追加</li>
134137 <li>iuwandbox で std-cxx の指定をするとオプションチェックで失敗する不具合を修正</li>
135- <li></li>
136138 </ul>
137139 </li>
138140 <li>v1.16.4.0
--- trunk/include/util/iutest_util_assertion.hpp (revision 1341)
+++ trunk/include/util/iutest_util_assertion.hpp (revision 1342)
@@ -593,7 +593,7 @@
593593 /** @overload */
594594 template<typename T1, typename T2>
595595 ::iutest::AssertionResult IUTEST_ATTRIBUTE_UNUSED_ CmpHelperEqRange(const char* expected_expr, const char* actual_expr
596- , const ::std::initializer_list<T1>& expected, const T2& actual)
596+ , ::std::initializer_list<T1> expected, const T2& actual)
597597 {
598598 return detail::CmpHelperEqRange(expected_expr, actual_expr, expected.begin(), expected.end()
599599 , actual.begin(), actual.end());
@@ -601,7 +601,7 @@
601601 /** @overload */
602602 template<typename T1, typename T2, size_t SIZE2>
603603 ::iutest::AssertionResult IUTEST_ATTRIBUTE_UNUSED_ CmpHelperEqRange(const char* expected_expr, const char* actual_expr
604- , const ::std::initializer_list<T1>& expected, T2(&actual)[SIZE2])
604+ , ::std::initializer_list<T1> expected, T2(&actual)[SIZE2])
605605 {
606606 return detail::CmpHelperEqRange(expected_expr, actual_expr, expected.begin(), expected.end()
607607 , actual, actual + SIZE2);
--- trunk/include/util/iutest_util_no_yoda.hpp (revision 1341)
+++ trunk/include/util/iutest_util_no_yoda.hpp (revision 1342)
@@ -6,7 +6,7 @@
66 *
77 * @author t.shirayanagi
88 * @par copyright
9- * Copyright (C) 2015-2016, Takazumi Shirayanagi\n
9+ * Copyright (C) 2015-2018, Takazumi Shirayanagi\n
1010 * This software is released under the new BSD License,
1111 * see LICENSE
1212 */
@@ -68,6 +68,22 @@
6868 # define IUTEST_ASSUME_DOUBLE_EQ(actual, expected) IUTEST_TEST_DOUBLE_EQ(expected, actual, IUTEST_ASSUME_FAILURE)
6969 #endif
7070
71+#ifdef IUTEST_ASSERT_LONG_DOUBLE_EQ
72+# undef IUTEST_ASSERT_LONG_DOUBLE_EQ
73+# define IUTEST_ASSERT_LONG_DOUBLE_EQ(actual, expected) IUTEST_TEST_LONG_DOUBLE_EQ(expected, actual, IUTEST_ASSERT_FAILURE)
74+#endif
75+#ifdef IUTEST_EXPECT_LONG_DOUBLE_EQ
76+# undef IUTEST_EXPECT_LONG_DOUBLE_EQ
77+# define IUTEST_EXPECT_LONG_DOUBLE_EQ(actual, expected) IUTEST_TEST_LONG_DOUBLE_EQ(expected, actual, IUTEST_EXPECT_FAILURE)
78+#endif
79+#ifdef IUTEST_INFORM_LONG_DOUBLE_EQ
80+# undef IUTEST_INFORM_LONG_DOUBLE_EQ
81+# define IUTEST_INFORM_LONG_DOUBLE_EQ(actual, expected) IUTEST_TEST_LONG_DOUBLE_EQ(expected, actual, IUTEST_INFORM_FAILURE)
82+#endif
83+#ifdef IUTEST_ASSUME_LONG_DOUBLE_EQ
84+# undef IUTEST_ASSUME_LONG_DOUBLE_EQ
85+# define IUTEST_ASSUME_LONG_DOUBLE_EQ(actual, expected) IUTEST_TEST_LONG_DOUBLE_EQ(expected, actual, IUTEST_ASSUME_FAILURE)
86+#endif
7187
7288 #ifdef IUTEST_ASSERT_STREQ
7389 # undef IUTEST_ASSERT_STREQ
--- trunk/test/assertion_tests.cpp (revision 1341)
+++ trunk/test/assertion_tests.cpp (revision 1342)
@@ -215,6 +215,18 @@
215215 IUTEST_INFORM_PRED_FORMAT2(::iutest::DoubleLE, -1.0, -2.0/2.0);
216216 }
217217
218+#if IUTEST_HAS_LONG_DOUBLE
219+
220+IUTEST(AssertionTest, LongDouble)
221+{
222+ long double d0=0.0, d1=1.0;
223+ IUTEST_ASSERT_LONG_DOUBLE_EQ(1.0, d1);
224+ IUTEST_EXPECT_LONG_DOUBLE_EQ(0.0, d0);
225+ IUTEST_INFORM_LONG_DOUBLE_EQ(-1.0, -2.0/2.0);
226+}
227+
228+#endif
229+
218230 IUTEST(AssertionTest, Near)
219231 {
220232 IUTEST_ASSERT_NEAR(0, 1, 1.5);
--- trunk/test/matcher_tests.cpp (revision 1341)
+++ trunk/test/matcher_tests.cpp (revision 1342)
@@ -41,6 +41,10 @@
4141 int** p2 = &p1;
4242 float f0 = 0.0f;
4343 double d0 = 0.0;
44+#if IUTEST_HAS_LONG_DOUBLE
45+long double ld0 = 0.0;
46+#endif
47+
4448 struct X { int a, b; X(int _a, int _b) : a(_a), b(_b) {} int GetA() const { return a; } };
4549 X gx(1, 1);
4650 ::std::map<int, X> mx;
@@ -100,17 +104,31 @@
100104 IUTEST(Matcher, FloatEq)
101105 {
102106 IUTEST_EXPECT_THAT(f0, FloatEq(0.0f));
107+ IUTEST_EXPECT_THAT(f0, FloatingPointEq(0.0f));
103108 }
104109
105110 IUTEST(Matcher, DoubleEq)
106111 {
107112 IUTEST_EXPECT_THAT(d0, DoubleEq(0.0));
113+ IUTEST_EXPECT_THAT(d0, FloatingPointEq(0.0));
108114 }
109115
116+#if IUTEST_HAS_LONG_DOUBLE
117+
118+IUTEST(Matcher, LongDoubleEq)
119+{
120+ IUTEST_EXPECT_THAT(ld0, LongDoubleEq(0.0));
121+ long double ldx = 0.001;
122+ IUTEST_EXPECT_THAT(ldx, LongDoubleEq(0.001));
123+}
124+
125+#endif
126+
110127 IUTEST(Matcher, NanSensitiveFloatEq)
111128 {
112129 IUTEST_EXPECT_THAT(f0, NanSensitiveFloatEq(0.0f));
113130 IUTEST_EXPECT_THAT(0.0f/f0, NanSensitiveFloatEq(0.0f/f0));
131+ IUTEST_EXPECT_THAT(0.0f/f0, NanSensitiveFloatingPointEq(0.0f/f0));
114132 }
115133
116134 IUTEST(Matcher, NanSensitiveDoubleEq)
@@ -117,8 +135,20 @@
117135 {
118136 IUTEST_EXPECT_THAT(d0, NanSensitiveDoubleEq(0.0));
119137 IUTEST_EXPECT_THAT(0.0/d0, NanSensitiveDoubleEq(0.0/d0));
138+ IUTEST_EXPECT_THAT(0.0/d0, NanSensitiveFloatingPointEq(0.0/d0));
120139 }
121140
141+#if IUTEST_HAS_LONG_DOUBLE
142+
143+IUTEST(Matcher, NanSensitiveLongDoubleEq)
144+{
145+ IUTEST_EXPECT_THAT(ld0, NanSensitiveLongDoubleEq(0.0));
146+ long double ldx = 0.001;
147+ IUTEST_EXPECT_THAT(ldx, NanSensitiveLongDoubleEq(0.001));
148+}
149+
150+#endif
151+
122152 IUTEST(Matcher, StrEq)
123153 {
124154 IUTEST_EXPECT_THAT("hoge", StrEq("hoge"));
@@ -377,6 +407,7 @@
377407 {
378408 CHECK_FAILURE( IUTEST_ASSERT_THAT(f0, FloatEq(1.0f)), "Eq: " );
379409 CHECK_FAILURE( IUTEST_ASSERT_THAT(0/f0, FloatEq(0/f0)), "Eq: " );
410+ CHECK_FAILURE( IUTEST_ASSERT_THAT(0/f0, FloatingPointEq(0/f0)), "Eq: " );
380411 }
381412
382413 IUTEST(MatcherFailure, DoubleEq)
@@ -383,18 +414,40 @@
383414 {
384415 CHECK_FAILURE( IUTEST_ASSERT_THAT(d0, DoubleEq(1.0)), "Eq: " );
385416 CHECK_FAILURE( IUTEST_ASSERT_THAT(0/d0, DoubleEq(0/d0)), "Eq: " );
417+ CHECK_FAILURE( IUTEST_ASSERT_THAT(0/d0, FloatingPointEq(0/d0)), "Eq: " );
386418 }
387419
420+#if IUTEST_HAS_LONG_DOUBLE
421+
422+IUTEST(MatcherFailure, LongDoubleEq)
423+{
424+ CHECK_FAILURE( IUTEST_ASSERT_THAT(ld0, LongDoubleEq(1.0)), "Eq: " );
425+ CHECK_FAILURE( IUTEST_ASSERT_THAT(0/ld0, LongDoubleEq(0/ld0)), "Eq: " );
426+}
427+
428+#endif
429+
388430 IUTEST(MatcherFailure, NanSensitiveFloatEq)
389431 {
390432 CHECK_FAILURE( IUTEST_ASSERT_THAT(f0, NanSensitiveFloatEq(1.0f)), "Eq: " );
433+ CHECK_FAILURE( IUTEST_ASSERT_THAT(f0, NanSensitiveFloatingPointEq(1.0f)), "Eq: " );
391434 }
392435
393436 IUTEST(MatcherFailure, NanSensitiveDoubleEq)
394437 {
395438 CHECK_FAILURE( IUTEST_ASSERT_THAT(d0, NanSensitiveDoubleEq(1.0)), "Eq: " );
439+ CHECK_FAILURE( IUTEST_ASSERT_THAT(d0, NanSensitiveFloatingPointEq(1.0)), "Eq: " );
396440 }
397441
442+#if IUTEST_HAS_LONG_DOUBLE
443+
444+IUTEST(MatcherFailure, NanSensitiveLongDoubleEq)
445+{
446+ CHECK_FAILURE( IUTEST_ASSERT_THAT(ld0, NanSensitiveLongDoubleEq(1.0)), "Eq: " );
447+}
448+
449+#endif
450+
398451 IUTEST(MatcherFailure, StrEq)
399452 {
400453 CHECK_FAILURE( IUTEST_ASSERT_THAT("hoge", StrEq("Hoge")), "StrEq: Hoge");
Show on old repository browser