• R/O
  • SSH
  • HTTPS

iutest: コミット


コミットメタ情報

リビジョン1304 (tree)
日時2018-02-04 20:18:00
作者srz_zumix

ログメッセージ

fix cppcheck warnings

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


split japanese test name sample

git@1f25ec62b9a1d07c4d64c957d6eb54595bcf18ef


update vscode workspace settings

git@72702f030e4af0581617e92e503f3adf326e393b


update rocro cppcheck ignore

git@e123e0f9b009de4083ce5110595f3c838f0cc468


suppress syntaxError

git@7caa93f697e9fac0cfc610726a35efe100a33a1d


update cppcheck config

git@4834e165623afb73bca24f3518d332f7cc2fd0b3

変更サマリ

差分

--- trunk/samples/japanese.cpp (revision 0)
+++ trunk/samples/japanese.cpp (revision 1304)
@@ -0,0 +1,36 @@
1+//======================================================================
2+//-----------------------------------------------------------------------
3+/**
4+ * @file japanese.cpp
5+ * @brief japanese test name
6+ *
7+ * @author t.shirayanagi
8+ * @par copyright
9+ * Copyright (C) 2018, Takazumi Shirayanagi\n
10+ * This software is released under the new BSD License,
11+ * see LICENSE
12+*/
13+//-----------------------------------------------------------------------
14+//======================================================================
15+#include "../include/iutest.hpp"
16+
17+/* ---------------------------------------------------
18+ * 日本語テスト名
19+*//*--------------------------------------------------*/
20+#if IUTEST_HAS_TESTNAME_ALIAS_JP
21+
22+IUTEST_PRAGMA_MSC_WARN_PUSH()
23+IUTEST_PRAGMA_MSC_WARN_DISABLE(4566)
24+
25+IUTEST(IUTEST_JAPANESE_NAME(テスト), IUTEST_JAPANESE_NAME(テスト))
26+{
27+}
28+class JapaneseFixedTest : public ::iutest::Test {};
29+
30+IUTEST_F(IUTEST_JAPANESE_NAME_F(あいうえお, JapaneseFixedTest), IUTEST_JAPANESE_NAME(かきくけこ))
31+{
32+}
33+
34+IUTEST_PRAGMA_MSC_WARN_POP()
35+
36+#endif
--- trunk/samples/simple.cpp (revision 1303)
+++ trunk/samples/simple.cpp (revision 1304)
@@ -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 */
@@ -44,27 +44,6 @@
4444 IUTEST_SKIP() << "empty.";
4545 }
4646
47-/* ---------------------------------------------------
48- * 日本語テスト名
49-*//*--------------------------------------------------*/
50-#if IUTEST_HAS_TESTNAME_ALIAS_JP
51-
52-IUTEST_PRAGMA_MSC_WARN_PUSH()
53-IUTEST_PRAGMA_MSC_WARN_DISABLE(4566)
54-
55-IUTEST(IUTEST_JAPANESE_NAME(テスト), IUTEST_JAPANESE_NAME(テスト))
56-{
57-}
58-class JapaneseFixedTest : public ::iutest::Test {};
59-
60-IUTEST_F(IUTEST_JAPANESE_NAME_F(あいうえお, JapaneseFixedTest), IUTEST_JAPANESE_NAME(かきくけこ))
61-{
62-}
63-
64-IUTEST_PRAGMA_MSC_WARN_POP()
65-
66-#endif
67-
6847 #if IUTEST_HAS_ASSERTION_RETURN
6948
7049 /* ---------------------------------------------------
--- trunk/.gitignore (revision 1303)
+++ trunk/.gitignore (revision 1304)
@@ -31,6 +31,7 @@
3131 .svn
3232 .sonar
3333 .vs
34+.vscode
3435 .tox
3536 env.*/
3637
--- trunk/test/cppcheck/Makefile (revision 1303)
+++ trunk/test/cppcheck/Makefile (revision 1304)
@@ -52,7 +52,12 @@
5252
5353 SRC_CPP=$(wildcard ../../src/*.cpp)
5454 SAMPLES=$(wildcard ../../samples/*.cpp)
55+TESTS=$(wildcard ../../test/*.cpp)
5556
57+SRCS=$(SRC_CPP) \
58+ $(TESTS) \
59+ #$(SAMPLES) \
60+
5661 TARGETS=cppcheck_result.xml
5762
5863 #
@@ -73,7 +78,7 @@
7378 cppcheck --version
7479
7580 check-config:
76- cppcheck $(IUTEST_INCLUDE) $(OPTIONS) $(SRC_CPP) --check-config --xml 2> $@.xml
81+ cppcheck $(IUTEST_INCLUDE) $(OPTIONS) $(SRCS) --check-config --xml 2> $@.xml
7782
7883 $(TARGETS): $(SRC_CPP) Makefile
79- cppcheck $(IUTEST_INCLUDE) $(OPTIONS) $(SRC_CPP) --xml 2> $@
84+ cppcheck $(IUTEST_INCLUDE) $(OPTIONS) $(SRCS) --xml 2> $@
--- trunk/include/iutest_ver.hpp (revision 1303)
+++ trunk/include/iutest_ver.hpp (revision 1304)
@@ -17,11 +17,11 @@
1717
1818 //======================================================================
1919 // define
20-#define IUTEST_VER 0x01160205u //!< iutest version 1.16.2.5
20+#define IUTEST_VER 0x01160206u //!< iutest version 1.16.2.6
2121 #define IUTEST_MAJORVER 0x01u //!< Major Version
2222 #define IUTEST_MINORVER 0x16u //!< Minor Version
2323 #define IUTEST_MICROVER 0x02u //!< Micro Version
24-#define IUTEST_REVISION 0x05u //!< Revision
24+#define IUTEST_REVISION 0x06u //!< Revision
2525
2626 #define IUTEST_BUILD IUTEST_MICROVER //!< @deprecated
2727
--- trunk/include/internal/iutest_mfc.hpp (revision 1303)
+++ trunk/include/internal/iutest_mfc.hpp (revision 1304)
@@ -34,6 +34,8 @@
3434 mfc_iterator(const T& container, POSITION pos) : m_container(container), m_pos(pos) {}
3535 mfc_iterator(const mfc_iterator& rhs) : m_container(rhs.m_container), m_pos(rhs.m_pos) {}
3636
37+ mfc_iterator& operator = (const mfc_iterator& rhs) { m_container = rhs.m_container; m_pos = m_pos; return *this; }
38+
3739 mfc_iterator& operator ++ () { advance(); return *this; }
3840 mfc_iterator& operator ++ (int) { mfc_iterator r(*this); advance(); return r; }
3941
@@ -68,6 +70,8 @@
6870 mfc_map_iterator(const T& container, POSITION pos) : m_container(container), m_pos(pos) {}
6971 mfc_map_iterator(const mfc_map_iterator& rhs) : m_container(rhs.m_container), m_pos(rhs.m_pos) {}
7072
73+ mfc_map_iterator& operator = (const mfc_map_iterator& rhs) { m_container = rhs.m_container; m_pos = m_pos; return *this; }
74+
7175 mfc_map_iterator& operator ++ () { advance(); return *this; }
7276 mfc_map_iterator& operator ++ (int) { mfc_iterator r(*this); advance(); return r; }
7377
--- trunk/include/internal/iutest_file.hpp (revision 1303)
+++ trunk/include/internal/iutest_file.hpp (revision 1304)
@@ -55,21 +55,14 @@
5555 */
5656 class IFileSystem
5757 {
58- template<typename T>
59- struct Variable
60- {
61- static IFileSystem* m_pInstance;
62- };
63-
64- typedef Variable<void> var;
6558 public:
6659 IFileSystem()
6760 {
68- var::m_pInstance = this;
61+ SetInstance(this);
6962 }
7063 virtual ~IFileSystem()
7164 {
72- var::m_pInstance = NULL;
65+ SetInstance(NULL);
7366 }
7467
7568 public:
@@ -76,7 +69,7 @@
7669 virtual void Initialize() {}
7770
7871 public:
79- static IFileSystem* GetInstance() { return var::m_pInstance; }
72+ static IFileSystem* GetInstance() { return GetInstanceVariable().pInstance; }
8073
8174 public:
8275 static IFile* New()
@@ -121,14 +114,20 @@
121114 private:
122115 virtual IFile* Create() = 0;
123116 virtual void Delete(IFile*) = 0;
117+
118+private:
119+ struct InstanceVariable
120+ {
121+ IFileSystem* pInstance;
122+ };
123+
124+ static InstanceVariable& GetInstanceVariable() { static InstanceVariable v; return v; }
125+ static void SetInstance(IFileSystem* pFileSystem) { GetInstanceVariable().pInstance = pFileSystem; }
124126 };
125127
126128 } // end of namespace detail
127129 } // end of namespace iutest
128130
129-template<typename T>
130-::iutest::detail::IFileSystem* ::iutest::detail::IFileSystem::Variable<T>::m_pInstance = NULL;
131-
132131 namespace iutest
133132 {
134133
--- trunk/include/internal/iutest_filepath.hpp (revision 1303)
+++ trunk/include/internal/iutest_filepath.hpp (revision 1304)
@@ -88,6 +88,8 @@
8888 size_t length() const { return m_path.length(); }
8989
9090 public:
91+ iuFilePath & operator = (const iuFilePath& rhs) { m_path = rhs.m_path; return *this; }
92+
9193 iuFilePath& operator == (const iuFilePath& rhs)
9294 {
9395 m_path = rhs.m_path;
--- trunk/include/internal/iutest_console.hpp (revision 1303)
+++ trunk/include/internal/iutest_console.hpp (revision 1304)
@@ -64,14 +64,6 @@
6464 */
6565 class iuConsole
6666 {
67- template<typename T>
68- struct Variable
69- {
70- static iuLogger* m_pLogger;
71- };
72-
73- typedef Variable<void> var;
74-
7567 public:
7668 //! コンソール文字色
7769 enum Color
@@ -119,8 +111,8 @@
119111 //! Logger のセット
120112 static iuLogger* SetLogger(iuLogger* logger)
121113 {
122- iuLogger* pre = var::m_pLogger;
123- var::m_pLogger = logger;
114+ iuLogger* pre = GetLoggerInstanceVariable().pInstance;
115+ GetLoggerInstanceVariable().pInstance = logger;
124116 return pre;
125117 }
126118
@@ -167,6 +159,15 @@
167159 static inline bool IsShouldUseColor(bool use_color);
168160 static inline bool HasColorConsole();
169161 static inline bool IsStringEqual(const char* str1, const char* str2) { return strcmp(str1, str2) == 0; }
162+
163+private:
164+ struct LoggerInstanceVariable
165+ {
166+ iuLogger* pInstance;
167+ };
168+
169+ static LoggerInstanceVariable& GetLoggerInstanceVariable() { static LoggerInstanceVariable v; return v; }
170+ static iuLogger* GetLogger() { return GetLoggerInstanceVariable().pInstance; }
170171 };
171172
172173 inline void iuConsole::output(const char *fmt, ...)
@@ -178,9 +179,10 @@
178179 }
179180 inline void iuConsole::voutput(const char* fmt, va_list va)
180181 {
181- if( var::m_pLogger != NULL )
182+ iuLogger* pLogger = GetLogger();
183+ if(pLogger != NULL)
182184 {
183- var::m_pLogger->voutput(fmt, va);
185+ pLogger->voutput(fmt, va);
184186 }
185187 else
186188 {
@@ -309,19 +311,4 @@
309311 } // end of namespace detail
310312 } // end of namespace iutest
311313
312-#if IUTEST_HAS_LIB && IUTEST_HAS_EXTERN_TEMPLATE
313-
314-IUTEST_PRAGMA_EXTERN_TEMPLATE_WARN_DISABLE_BEGIN()
315-
316-extern template struct ::iutest::detail::iuConsole::Variable<void>;
317-
318-IUTEST_PRAGMA_EXTERN_TEMPLATE_WARN_DISABLE_END()
319-
320-#else
321-
322-template<typename T>
323-::iutest::detail::iuLogger* ::iutest::detail::iuConsole::Variable<T>::m_pLogger = NULL;
324-
325-#endif
326-
327314 #endif // INCG_IRIS_IUTEST_CONSOLE_HPP_DCAC5025_B7BB_424E_A849_9E6FE0A3B460_
--- trunk/rocro.yml (revision 1303)
+++ trunk/rocro.yml (revision 1304)
@@ -31,6 +31,7 @@
3131 -I: include
3232 -D:
3333 - IUTEST_HAS_CLOCK=1
34+ - IUTEST_HAS_TESTNAME_ALIAS_JP=0
3435 -U:
3536 - _WIN32
3637 - _MSC_VER
@@ -48,6 +49,7 @@
4849 - "unusedStructMember:*/iutest_constant.hpp"
4950 - "unusedStructMember:*/iutest_defs.hpp"
5051 - "unusedStructMember:*/iutest_type_traits.hpp"
52+ - "preprocessorErrorDirective:*/iutest_param_tests.hpp" # IUTEST_HAS_TESTFIXTURE_ALIAS_BY_TUPLE negative failure
5153 - unmatchedSuppression
5254 --max-configs: 20
5355 #--force:
@@ -54,6 +56,8 @@
5456 ignore:
5557 - test/spi_tests_decl.cpp
5658 - test/benchmark/*.cpp
59+ - test/japanese_tests.cpp # unhandled character(s)
60+ - samples/japanese.cpp # unhandled character(s)
5761 - tools/paiza.io/*.cpp
5862 - tools/wandbox/*.cpp
5963 - projects/**/*.c
--- trunk/projects/make/Makefile (revision 1303)
+++ trunk/projects/make/Makefile (revision 1304)
@@ -24,6 +24,7 @@
2424 disabledtest.cpp \
2525 exception.cpp \
2626 fixture.cpp \
27+ japanese.cpp \
2728 matcher.cpp \
2829 parameterized.cpp \
2930 printto.cpp \
--- trunk/projects/cmake/CMakeLists.txt (revision 1303)
+++ trunk/projects/cmake/CMakeLists.txt (revision 1304)
@@ -54,6 +54,7 @@
5454 ../../samples/disabledtest.cpp
5555 ../../samples/exception.cpp
5656 ../../samples/fixture.cpp
57+ ../../samples/japanese.cpp
5758 ../../samples/matcher.cpp
5859 ../../samples/parameterized.cpp
5960 ../../samples/printto.cpp
旧リポジトリブラウザで表示