• R/O
  • SSH
  • HTTPS

iutest: Commit


Commit MetaInfo

Revision1348 (tree)
Time2018-10-07 23:13:07
Authorsrz_zumix

Log Message

Merge remote-tracking branch 'origin/develop'

git@0f39f3af0819d99e9c8d3398d1d1403cb1d22d0f
https://github.com/srz-zumix/iutest/commit/0f39f3af0819d99e9c8d3398d1d1403cb1d22d0f

Change Summary

Incremental Difference

--- trunk/.gitignore (revision 1347)
+++ trunk/.gitignore (revision 1348)
@@ -50,7 +50,7 @@
5050 bld/
5151 [Bb]in/
5252 [Oo]bj/
53-fused-src/
53+fused-src/*.*
5454 tmp/
5555
5656 # bundle
--- trunk/.travis.yml (revision 1347)
+++ trunk/.travis.yml (revision 1348)
@@ -15,7 +15,6 @@
1515 - llvm-toolchain-trusty
1616 packages: &apt-common-packages
1717 - clang-6.0
18- - libc++-dev
1918 - g++-8
2019 - gcc-8
2120 #- cppcheck
@@ -133,15 +132,24 @@
133132 - STDFLAG=
134133
135134 allow_failures:
136- - env: COVERITY_SCAN=1
135+ - env:
136+ - COVERITY_SCAN=1
137+ - USE_LIBCXX=1
137138
138139 matrix:
139140 include:
140141 # libc++
141- - compiler: clang
142- env:
143- - STDFLAG=-stdlib=libc++
144- - DEFS="-DIUTEST_USE_OWN_IS_MEMBER_FUNCTION_POINTER=1"
142+ #- compiler: clang
143+ # env:
144+ # - USE_LIBCXX=1
145+ # - STDFLAG=-stdlib=libc++
146+ # - DEFS="-DIUTEST_USE_OWN_IS_MEMBER_FUNCTION_POINTER=1"
147+ # addons:
148+ # apt:
149+ # sources: *apt-common-sources
150+ # packages:
151+ # - libc++-dev
152+ # - clang-6.0
145153 # coverage
146154 - compiler: clang
147155 env: USE_COVERAGE=gcov USE_CODECOV=1 USE_GNU_EXTENSION=1
--- trunk/CHANGES.md (revision 1347)
+++ trunk/CHANGES.md (revision 1348)
@@ -2,6 +2,14 @@
22
33 --------------------------------------------------
44
5+## Changes for 1.17.0
6+
7+* Improved
8+
9+* Bug fixes
10+
11+--------------------------------------------------
12+
513 ## Changes for 1.16.6
614
715 * Improved
--- trunk/fused-src/Makefile (nonexistent)
+++ trunk/fused-src/Makefile (revision 1348)
@@ -0,0 +1,5 @@
1+#
2+# Makefile
3+
4+fused:
5+ make -C ../tools/fused
--- trunk/include/gtest/switch/iutest_switch_gmock.hpp (revision 1347)
+++ trunk/include/gtest/switch/iutest_switch_gmock.hpp (revision 1348)
@@ -86,15 +86,18 @@
8686 using ::testing::Ge;
8787 using ::testing::IsNull;
8888 using ::testing::NotNull;
89+
8990 using ::testing::DoubleEq;
9091 using ::testing::FloatEq;
92+ using ::testing::NanSensitiveDoubleEq;
93+ using ::testing::NanSensitiveFloatEq;
94+
95+#if GMOCK_VER > 0x01060000
9196 using ::testing::DoubleNear;
9297 using ::testing::FloatNear;
93-
94- using ::testing::NanSensitiveDoubleEq;
95- using ::testing::NanSensitiveFloatEq;
9698 using ::testing::NanSensitiveDoubleNear;
9799 using ::testing::NanSensitiveFloatNear;
100+#endif
98101
99102 using ::testing::StrEq;
100103 using ::testing::StrNe;
--- trunk/include/internal/iutest_compiler.hpp (revision 1347)
+++ trunk/include/internal/iutest_compiler.hpp (revision 1348)
@@ -100,9 +100,14 @@
100100 # include <android/api-level.h>
101101 #endif
102102
103+// __cplusplus numbers
104+
105+#define IUTEST_CPLUSPLUS_CXX11 201103L
106+#define IUTEST_CPLUSPLUS_CXX14 201402L
107+#define IUTEST_CPLUSPLUS_CXX17 201703L
108+
103109 // c++2a
104110
105-// c++17
106111 #if !defined(IUTEST_HAS_CXX2A)
107112 # if (defined(__cplusplus) && __cplusplus > 201703L)
108113 # define IUTEST_HAS_CXX2A 1
@@ -113,11 +118,12 @@
113118 # define IUTEST_HAS_CXX2A 0
114119 #endif
115120
121+// c++17
116122 //! is c++17 compiler
117123 #if !defined(IUTEST_HAS_CXX17)
118-# if (defined(__cplusplus) && __cplusplus >= 201406L)
124+# if (defined(__cplusplus) && __cplusplus >= IUTEST_CPLUSPLUS_CXX17)
119125 # define IUTEST_HAS_CXX17 1
120-# elif defined(_MSVC_LANG) && _MSVC_LANG > 201402
126+# elif (defined(_MSVC_LANG) && _MSVC_LANG >= IUTEST_CPLUSPLUS_CXX17)
121127 # define IUTEST_HAS_CXX17 1
122128 # endif
123129 #endif
@@ -126,10 +132,50 @@
126132 # define IUTEST_HAS_CXX17 0
127133 #endif
128134
135+#if !defined(IUTEST_HAS_CXX1Z)
136+# if (defined(__cplusplus) && __cplusplus > IUTEST_CPLUSPLUS_CXX14)
137+# define IUTEST_HAS_CXX1Z 1
138+# elif (defined(_MSVC_LANG) && _MSVC_LANG > IUTEST_CPLUSPLUS_CXX14)
139+# define IUTEST_HAS_CXX1Z 1
140+# endif
141+#endif
142+
143+#if !defined(IUTEST_HAS_CXX1Z)
144+# define IUTEST_HAS_CXX1Z 0
145+#endif
146+
147+//! is c++14 compiler
148+#if !defined(IUTEST_HAS_CXX14)
149+# if (defined(__cplusplus) && __cplusplus >= IUTEST_CPLUSPLUS_CXX14)
150+# define IUTEST_HAS_CXX14 1
151+# elif (defined(_MSVC_LANG) && _MSVC_LANG >= IUTEST_CPLUSPLUS_CXX14)
152+# define IUTEST_HAS_CXX14 1
153+# endif
154+#endif
155+
156+#if !defined(IUTEST_HAS_CXX14)
157+# define IUTEST_HAS_CXX14 0
158+#endif
159+
160+//! is c++11 compiler
161+#if !defined(IUTEST_HAS_CXX11)
162+# if (defined(__cplusplus) && __cplusplus >= IUTEST_CPLUSPLUS_CXX11) || defined(__GXX_EXPERIMENTAL_CXX0X__)
163+# define IUTEST_HAS_CXX11 1
164+# endif
165+#endif
166+
167+#if !defined(IUTEST_HAS_CXX11)
168+# define IUTEST_HAS_CXX11 0
169+#endif
170+
171+
172+
173+// c++17 features
174+
129175 //! inline variable
130176 #if !defined(IUTEST_HAS_INLINE_VARIABLE)
131177 #if defined(__clang__)
132-# if (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 9)) && IUTEST_HAS_CXX17
178+# if (__clang_major__ > 3 || (__clang_major__ == 3 && __clang_minor__ >= 9)) && IUTEST_HAS_CXX1Z
133179 # define IUTEST_HAS_INLINE_VARIABLE 1
134180 # endif
135181 #endif
@@ -154,19 +200,8 @@
154200 # define IUTEST_HAS_CONSTEXPR_IF 0
155201 #endif
156202
157-// c++11
203+// c++11 features
158204
159-//! is c++11 compiler
160-#if !defined(IUTEST_HAS_CXX11)
161-# if (defined(__cplusplus) && __cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X__)
162-# define IUTEST_HAS_CXX11 1
163-# endif
164-#endif
165-
166-#if !defined(IUTEST_HAS_CXX11)
167-# define IUTEST_HAS_CXX11 0
168-#endif
169-
170205 //! has nullptr
171206 #if !defined(IUTEST_HAS_NULLPTR)
172207 # if defined(_NATIVE_NULLPTR_SUPPORTED)
--- trunk/include/internal/iutest_filepath.hpp (revision 1347)
+++ trunk/include/internal/iutest_filepath.hpp (revision 1348)
@@ -46,13 +46,24 @@
4646 {
4747 Normalize();
4848 }
49+#if IUTEST_USE_CXX_FILESYSTEM
50+ explicit iuFilePath(const ::std::filesystem::path& path) : m_path(path.string())
51+ {
52+ Normalize();
53+ }
54+#endif
4955
5056 public:
51- ::std::string ToString() const { return m_path; }
52- const char* c_str() const { return m_path.c_str(); }
53- bool IsEmpty() const { return c_str() == NULL || *c_str() == '\0'; }
57+ ::std::string ToString() const { return m_path; }
58+ const ::std::string& string() const { return m_path; }
59+ bool IsEmpty() const { return m_path.empty(); }
5460 size_t length() const { return m_path.length(); }
5561
62+#if IUTEST_USE_CXX_FILESYSTEM
63+ ::std::filesystem::path path() const { return ::std::filesystem::path(m_path); }
64+ ::std::filesystem::file_status status() const { return ::std::filesystem::status(path()); }
65+#endif
66+
5667 public:
5768 iuFilePath & operator = (const iuFilePath& rhs) { m_path = rhs.m_path; return *this; }
5869
@@ -63,13 +74,12 @@
6374 }
6475 bool operator == (const iuFilePath& rhs) const
6576 {
66- return IsStringCaseEqual(c_str(), rhs.c_str());
77+ return IsStringCaseEqual(m_path, rhs.m_path);
6778 }
6879 bool operator == (const char* rhs) const
6980 {
70- return IsStringCaseEqual(c_str(), rhs);
81+ return IsStringCaseEqual(m_path, rhs);
7182 }
72- //operator const char* () const { return c_str(); }
7383
7484 public:
7585 /**
@@ -93,6 +103,11 @@
93103 iuFilePath RemoveTrailingPathSeparator() const;
94104
95105 /**
106+ * @brief 拡張子の取得
107+ */
108+ ::std::string GetExtension() const;
109+
110+ /**
96111 * @brief 拡張子の削除
97112 */
98113 iuFilePath RemoveExtension(const char* extension=NULL) const;
@@ -127,11 +142,6 @@
127142 */
128143 bool DirectoryExists() const;
129144
130- /**
131- * @brief 一番後ろのパスセパレータのアドレスを取得
132- */
133- const char* FindLastPathSeparator() const;
134-
135145 public:
136146 /**
137147 * @brief カレントディレクトリの取得
@@ -165,7 +175,7 @@
165175
166176 inline iu_ostream& operator << (iu_ostream& os, const iuFilePath& path)
167177 {
168- return os << path.c_str();
178+ return os << path.string();
169179 }
170180
171181 } // end of namespace detail
--- trunk/include/internal/iutest_internal.hpp (revision 1347)
+++ trunk/include/internal/iutest_internal.hpp (revision 1348)
@@ -105,19 +105,27 @@
105105 #define IUTEST_TEST_F_(testfixture_, testname_) \
106106 IIUT_TEST_F_A_(IUTEST_TEST_, testfixture_, testname_)
107107
108+#if IUTEST_HAS_IGNORE_TEST
109+
108110 #define IUTEST_TEST_F_IGNORE_(testfixture_, testname_) \
109111 IIUT_TEST_F_A_( IUTEST_TEST_IGNORE_, testfixture_, testname_)
110112
113+#endif
114+
111115 #else
112116
113117 #define IUTEST_TEST_F_(testfixture_, testname_) \
114118 IIUT_TEST_F_(IUTEST_TEST_, testfixture_, testname_)
115119
120+#if IUTEST_HAS_IGNORE_TEST
121+
116122 #define IUTEST_TEST_F_IGNORE_(testfixture_, testname_) \
117123 IIUT_TEST_F_( IUTEST_TEST_IGNORE_, testfixture_, testname_)
118124
119125 #endif
120126
127+#endif
128+
121129 /**
122130 * @}
123131 */
@@ -138,6 +146,8 @@
138146 , type_id_, parent_class_::SetUpTestCase, parent_class_::TearDownTestCase); \
139147 void IUTEST_TEST_CLASS_NAME_(testcase_, testname_)::Body()
140148
149+#if IUTEST_HAS_IGNORE_TEST
150+
141151 /**
142152 * @internal
143153 * @brief Test class defined macro
@@ -156,6 +166,8 @@
156166 , type_id_, parent_class_::SetUpTestCase, parent_class_::TearDownTestCase); \
157167 template<typename T>void IUTEST_TEST_CLASS_NAME_(testcase_, testname_ )::Body()
158168
169+#endif
170+
159171 #if !defined(IUTEST_NO_VARIADIC_MACROS)
160172
161173 /**
--- trunk/include/internal/iutest_option_message.hpp (revision 1347)
+++ trunk/include/internal/iutest_option_message.hpp (revision 1348)
@@ -182,13 +182,18 @@
182182 IIUT_SHOW_MACRO(IUTEST_HAS_CONSTEXPR_IF);
183183 IIUT_SHOW_MACRO(IUTEST_HAS_COUNTER_MACRO);
184184 IIUT_SHOW_MACRO(IUTEST_HAS_CTIME);
185+ IIUT_SHOW_MACRO(IUTEST_HAS_CXX_HDR_ANY);
185186 IIUT_SHOW_MACRO(IUTEST_HAS_CXX_HDR_ARRAY);
186187 IIUT_SHOW_MACRO(IUTEST_HAS_CXX_HDR_CHRONO);
187188 IIUT_SHOW_MACRO(IUTEST_HAS_CXX_HDR_CODECVT);
188189 IIUT_SHOW_MACRO(IUTEST_HAS_CXX_HDR_CSTDINT);
189190 IIUT_SHOW_MACRO(IUTEST_HAS_CXX_HDR_CUCHAR);
191+ IIUT_SHOW_MACRO(IUTEST_HAS_CXX_HDR_FILESYSTEM);
192+ IIUT_SHOW_MACRO(IUTEST_HAS_CXX_HDR_OPTIONAL);
190193 IIUT_SHOW_MACRO(IUTEST_HAS_CXX_HDR_RANDOM);
191194 IIUT_SHOW_MACRO(IUTEST_HAS_CXX_HDR_REGEX);
195+ IIUT_SHOW_MACRO(IUTEST_HAS_CXX_HDR_STRING_VIEW);
196+ IIUT_SHOW_MACRO(IUTEST_HAS_CXX_HDR_VARIANT);
192197 IIUT_SHOW_MACRO(IUTEST_HAS_CXX11);
193198 IIUT_SHOW_MACRO(IUTEST_HAS_DECLTYPE);
194199 IIUT_SHOW_MACRO(IUTEST_HAS_DELETED_FUNCTIONS);
--- trunk/include/internal/iutest_port.hpp (revision 1347)
+++ trunk/include/internal/iutest_port.hpp (revision 1348)
@@ -170,6 +170,11 @@
170170 const char* FindLastPathSeparator(const char* path, size_t length) IUTEST_CXX_NOEXCEPT_SPEC;
171171
172172 /**
173+ * @brief 一番後ろのパスセパレータの位置を取得
174+*/
175+size_t FindLastPathSeparatorPosition(const char* path, size_t length) IUTEST_CXX_NOEXCEPT_SPEC;
176+
177+/**
173178 * @brief 環境変数の設定
174179 */
175180 bool SetEnvironmentVariable(const char* name, const char* value);
--- trunk/include/internal/iutest_pp.hpp (revision 1347)
+++ trunk/include/internal/iutest_pp.hpp (revision 1348)
@@ -80,6 +80,9 @@
8080 #define IUTEST_UNUSED_VAR(x) (void)(x)
8181 #define IUTEST_UNUSED_RETURN(x) (void)(x)
8282
83+#define IUTEST_PP_ENUM_CASE_RETURN_STRING(name) case name: return #name
84+#define IUTEST_PP_NAMESPACE_ENUM_CASE_RETURN_STRING(ns, name) case ns::name: return #name
85+
8386 // DEC
8487 #define IUTEST_PP_DEC(n) IIUT_PP_DEC_I(n)
8588 #define IIUT_PP_DEC_I(n) IIUT_PP_DEC_##n
--- trunk/include/internal/iutest_stdlib.hpp (revision 1347)
+++ trunk/include/internal/iutest_stdlib.hpp (revision 1348)
@@ -32,7 +32,9 @@
3232
3333 // libstdc++
3434 #if defined(__clang__)
35-# if __has_include(<experimental/any>)
35+# if __has_include(<experimental/memory_resource>)
36+# define IUTEST_LIBSTDCXX_VERSION 60100
37+# elif __has_include(<experimental/any>)
3638 # define IUTEST_LIBSTDCXX_VERSION 50100
3739 # elif __has_include(<shared_mutex>)
3840 # define IUTEST_LIBSTDCXX_VERSION 40900
@@ -54,6 +56,11 @@
5456 #endif
5557
5658 #if IUTEST_HAS_CXX11
59+# if IUTEST_LIBSTDCXX_VERSION >= 60100
60+# if !defined(IUTEST_HAS_STD_INVOKE) && IUTEST_HAS_CXX1Z
61+# define IUTEST_HAS_STD_INVOKE 1
62+# endif
63+# endif
5764 # if IUTEST_LIBSTDCXX_VERSION >= 50100
5865 # if !defined(IUTEST_HAS_CXX_HDR_CODECVT)
5966 # define IUTEST_HAS_CXX_HDR_CODECVT 1
@@ -169,6 +176,11 @@
169176 # endif
170177 #endif
171178
179+#if _LIBCPP_VERSION >= 3700
180+# if !defined(IUTEST_HAS_STD_INVOKE) && IUTEST_HAS_CXX1Z
181+# define IUTEST_HAS_STD_INVOKE 1
182+# endif
183+#endif
172184 #if _LIBCPP_VERSION >= 1001
173185 # if !defined(IUTEST_HAS_STD_BEGIN_END)
174186 # define IUTEST_HAS_STD_BEGIN_END 1
@@ -255,7 +267,54 @@
255267
256268 #endif
257269
270+#if IUTEST_HAS_CXX1Z
271+
272+// c++17 feature
273+
258274 #if defined(__has_include)
275+# if __has_include(<any>)
276+# define IUTEST_HAS_CXX_HDR_ANY 1
277+# endif
278+#endif
279+
280+#if defined(__has_include)
281+# if __has_include(<filesystem>)
282+# define IUTEST_HAS_CXX_HDR_FILESYSTEM 1
283+# endif
284+#endif
285+
286+
287+#if defined(__has_include)
288+# if __has_include(<optional>)
289+# define IUTEST_HAS_CXX_HDR_OPTIONAL 1
290+# endif
291+#endif
292+
293+#if defined(__has_include)
294+# if __has_include(<string_view>)
295+# define IUTEST_HAS_CXX_HDR_STRING_VIEW 1
296+# endif
297+#endif
298+
299+#endif
300+
301+#if IUTEST_HAS_CXX17
302+
303+// c++17 feature
304+
305+#if !defined(IUTEST_HAS_CXX_HDR_VARIANT)
306+# if IUTEST_HAS_VARIADIC_TEMPLATES && defined(__has_include)
307+# if defined(__clang__) && (__clang_major__ < 3 || (__clang_major__ == 3 && __clang_minor__ < 6))
308+# define IUTEST_HAS_CXX_HDR_VARIANT 0 // clang 3.5 + variant is not worked
309+# elif __has_include(<variant>)
310+# define IUTEST_HAS_CXX_HDR_VARIANT 1
311+# endif
312+# endif
313+#endif
314+
315+#endif
316+
317+#if defined(__has_include)
259318 # if defined(IUTEST_HAS_CXX_HDR_CODECVT) && IUTEST_HAS_CXX_HDR_CODECVT
260319 # if !__has_include( <codecvt> )
261320 # undef IUTEST_HAS_CXX_HDR_CODECVT
@@ -271,6 +330,18 @@
271330 #if !defined(IUTEST_HAS_STD_DECLVAL)
272331 # define IUTEST_HAS_STD_DECLVAL 0
273332 #endif
333+//! has emplace
334+#if !defined(IUTEST_HAS_STD_EMPLACE)
335+# define IUTEST_HAS_STD_EMPLACE 0
336+#endif
337+//! has std::invoke
338+#if !defined(IUTEST_HAS_STD_INVOKE)
339+# define IUTEST_HAS_STD_INVOKE 0
340+#endif
341+//! has quick_exit
342+#if !defined(IUTEST_HAS_STD_QUICK_EXIT)
343+# define IUTEST_HAS_STD_QUICK_EXIT 0
344+#endif
274345 //! use external include tr1::tuple
275346 #if !defined(IUTEST_USE_EXTERNAL_TR1_TUPLE)
276347 # define IUTEST_USE_EXTERNAL_TR1_TUPLE 0
@@ -298,53 +369,79 @@
298369 # endif
299370 # define IUTEST_HAS_TUPLE 0
300371 #endif
372+
373+//! has any header
374+#if !defined(IUTEST_HAS_CXX_HDR_ANY)
375+# define IUTEST_HAS_CXX_HDR_ANY 0
376+#endif
377+//! has array header
378+#if !defined(IUTEST_HAS_CXX_HDR_ARRAY)
379+# define IUTEST_HAS_CXX_HDR_ARRAY 0
380+#endif
301381 //! has chrono header
302382 #if !defined(IUTEST_HAS_CXX_HDR_CHRONO)
303383 # define IUTEST_HAS_CXX_HDR_CHRONO 0
304384 #endif
305-//! has regex header
306-#if !defined(IUTEST_HAS_CXX_HDR_REGEX)
307-# define IUTEST_HAS_CXX_HDR_REGEX 0
308-#endif
309-//! has random header
310-#if !defined(IUTEST_HAS_CXX_HDR_RANDOM)
311-# define IUTEST_HAS_CXX_HDR_RANDOM 0
312-#endif
313385 //! has codecvt header
314386 #if !defined(IUTEST_HAS_CXX_HDR_CODECVT)
315387 # define IUTEST_HAS_CXX_HDR_CODECVT 0
316388 #endif
389+//! has cuchar
390+#if !defined(IUTEST_HAS_CXX_HDR_CUCHAR)
391+# define IUTEST_HAS_CXX_HDR_CUCHAR 0
392+#endif
317393 //! has cstdint header
318394 #if !defined(IUTEST_HAS_CXX_HDR_CSTDINT)
319395 # define IUTEST_HAS_CXX_HDR_CSTDINT 0
320396 #endif
321-//! has array header
322-#if !defined(IUTEST_HAS_CXX_HDR_ARRAY)
323-# define IUTEST_HAS_CXX_HDR_ARRAY 0
397+//! has filesystem header
398+#if !defined(IUTEST_HAS_CXX_HDR_FILESYSTEM)
399+# define IUTEST_HAS_CXX_HDR_FILESYSTEM 0
324400 #endif
325-//! has emplace
326-#if !defined(IUTEST_HAS_STD_EMPLACE)
327-# define IUTEST_HAS_STD_EMPLACE 0
401+//! has optional header
402+#if !defined(IUTEST_HAS_CXX_HDR_OPTIONAL)
403+# define IUTEST_HAS_CXX_HDR_OPTIONAL 0
328404 #endif
329-//! has quick_exit
330-#if !defined(IUTEST_HAS_STD_QUICK_EXIT)
331-# define IUTEST_HAS_STD_QUICK_EXIT 0
405+//! has random header
406+#if !defined(IUTEST_HAS_CXX_HDR_RANDOM)
407+# define IUTEST_HAS_CXX_HDR_RANDOM 0
332408 #endif
409+//! has regex header
410+#if !defined(IUTEST_HAS_CXX_HDR_REGEX)
411+# define IUTEST_HAS_CXX_HDR_REGEX 0
412+#endif
413+//! has string_view header
414+#if !defined(IUTEST_HAS_CXX_HDR_STRING_VIEW)
415+# define IUTEST_HAS_CXX_HDR_STRING_VIEW 0
416+#endif
417+//! has variant header
418+#if !defined(IUTEST_HAS_CXX_HDR_VARIANT)
419+# define IUTEST_HAS_CXX_HDR_VARIANT 0
420+#endif
333421 //! has cxxabi header
334422 #if !defined(IUTEST_HAS_HDR_CXXABI)
335423 # define IUTEST_HAS_HDR_CXXABI 0
336424 #endif
337-//! has cuchar
338-#if !defined(IUTEST_HAS_CXX_HDR_CUCHAR)
339-# define IUTEST_HAS_CXX_HDR_CUCHAR 0
340-#endif
341425
342426 //======================================================================
343427 // include
428+#include <iterator>
429+
430+#if IUTEST_HAS_CXX_HDR_ANY
431+# include <any>
432+#endif
344433 #if IUTEST_HAS_CXX_HDR_CSTDINT
345434 # include <cstdint>
346435 #endif
347-#include <iterator>
436+#if IUTEST_HAS_CXX_HDR_FILESYSTEM
437+# include <filesystem>
438+#endif
439+#if IUTEST_HAS_CXX_HDR_OPTIONAL
440+# include <optional>
441+#endif
442+#if IUTEST_HAS_CXX_HDR_VARIANT
443+# include <variant>
444+#endif
348445
349446 //======================================================================
350447 // declare
--- trunk/include/internal/iutest_string.hpp (revision 1347)
+++ trunk/include/internal/iutest_string.hpp (revision 1348)
@@ -35,6 +35,7 @@
3535 #endif
3636 #include <string>
3737 #include <cstring>
38+#include <cmath>
3839
3940 IUTEST_PRAGMA_CRT_SECURE_WARN_DISABLE_BEGIN()
4041
@@ -42,6 +43,8 @@
4243 namespace detail
4344 {
4445
46+::std::string StringFormat(const char* format, ...);
47+
4548 /**
4649 * @internal
4750 * @brief stricmp
@@ -196,6 +199,8 @@
196199 inline bool IsStringEqual(const ::std::string& str1, const char* str2) { return str1.compare(str2) == 0; }
197200 inline bool IsStringEqual(const ::std::string& str1, const ::std::string& str2) { return str1.compare(str2) == 0; }
198201 inline bool IsStringCaseEqual(const char* str1, const char* str2) { return iu_stricmp(str1, str2) == 0; }
202+inline bool IsStringCaseEqual(const ::std::string& str1, const char* str2) { return iu_stricmp(str1.c_str(), str2) == 0; }
203+inline bool IsStringCaseEqual(const ::std::string& str1, const ::std::string& str2) { return iu_stricmp(str1.c_str(), str2.c_str()) == 0; }
199204 inline bool IsStringForwardMatching(const char* str1, const char* str2) { return strstr(str1, str2) == str1; }
200205 inline bool IsStringForwardMatching(const ::std::string& str1, const char* str2) { return str1.find(str2) == 0; }
201206 inline bool IsStringForwardMatching(const ::std::string& str1, const std::string& str2) { return str1.find(str2) == 0; }
@@ -305,6 +310,24 @@
305310 dst.swap(parsed);
306311 }
307312
313+inline IUTEST_CXX_CONSTEXPR char ToOct(unsigned int n)
314+{
315+ return '0' + (n & 0x7);
316+}
317+
318+template<typename T>
319+inline ::std::string ToOctString(T value)
320+{
321+ const size_t kN = (sizeof(T) * 8 + 2) / 3;
322+ char buf[kN + 1] = { 0 };
323+ for(size_t i = 0; i < kN; ++i)
324+ {
325+ buf[i] = ToOct(static_cast<unsigned int>((value >> ((kN - i - 1) * 3))));
326+ }
327+ buf[kN] = '\0';
328+ return buf;
329+}
330+
308331 inline IUTEST_CXX_CONSTEXPR char ToHex(unsigned int n)
309332 {
310333 return (n&0xF) >= 0xA ? 'A'+((n&0xF)-0xA) : '0'+(n&0xF);
@@ -331,6 +354,37 @@
331354 return buf;
332355 }
333356
357+inline ::std::string FormatSizeByte(UInt64 value)
358+{
359+ const char* suffixes[] = {
360+ "B",
361+ "KB",
362+ "MB",
363+ "GB",
364+ "TB",
365+ };
366+ const size_t suffixes_length = IUTEST_PP_COUNTOF(suffixes);
367+ size_t index = 0;
368+ double view_value = static_cast<double>(value);
369+ while(view_value >= 1024 && index < suffixes_length)
370+ {
371+ ++index;
372+ view_value /= 1024;
373+ }
374+
375+ const UInt64 n = static_cast<UInt64>(::std::floor(view_value));
376+ const UInt64 f = static_cast<UInt64>(view_value * 10.0 - n * 10.0);
377+ const char* suffix = suffixes[index];
378+ if(view_value - n == 0)
379+ {
380+ return StringFormat("%llu%s", n, suffix);
381+ }
382+ else
383+ {
384+ return StringFormat("%llu.%llu%s", n, f, suffix);
385+ }
386+}
387+
334388 inline ::std::string ShowStringQuoted(const char* str)
335389 {
336390 ::std::string s = "\""; s += str; s += "\"";
--- trunk/include/iutest_any.hpp (revision 1347)
+++ trunk/include/iutest_any.hpp (revision 1348)
@@ -6,7 +6,7 @@
66 *
77 * @author t.shirayanagi
88 * @par copyright
9- * Copyright (C) 2013-2016, Takazumi Shirayanagi\n
9+ * Copyright (C) 2013-2018, Takazumi Shirayanagi\n
1010 * This software is released under the new BSD License,
1111 * see LICENSE
1212 */
@@ -35,6 +35,7 @@
3535 template<typename T>
3636 any(const T& rhs) : content(new holder<T>(rhs)) {} // NOLINT
3737 any(const any& rhs) : content(rhs.content == NULL ? NULL : rhs.content->clone()) {}
38+ any(const char rhs[]) : content(new holder< ::std::string >(::std::string(rhs)) ) {} // NOLINT
3839 ~any() { delete content; }
3940 public:
4041 /**
@@ -78,7 +79,35 @@
7879 return type() == internal::GetTypeId<T>();
7980 }
8081
82+ /**
83+ * @brief 所持している値の文字列化
84+ */
85+ ::std::string to_string() const
86+ {
87+ if(empty())
88+ {
89+ return "empty";
90+ }
91+ return content->to_string();
92+ }
93+
8194 public:
95+ /**
96+ * @brief 要素があるかどうか
97+ */
98+ bool has_value() const
99+ {
100+ return !empty();
101+ }
102+ /**
103+ * @brief 要素のクリア
104+ */
105+ void reset()
106+ {
107+ clear();
108+ }
109+
110+public:
82111 template<typename T>
83112 any& operator = (const T& rhs) { any(rhs).swap(*this); return *this; }
84113 any& operator = (const any& rhs) { any(rhs).swap(*this); return *this; }
@@ -95,6 +124,7 @@
95124 virtual ~placeholder() {}
96125 virtual type_id type() const = 0;
97126 virtual placeholder* clone() const = 0;
127+ virtual ::std::string to_string() const = 0;
98128 };
99129 template<typename T>
100130 class holder : public placeholder
@@ -110,6 +140,10 @@
110140 {
111141 return new holder<T>(held);
112142 }
143+ virtual ::std::string to_string() const IUTEST_CXX_OVERRIDE
144+ {
145+ return PrintToString(held);
146+ }
113147 public:
114148 T held;
115149 private:
@@ -170,8 +204,15 @@
170204 template<typename T>
171205 T* unsafe_any_cast(any* p)
172206 {
173- return p != NULL ?
174- &(static_cast< any::holder<T>* >(p->content)->held) : NULL;
207+ if(p == NULL)
208+ {
209+ return NULL;
210+ }
211+ if(!p->has_value())
212+ {
213+ return NULL;
214+ }
215+ return &(static_cast< any::holder<T>* >(p->content)->held);
175216 }
176217 /** @overload */
177218 template<typename T>
@@ -194,6 +235,24 @@
194235 return unsafe_any_cast<T>(const_cast<any&>(value));
195236 }
196237
238+#if !defined(IUTEST_NO_ARGUMENT_DEPENDENT_LOOKUP)
239+
240+#if IUTEST_HAS_STRINGSTREAM || IUTEST_HAS_STRSTREAM
241+template<typename Elem, typename Traits>
242+::std::basic_ostream<Elem, Traits>& operator << (::std::basic_ostream<Elem, Traits>& os, const any& value)
243+{
244+ return os << value.to_string();
245+}
246+#else
247+template<typename T>
248+iu_ostream& operator << (iu_ostream& os, const T& value)
249+{
250+ return os << value.to_string();
251+}
252+#endif
253+
254+#endif
255+
197256 } // end of namespace iutest
198257
199258 #endif // INCG_IRIS_IUTEST_ANY_HPP_8DB2417F_568A_4E01_95AD_21164565B975_
--- trunk/include/iutest_config.hpp (revision 1347)
+++ trunk/include/iutest_config.hpp (revision 1348)
@@ -525,6 +525,19 @@
525525 # define IUTEST_HAS_FILENO 0 //!< fileno が使用可能かどうか
526526 #endif
527527
528+//! ::std::filesystem を使用するかどうか
529+#if !defined(IUTEST_USE_CXX_FILESYSTEM)
530+# if IUTEST_HAS_CXX_HDR_FILESYSTEM
531+# if defined(_MSC_VER)
532+# define IUTEST_USE_CXX_FILESYSTEM 1
533+# endif
534+# endif
535+#endif
536+
537+#if !defined(IUTEST_USE_CXX_FILESYSTEM)
538+# define IUTEST_USE_CXX_FILESYSTEM 0
539+#endif
540+
528541 /**
529542 * @}
530543 */
--- trunk/include/iutest_defs.hpp (revision 1347)
+++ trunk/include/iutest_defs.hpp (revision 1348)
@@ -403,6 +403,10 @@
403403
404404 //======================================================================
405405 // typedef
406+typedef detail::type_fit_t<1>::Int Int8; //!< 8 bit 符号付き整数型
407+typedef detail::type_fit_t<1>::UInt UInt8; //!< 8 bit 符号なし整数型
408+typedef detail::type_fit_t<2>::Int Int16; //!< 16 bit 符号付き整数型
409+typedef detail::type_fit_t<2>::UInt UInt16; //!< 16 bit 符号なし整数型
406410 typedef detail::type_fit_t<4>::Int Int32; //!< 32 bit 符号付き整数型
407411 typedef detail::type_fit_t<4>::UInt UInt32; //!< 32 bit 符号なし整数型
408412 typedef detail::type_fit_t<8>::Int Int64; //!< 64 bit 符号付き整数型
--- trunk/include/iutest_param_tests.hpp (revision 1347)
+++ trunk/include/iutest_param_tests.hpp (revision 1348)
@@ -186,6 +186,8 @@
186186 int classname_::dummy_ IUTEST_ATTRIBUTE_UNUSED_ = classname_::AddRegister(); \
187187 void classname_::Body()
188188
189+#if IUTEST_HAS_IGNORE_TEST
190+
189191 #define IIUT_TEST_P_I_IGNORE_(classname_, testcase_, testcasename_, testname_) \
190192 class classname_ : public testcase_ { \
191193 public: classname_() {} \
@@ -202,6 +204,8 @@
202204 int classname_::dummy_ IUTEST_ATTRIBUTE_UNUSED_ = classname_::AddRegister(); \
203205 template<typename T>void classname_::Body()
204206
207+#endif
208+
205209 #define IIUT_TEST_P_(macro, testcase_, testname_) \
206210 macro(IUTEST_TEST_CLASS_NAME_(testcase_, testname_) \
207211 , IIUT_TEST_P_BASE_FIXTURE(testcase_) \
@@ -216,9 +220,12 @@
216220 #define IUTEST_TEST_P_(testcase_, testname_) \
217221 IIUT_TEST_P_A_(IIUT_TEST_P_I_, testcase_, testname_)
218222
223+#if IUTEST_HAS_IGNORE_TEST
224+
219225 #define IUTEST_TEST_P_IGNORE_(testcase_, testname_) \
220226 IIUT_TEST_P_A_(IIUT_TEST_P_I_IGNORE_, testcase_, testname_)
221227
228+#endif
222229
223230 #else
224231
@@ -225,11 +232,15 @@
225232 #define IUTEST_TEST_P_(testcase_, testname_) \
226233 IIUT_TEST_P_(IIUT_TEST_P_I_, testcase_, testname_)
227234
235+#if IUTEST_HAS_IGNORE_TEST
236+
228237 #define IUTEST_TEST_P_IGNORE_(testcase_, testname_) \
229238 IIUT_TEST_P_(IIUT_TEST_P_I_IGNORE_, testcase_, testname_)
230239
231240 #endif
232241
242+#endif
243+
233244 #define IIUT_TEST_P_EVALGENERATOR_NAME_(prefix_, testcase_) IIUT_TEST_P_EVALGENERATOR_NAME_I(prefix_, IIUT_TO_VARNAME_(testcase_))
234245 #define IIUT_TEST_P_EVALGENERATOR_NAME_I(prefix_, testcase_) IIUT_TEST_P_EVALGENERATOR_NAME_I_(prefix_, testcase_)
235246 #define IIUT_TEST_P_EVALGENERATOR_NAME_I_(prefix_, testcase_) s_##prefix_##_x_iutest_x_##testcase_##_EvalGenerator_
--- trunk/include/iutest_printers.hpp (revision 1347)
+++ trunk/include/iutest_printers.hpp (revision 1348)
@@ -175,10 +175,9 @@
175175 }
176176 *os << "}";
177177 }
178+
178179 template<typename T>
179-inline void DefaultPrintTo(IsContainerHelper::no_t
180- , iutest_type_traits::false_type
181- , const T& value, iu_ostream* os)
180+inline void DefaultPrintNonContainerTo(const T& value, iu_ostream* os)
182181 {
183182 #if !defined(IUTEST_NO_ARGUMENT_DEPENDENT_LOOKUP)
184183 printer_internal2::DefaultPrintNonContainerTo(value, os);
@@ -186,6 +185,14 @@
186185 printer_internal::formatter::Printer<false>::Print(value, os);
187186 #endif
188187 }
188+/** @overload */
189+template<typename T>
190+inline void DefaultPrintTo(IsContainerHelper::no_t
191+ , iutest_type_traits::false_type
192+ , const T& value, iu_ostream* os)
193+{
194+ DefaultPrintNonContainerTo(value, os);
195+}
189196
190197 #if !defined(IUTEST_NO_SFINAE) && !defined(IUTEST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
191198
@@ -242,7 +249,8 @@
242249 }
243250 inline void PrintTo(bool b, iu_ostream* os) { *os << (b ? "true" : "false"); }
244251 inline void PrintTo(const char* c, iu_ostream* os) { *os << c; }
245-inline void PrintTo(const ::std::string& str, iu_ostream* os) { *os << str.c_str(); }
252+template<typename CharT, typename Traits, typename Alloc>
253+inline void PrintTo(const ::std::basic_string<CharT, Traits, Alloc>& str, iu_ostream* os) { *os << str.c_str(); }
246254 #if !defined(IUTEST_NO_FUNCTION_TEMPLATE_ORDERING)
247255 template<typename T>
248256 inline void PrintTo(const floating_point<T>& f, iu_ostream* os)
@@ -294,7 +302,113 @@
294302 {
295303 *os << static_cast<unsigned int>(value);
296304 }
305+#if IUTEST_HAS_CXX_HDR_STRING_VIEW
306+template<typename CharT, typename Traits>
307+inline void PrintTo(const ::std::basic_string_view<CharT, Traits>& value, iu_ostream* os)
308+{
309+ const ::std::basic_string<CharT, Traits> tmp{ value };
310+ *os << tmp;
311+}
312+#endif
297313
314+#if IUTEST_HAS_CXX_HDR_OPTIONAL
315+template<typename T>
316+inline void PrintTo(const ::std::optional<T>& value, iu_ostream* os)
317+{
318+ if (value)
319+ {
320+ UniversalPrint(value.value(), os);
321+ }
322+ else
323+ {
324+ *os << "nullopt";
325+ }
326+}
327+#endif
328+
329+#if IUTEST_HAS_CXX_HDR_VARIANT
330+template<typename... Types>
331+inline void PrintTo(const ::std::variant<Types...>& value, iu_ostream* os)
332+{
333+ if (value.valueless_by_exception())
334+ {
335+ *os << "valueless_by_exception";
336+ }
337+ else
338+ {
339+ std::visit([&os](const auto& v) { UniversalPrint(v, os); }, value);
340+ }
341+}
342+inline void PrintTo(const ::std::monostate&, iu_ostream* os)
343+{
344+ *os << "monostate";
345+}
346+#endif
347+
348+#if IUTEST_HAS_CXX_HDR_ANY
349+inline void PrintTo(const ::std::any& value, iu_ostream* os)
350+{
351+ *os << "-Any type-name: " << value.type().name();
352+ DefaultPrintNonContainerTo(value, os);
353+}
354+#endif
355+
356+#if IUTEST_USE_CXX_FILESYSTEM
357+inline ::std::string FileSystemFileTypeToString(const ::std::filesystem::file_type& value)
358+{
359+ switch(value)
360+ {
361+ IUTEST_PP_NAMESPACE_ENUM_CASE_RETURN_STRING(::std::filesystem::file_type, none);
362+ IUTEST_PP_NAMESPACE_ENUM_CASE_RETURN_STRING(::std::filesystem::file_type, not_found);
363+ IUTEST_PP_NAMESPACE_ENUM_CASE_RETURN_STRING(::std::filesystem::file_type, regular);
364+ IUTEST_PP_NAMESPACE_ENUM_CASE_RETURN_STRING(::std::filesystem::file_type, directory);
365+ IUTEST_PP_NAMESPACE_ENUM_CASE_RETURN_STRING(::std::filesystem::file_type, symlink);
366+ IUTEST_PP_NAMESPACE_ENUM_CASE_RETURN_STRING(::std::filesystem::file_type, block);
367+ IUTEST_PP_NAMESPACE_ENUM_CASE_RETURN_STRING(::std::filesystem::file_type, character);
368+ IUTEST_PP_NAMESPACE_ENUM_CASE_RETURN_STRING(::std::filesystem::file_type, fifo);
369+ IUTEST_PP_NAMESPACE_ENUM_CASE_RETURN_STRING(::std::filesystem::file_type, socket);
370+ IUTEST_PP_NAMESPACE_ENUM_CASE_RETURN_STRING(::std::filesystem::file_type, unknown);
371+#if defined(IUTEST_OS_WINDOWS)
372+ IUTEST_PP_NAMESPACE_ENUM_CASE_RETURN_STRING(::std::filesystem::file_type, junction);
373+#endif
374+ default:
375+ break;
376+ }
377+ return PrintToString(static_cast<int>(value));
378+}
379+inline void PrintTo(const ::std::filesystem::path& value, iu_ostream* os)
380+{
381+ *os << value.generic_string();
382+}
383+inline void PrintTo(const ::std::filesystem::file_type& value, iu_ostream* os)
384+{
385+ *os << FileSystemFileTypeToString(value);
386+}
387+inline void PrintTo(const ::std::filesystem::perms& value, iu_ostream* os)
388+{
389+ *os << ToOctString(static_cast<UInt16>(value));
390+}
391+inline void PrintTo(const ::std::filesystem::file_status& value, iu_ostream* os)
392+{
393+ *os << FileSystemFileTypeToString(value.type()) << ": ";
394+ PrintTo(value.permissions(), os);
395+}
396+inline void PrintTo(const ::std::filesystem::space_info& value, iu_ostream* os)
397+{
398+ *os << "cpacity: " << detail::FormatSizeByte(value.capacity)
399+ << ", free: " << detail::FormatSizeByte(value.free)
400+ << ", available: " << detail::FormatSizeByte(value.available);
401+}
402+inline void PrintTo(const ::std::filesystem::directory_entry& value, iu_ostream* os)
403+{
404+ PrintTo(value.path(), os);
405+}
406+inline void PrintTo(const ::std::filesystem::directory_iterator& value, iu_ostream* os)
407+{
408+ PrintTo(*value, os);
409+}
410+#endif
411+
298412 #if IUTEST_HAS_NULLPTR
299413 inline void PrintTo(const ::std::nullptr_t&, iu_ostream* os) { *os << "nullptr"; }
300414 #endif
--- trunk/include/iutest_typed_tests.hpp (revision 1347)
+++ trunk/include/iutest_typed_tests.hpp (revision 1348)
@@ -99,6 +99,8 @@
9999 template<typename iutest_TypeParam> \
100100 void classname_<iutest_TypeParam>::Body()
101101
102+#if IUTEST_HAS_IGNORE_TEST
103+
102104 #define IIUT_TYPED_TEST_I_IGNORE(classname_, testcase_, testcasename_, testname_) \
103105 template<typename iutest_TypeParam> class classname_ : public testcase_<iutest_TypeParam> { \
104106 typedef testcase_<iutest_TypeParam> TestFixture; \
@@ -112,6 +114,8 @@
112114 template<typename iutest_TypeParam> template<typename T> \
113115 void classname_<iutest_TypeParam>::Body()
114116
117+#endif
118+
115119 #define IIUT_TYPED_TEST_(macro, testcase_, testname_) \
116120 macro(IUTEST_TEST_CLASS_NAME_(testcase_, testname_) \
117121 , IIUT_TO_VARNAME_(testcase_), IIUT_TO_NAME_(testcase_) \
@@ -126,19 +130,27 @@
126130 #define IUTEST_TYPED_TEST_(testcase_, testname_) \
127131 IIUT_TYPED_TEST_A_(IIUT_TYPED_TEST_I, testcase_, testname_)
128132
133+#if IUTEST_HAS_IGNORE_TEST
134+
129135 #define IUTEST_TYPED_TEST_IGNORE_(testcase_, testname_) \
130136 IIUT_TYPED_TEST_A_(IIUT_TYPED_TEST_I_IGNORE, testcase_, testname_)
131137
138+#endif
139+
132140 #else
133141
134142 #define IUTEST_TYPED_TEST_(testcase_, testname_) \
135143 IIUT_TYPED_TEST_(IIUT_TYPED_TEST_I, testcase_, testname_)
136144
145+#if IUTEST_HAS_IGNORE_TEST
146+
137147 #define IUTEST_TYPED_TEST_IGNORE_(testcase_, testname_) \
138148 IIUT_TYPED_TEST_(IIUT_TYPED_TEST_I_IGNORE, testcase_, testname_)
139149
140150 #endif
141151
152+#endif
153+
142154 /**
143155 * @}
144156 */
@@ -224,6 +236,8 @@
224236 template<typename iutest_TypeParam> \
225237 void IIUT_TYPED_TEST_P_NAMESPACE_(testcase_)::testname_<iutest_TypeParam>::Body()
226238
239+#if IUTEST_HAS_IGNORE_TEST
240+
227241 #define IIUT_TYPED_TEST_P_IGNORE_(testcase_, testname_) \
228242 namespace IIUT_TYPED_TEST_P_NAMESPACE_(testcase_) { \
229243 template<typename iutest_TypeParam> \
@@ -237,6 +251,8 @@
237251 template<typename iutest_TypeParam>template<typename T> \
238252 void IIUT_TYPED_TEST_P_NAMESPACE_(testcase_)::testname_<iutest_TypeParam>::Body()
239253
254+#endif
255+
240256 #define IIUT_REGISTER_TYPED_TEST_CASE_P_(testcase_, ...) \
241257 namespace IIUT_TYPED_TEST_P_NAMESPACE_(testcase_) { \
242258 typedef ::iutest::detail::Templates< __VA_ARGS__ >::type iutest_AllTests_; \
--- trunk/include/iutest_ver.hpp (revision 1347)
+++ trunk/include/iutest_ver.hpp (revision 1348)
@@ -17,11 +17,11 @@
1717
1818 //======================================================================
1919 // define
20-#define IUTEST_VER 0x01160600u //!< iutest version 1.16.6.0
20+#define IUTEST_VER 0x01169902u //!< iutest version 1.16.99.2
2121 #define IUTEST_MAJORVER 0x01u //!< Major Version
2222 #define IUTEST_MINORVER 0x16u //!< Minor Version
23-#define IUTEST_MICROVER 0x06u //!< Micro Version
24-#define IUTEST_REVISION 0x00u //!< Revision
23+#define IUTEST_MICROVER 0x99u //!< Micro Version
24+#define IUTEST_REVISION 0x02u //!< Revision
2525
2626 #define IUTEST_BUILD IUTEST_MICROVER //!< @deprecated
2727
--- trunk/test/cxx_feature_tests.cpp (revision 1347)
+++ trunk/test/cxx_feature_tests.cpp (revision 1348)
@@ -16,7 +16,12 @@
1616 //======================================================================
1717 // include
1818 #include "../include/gtest/iutest_spi_switch.hpp"
19+#include "logger_tests.hpp"
1920
21+#if IUTEST_HAS_CXX_HDR_ARRAY
22+# include <array> // NOLINT
23+#endif
24+
2025 #if IUTEST_HAS_NOEXCEPT_FUNCTION_TYPE
2126
2227 namespace
@@ -58,6 +63,229 @@
5863
5964 #endif
6065
66+#if IUTEST_HAS_CXX_HDR_STRING_VIEW
67+
68+IUTEST(StringView, Compare)
69+{
70+ ::std::string_view view = "Hello";
71+ IUTEST_ASSERT_EQ("Hello", view);
72+}
73+
74+IUTEST(StringView, PrintTo)
75+{
76+ LogChecker ck("Hello");
77+ ::std::string_view view = "Hello";
78+ IUTEST_SUCCEED() << ::iutest::PrintToString(view);
79+}
80+
81+#endif
82+
83+#if IUTEST_HAS_CXX_HDR_OPTIONAL
84+
85+IUTEST(Optional, Compare)
86+{
87+ {
88+ ::std::optional<int> opt = 0;
89+ IUTEST_EXPECT_TRUE(opt);
90+ IUTEST_EXPECT_EQ(0, opt);
91+ }
92+ {
93+ ::std::optional<int> opt = ::std::nullopt;
94+ IUTEST_EXPECT_FALSE(opt);
95+ IUTEST_EXPECT_NONFATAL_FAILURE(IUTEST_EXPECT_EQ(1234, opt), "1234");
96+ }
97+}
98+
99+IUTEST(Optional, PrintTo)
100+{
101+ {
102+ LogChecker ck("1234");
103+ ::std::optional<int> opt = 1234;
104+ IUTEST_SUCCEED() << ::iutest::PrintToString(opt);
105+ }
106+ {
107+ LogChecker ck("nullopt");
108+ ::std::optional<int> opt = ::std::nullopt;
109+ IUTEST_SUCCEED() << ::iutest::PrintToString(opt);
110+ }
111+}
112+
113+#endif
114+
115+#if IUTEST_HAS_CXX_HDR_VARIANT
116+
117+IUTEST(Variant, Compare)
118+{
119+ {
120+ ::std::variant<int, float, ::std::string> v1 = 1234;
121+ ::std::variant<int, float, ::std::string> v2 = 1234;
122+ IUTEST_EXPECT_EQ(v1, v2);
123+ }
124+}
125+
126+IUTEST(Variant, PrintTo)
127+{
128+ {
129+ LogChecker ck("1234");
130+ ::std::variant<int, float, ::std::string> v = 1234;
131+ IUTEST_SUCCEED() << ::iutest::PrintToString(v);
132+ }
133+ {
134+ LogChecker ck("test");
135+ ::std::variant<int, float, ::std::string> v("test");
136+ IUTEST_SUCCEED() << ::iutest::PrintToString(v);
137+ }
138+ {
139+ LogChecker ck("monostate");
140+ ::std::variant<std::monostate, int, float, std::string> v;
141+ IUTEST_SUCCEED() << ::iutest::PrintToString(v);
142+ }
143+ {
144+ LogChecker ck("valueless_by_exception");
145+ ::std::variant<int, float, ::std::string> v = 0.2f;
146+ try
147+ {
148+ struct S { operator int() { throw 42; } };
149+ v.emplace<0>(S());
150+ }
151+ catch(...)
152+ {
153+ }
154+ IUTEST_SUCCEED() << ::iutest::PrintToString(v);
155+ }
156+}
157+
158+#endif
159+
160+#if IUTEST_HAS_CXX_HDR_ARRAY
161+
162+IUTEST(StdArray, PrintTo)
163+{
164+ LogChecker ck("3, 1, 4");
165+ ::std::array<int, 3> ar = { { 3, 1, 4 } };
166+ IUTEST_SUCCEED() << ::iutest::PrintToString(ar);
167+}
168+
169+#endif
170+
171+#if IUTEST_HAS_CXX_HDR_ANY
172+
173+//IUTEST(Any, Compare)
174+//{
175+// {
176+// ::std::any v1 = 1;
177+// ::std::any v2 = 1;
178+// IUTEST_EXPECT_EQ(v1, v2);
179+// }
180+//}
181+
182+IUTEST(Any, PrintTo)
183+{
184+ {
185+ //LogChecker ck("1234");
186+ ::std::any v = 1234;
187+ IUTEST_SUCCEED() << ::iutest::PrintToString(v);
188+ }
189+}
190+
191+#endif
192+
193+#if IUTEST_USE_CXX_FILESYSTEM
194+
195+IUTEST(FileSystem, PathCompare)
196+{
197+ {
198+ ::std::filesystem::path v1 = "a";
199+ ::std::filesystem::path v2 = "a";
200+ IUTEST_EXPECT_EQ(v1, v2);
201+ }
202+}
203+
204+IUTEST(FileSystem, PathPrintTo)
205+{
206+ {
207+ LogChecker ck("/cxx_feature_tests.cpp");
208+ ::std::filesystem::path v = __FILE__;
209+ IUTEST_SUCCEED() << ::iutest::PrintToString(v);
210+ }
211+}
212+
213+IUTEST(FileSystem, StatusCompare)
214+{
215+ {
216+ ::std::filesystem::file_status v1 = ::std::filesystem::status(__FILE__);
217+ ::std::filesystem::file_status v2 = ::std::filesystem::status(__FILE__);
218+ IUTEST_EXPECT_EQ(v1, v2);
219+ }
220+}
221+
222+IUTEST(FileSystem, StatusPrintTo)
223+{
224+ {
225+ LogChecker ck("regular: 0");
226+ ::std::filesystem::file_status v = ::std::filesystem::status(__FILE__);
227+ IUTEST_SUCCEED() << ::iutest::PrintToString(v);
228+ }
229+}
230+
231+IUTEST(FileSystem, SpaceInfoPrintTo)
232+{
233+ {
234+ LogChecker ck("cpacity");
235+ ::std::filesystem::path path = __FILE__;
236+ ::std::filesystem::space_info v = ::std::filesystem::space(path.remove_filename());
237+ IUTEST_SUCCEED() << ::iutest::PrintToString(v);
238+ }
239+ {
240+ LogChecker ck("free");
241+ ::std::filesystem::path path = __FILE__;
242+ ::std::filesystem::space_info v = ::std::filesystem::space(path.remove_filename());
243+ IUTEST_SUCCEED() << ::iutest::PrintToString(v);
244+ }
245+ {
246+ LogChecker ck("available");
247+ ::std::filesystem::path path = __FILE__;
248+ ::std::filesystem::space_info v = ::std::filesystem::space(path.remove_filename());
249+ IUTEST_SUCCEED() << ::iutest::PrintToString(v);
250+ }
251+}
252+
253+IUTEST(FileSystem, DirectoryEntryCompare)
254+{
255+ {
256+ ::std::filesystem::path path = __FILE__;
257+ ::std::filesystem::directory_entry x = *::std::filesystem::directory_iterator(path.remove_filename());
258+ ::std::filesystem::directory_entry v1 = x;
259+ ::std::filesystem::directory_entry v2 = x;
260+ IUTEST_EXPECT_EQ(v1, v2);
261+ }
262+}
263+
264+IUTEST(FileSystem, DirectoryEntryPrintTo)
265+{
266+ {
267+ ::std::filesystem::path path = __FILE__;
268+ ::std::filesystem::path directory = path.remove_filename().append("testdata");
269+ LogChecker ck(directory.generic_string());
270+ ::std::filesystem::directory_entry x = *::std::filesystem::directory_iterator(directory);
271+ IUTEST_SUCCEED() << ::iutest::PrintToString(x);
272+ }
273+}
274+
275+IUTEST(FileSystem, DirectoryIteratorPrintTo)
276+{
277+ {
278+ ::std::filesystem::path path = __FILE__;
279+ ::std::filesystem::path directory = path.remove_filename().append("testdata");
280+ LogChecker ck(directory.generic_string());
281+ ::std::filesystem::directory_iterator x = ::std::filesystem::directory_iterator(directory);
282+ IUTEST_SUCCEED() << ::iutest::PrintToString(x);
283+ }
284+}
285+
286+#endif
287+
288+
61289 #ifdef UNICODE
62290 int wmain(int argc, wchar_t* argv[])
63291 #else
--- trunk/test/logger_tests.hpp (revision 1347)
+++ trunk/test/logger_tests.hpp (revision 1348)
@@ -51,4 +51,34 @@
5151
5252 #endif
5353
54+#if !defined(IUTEST_USE_GTEST)
55+
56+class LogChecker
57+{
58+ TestLogger printer_logger;
59+ ::std::string m_str;
60+public:
61+ explicit LogChecker(const char* str) : m_str(str)
62+ {
63+ ::iutest::detail::iuConsole::SetLogger(&printer_logger);
64+ }
65+ explicit LogChecker(const std::string& str) : m_str(str)
66+ {
67+ ::iutest::detail::iuConsole::SetLogger(&printer_logger);
68+ }
69+ ~LogChecker(void)
70+ {
71+ ::iutest::detail::iuConsole::SetLogger(NULL);
72+ IUTEST_EXPECT_STRIN(m_str.c_str(), printer_logger.c_str());
73+ printer_logger.clear();
74+ }
75+};
76+#else
77+class LogChecker
78+{
79+public:
80+ explicit LogChecker(const char*) {}
81+};
5482 #endif
83+
84+#endif
--- trunk/test/matcher_tests.cpp (revision 1347)
+++ trunk/test/matcher_tests.cpp (revision 1348)
@@ -493,6 +493,51 @@
493493
494494 #endif
495495
496+IUTEST(MatcherFailure, FloatNear)
497+{
498+ CHECK_FAILURE( IUTEST_ASSERT_THAT(f0, FloatNear(1.0f, f0)), "Near: " );
499+ CHECK_FAILURE( IUTEST_ASSERT_THAT(0/f0, FloatNear(0/f0, 1.0f)), "Near: " );
500+ CHECK_FAILURE( IUTEST_ASSERT_THAT(0/f0, FloatingPointNear(f0, 1.0f)), "Near: " );
501+}
502+
503+IUTEST(MatcherFailure, DoubleNear)
504+{
505+ CHECK_FAILURE( IUTEST_ASSERT_THAT(d0, DoubleNear(1.0, d0)), "Near: " );
506+ CHECK_FAILURE( IUTEST_ASSERT_THAT(0/d0, DoubleNear(0/d0, 1.0)), "Near: " );
507+ CHECK_FAILURE( IUTEST_ASSERT_THAT(0/d0, FloatingPointNear(0/d0, 1.0)), "Near: " );
508+}
509+
510+#if IUTEST_HAS_LONG_DOUBLE
511+
512+IUTEST(MatcherFailure, LongDoubleNear)
513+{
514+ CHECK_FAILURE( IUTEST_ASSERT_THAT(ld0, LongDoubleNear(1.0, ld0)), "Near: " );
515+ CHECK_FAILURE( IUTEST_ASSERT_THAT(0/ld0, LongDoubleNear(0/ld0, 1.0)), "Near: " );
516+}
517+
518+#endif
519+
520+IUTEST(MatcherFailure, NanSensitiveFloatNear)
521+{
522+ CHECK_FAILURE( IUTEST_ASSERT_THAT(f0, NanSensitiveFloatNear(1.0f, f0)), "Near: " );
523+ CHECK_FAILURE( IUTEST_ASSERT_THAT(f0, NanSensitiveFloatingPointNear(1.0f, f0)), "Near: " );
524+}
525+
526+IUTEST(MatcherFailure, NanSensitiveDoubleNear)
527+{
528+ CHECK_FAILURE( IUTEST_ASSERT_THAT(d0, NanSensitiveDoubleNear(1.0, d0)), "Near: " );
529+ CHECK_FAILURE( IUTEST_ASSERT_THAT(d0, NanSensitiveFloatingPointNear(1.0, d0)), "Near: " );
530+}
531+
532+#if IUTEST_HAS_LONG_DOUBLE
533+
534+IUTEST(MatcherFailure, NanSensitiveLongDoubleNear)
535+{
536+ CHECK_FAILURE( IUTEST_ASSERT_THAT(ld0, NanSensitiveLongDoubleNear(1.0, ld0)), "Near: " );
537+}
538+
539+#endif
540+
496541 IUTEST(MatcherFailure, StrEq)
497542 {
498543 CHECK_FAILURE( IUTEST_ASSERT_THAT("hoge", StrEq("Hoge")), "StrEq: Hoge");
@@ -530,6 +575,7 @@
530575 {
531576 CHECK_FAILURE( IUTEST_ASSERT_THAT("hoge", EndsWith("Ge")) , "EndsWith: Ge" );
532577 CHECK_FAILURE( IUTEST_ASSERT_THAT("hoge", EndsWith("gee")), "EndsWith: gee" );
578+ CHECK_FAILURE( IUTEST_ASSERT_THAT("hoge", EndsWith("TooLongLongEnds")) , "EndsWith: TooLongLongEnds" );
533579 }
534580
535581 IUTEST(MatcherFailure, Equals)
--- trunk/test/param_test_with_any_tests.cpp (revision 1347)
+++ trunk/test/param_test_with_any_tests.cpp (revision 1348)
@@ -6,7 +6,7 @@
66 *
77 * @author t.shirayanagi
88 * @par copyright
9- * Copyright (C) 2013-2016, Takazumi Shirayanagi\n
9+ * Copyright (C) 2013-2018, Takazumi Shirayanagi\n
1010 * This software is released under the new BSD License,
1111 * see LICENSE
1212 */
@@ -51,6 +51,19 @@
5151
5252 IUTEST_INSTANTIATE_TEST_CASE_AP(My1, AnyParamTest, ::iutest::Values(0));
5353
54+namespace workaround
55+{
56+
57+IUTEST_AP(AnyParamTest2, Test)
58+{
59+ const ::std::string value = GetParam< ::std::string >();
60+ IUTEST_ASSERT_EQ("0", value);
61+}
62+
63+IUTEST_INSTANTIATE_TEST_CASE_AP(My2, AnyParamTest2, ::iutest::Values("0"));
64+
65+} // end of namespace workaround
66+
5467 #endif
5568
5669 #if IUTEST_HAS_AUTOFIXTURE_PARAM_TEST
--- trunk/test/printers_tests.cpp (revision 1347)
+++ trunk/test/printers_tests.cpp (revision 1348)
@@ -19,36 +19,6 @@
1919 #include "iutest.hpp"
2020 #include "logger_tests.hpp"
2121
22-#if IUTEST_HAS_CXX_HDR_ARRAY
23-# include <array> // NOLINT
24-#endif
25-
26-#if !defined(IUTEST_USE_GTEST)
27-TestLogger printer_logger;
28-
29-class LogChecker
30-{
31- ::std::string m_str;
32-public:
33- explicit LogChecker(const char* str) : m_str(str)
34- {
35- ::iutest::detail::iuConsole::SetLogger(&printer_logger);
36- }
37- ~LogChecker(void)
38- {
39- ::iutest::detail::iuConsole::SetLogger(NULL);
40- IUTEST_EXPECT_STRIN(m_str.c_str(), printer_logger.c_str());
41- printer_logger.clear();
42- }
43-};
44-#else
45-class LogChecker
46-{
47-public:
48- explicit LogChecker(const char*) {}
49-};
50-#endif
51-
5222 #ifdef UNICODE
5323 int wmain(int argc, wchar_t* argv[])
5424 #else
@@ -87,6 +57,21 @@
8757 }
8858
8959 #if !defined(IUTEST_USE_GTEST)
60+
61+IUTEST(PrintToTest, IutestAnyNotInitialized)
62+{
63+ ::iutest::any a;
64+ LogChecker ck("empty");
65+ IUTEST_SUCCEED() << ::iutest::PrintToString(a);
66+}
67+
68+IUTEST(PrintToTest, IutestAnyString)
69+{
70+ ::iutest::any a = "test";
71+ LogChecker ck("test");
72+ IUTEST_SUCCEED() << ::iutest::PrintToString(a);
73+}
74+
9075 struct BigVar
9176 {
9277 int big[10];
@@ -368,12 +353,3 @@
368353 }
369354 #endif
370355
371-#if IUTEST_HAS_CXX_HDR_ARRAY
372-IUTEST(PrintToTest, Array)
373-{
374- LogChecker ck("3, 1, 4");
375- ::std::array<int, 3> ar = { { 3, 1, 4 } };
376- IUTEST_SUCCEED() << ::iutest::PrintToString(ar);
377-}
378-#endif
379-
--- trunk/test/tap_file_generator_listener_tests.cpp (revision 1347)
+++ trunk/test/tap_file_generator_listener_tests.cpp (revision 1348)
@@ -6,7 +6,7 @@
66 *
77 * @author t.shirayanagi
88 * @par copyright
9- * Copyright (C) 2014-2016, Takazumi Shirayanagi\n
9+ * Copyright (C) 2014-2018, Takazumi Shirayanagi\n
1010 * This software is released under the new BSD License,
1111 * see LICENSE
1212 */
@@ -17,7 +17,6 @@
1717 // include
1818 #include "iutest.hpp"
1919 #include "../include/listener/iutest_tap_printer.hpp"
20-#include "logger_tests.hpp"
2120
2221 #if !defined(IUTEST_USE_GTEST) && IUTEST_HAS_STRINGSTREAM && IUTEST_HAS_ASSERTION_RETURN
2322 # define TAP_TEST 1
--- trunk/test/unit_tests.cpp (revision 1347)
+++ trunk/test/unit_tests.cpp (revision 1348)
@@ -174,7 +174,7 @@
174174 ::iutest::StdioFile file;
175175 ::iutest::internal::FilePath filename(__FILE__);
176176 IUTEST_ASSUME_TRUE( filename.FileOrDirectoryExists() );
177- IUTEST_ASSERT_TRUE( file.Open(filename.c_str(), iutest::IFile::OpenAppend) );
177+ IUTEST_ASSERT_TRUE( file.Open(filename.string().c_str(), iutest::IFile::OpenAppend) );
178178 IUTEST_ASSERT_LT(0u, file.GetSize());
179179 }
180180
@@ -181,6 +181,50 @@
181181 #endif
182182
183183
184+IUTEST(UnitTest, ToHexString)
185+{
186+ IUTEST_EXPECT_STREQ( "00", ::iutest::detail::ToHexString< ::iutest::UInt8 >(0));
187+ IUTEST_EXPECT_STREQ( "0000", ::iutest::detail::ToHexString< ::iutest::UInt16 >(0));
188+ IUTEST_EXPECT_STREQ( "00000000", ::iutest::detail::ToHexString< ::iutest::UInt32 >(0));
189+ IUTEST_EXPECT_STREQ("0000000000000000", ::iutest::detail::ToHexString< ::iutest::UInt64 >(0));
190+ IUTEST_EXPECT_STREQ( "01234567", ::iutest::detail::ToHexString(0x01234567u));
191+}
192+
193+IUTEST(UnitTest, ToOctString)
194+{
195+ IUTEST_EXPECT_STREQ( "000", ::iutest::detail::ToOctString< ::iutest::UInt8 >(0));
196+ IUTEST_EXPECT_STREQ( "000000", ::iutest::detail::ToOctString< ::iutest::UInt16 >(0));
197+ IUTEST_EXPECT_STREQ( "00000000000", ::iutest::detail::ToOctString< ::iutest::UInt32 >(0));
198+ IUTEST_EXPECT_STREQ("0000000000000000000000", ::iutest::detail::ToOctString< ::iutest::UInt64 >(0));
199+ IUTEST_EXPECT_STREQ( "377", ::iutest::detail::ToOctString< ::iutest::UInt8 >(0377u));
200+}
201+
202+IUTEST(UnitTest, FormatSizeByte)
203+{
204+ IUTEST_EXPECT_STREQ("0B", ::iutest::detail::FormatSizeByte(0));
205+ IUTEST_EXPECT_STREQ("2B", ::iutest::detail::FormatSizeByte(2));
206+ IUTEST_EXPECT_STREQ("1KB", ::iutest::detail::FormatSizeByte(1024));
207+ IUTEST_EXPECT_STREQ("1.0KB", ::iutest::detail::FormatSizeByte(1025));
208+ IUTEST_EXPECT_STREQ("1MB", ::iutest::detail::FormatSizeByte(1024 * 1024));
209+ IUTEST_EXPECT_STREQ("1.9MB", ::iutest::detail::FormatSizeByte(2 * 1024 * 1024 - 1));
210+ IUTEST_EXPECT_STREQ("1GB", ::iutest::detail::FormatSizeByte(1024 * 1024 * 1024));
211+ IUTEST_EXPECT_STREQ("1TB", ::iutest::detail::FormatSizeByte(1024ull * 1024 * 1024 * 1024));
212+}
213+
214+IUTEST(UnitTest, EmptyAny)
215+{
216+ ::iutest::any a;
217+ ::iutest::any* p = NULL;
218+ IUTEST_EXPECT_NULL(::iutest::unsafe_any_cast<int>(p));
219+ IUTEST_EXPECT_NULL(::iutest::unsafe_any_cast<int>(&a));
220+}
221+
222+IUTEST(UnitTest, StringAny)
223+{
224+ ::iutest::any a = "test";
225+ IUTEST_EXPECT_EQ("test", ::iutest::any_cast< ::std::string >(a));
226+}
227+
184228 #ifdef UNICODE
185229 int wmain(int argc, wchar_t* argv[])
186230 #else
Show on old repository browser