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
@@ -31,6 +31,7 @@ | ||
31 | 31 | .svn |
32 | 32 | .sonar |
33 | 33 | .vs |
34 | +.vscode | |
34 | 35 | .tox |
35 | 36 | env.*/ |
36 | 37 |
@@ -64,14 +64,6 @@ | ||
64 | 64 | */ |
65 | 65 | class iuConsole |
66 | 66 | { |
67 | - template<typename T> | |
68 | - struct Variable | |
69 | - { | |
70 | - static iuLogger* m_pLogger; | |
71 | - }; | |
72 | - | |
73 | - typedef Variable<void> var; | |
74 | - | |
75 | 67 | public: |
76 | 68 | //! コンソール文字色 |
77 | 69 | enum Color |
@@ -119,8 +111,8 @@ | ||
119 | 111 | //! Logger のセット |
120 | 112 | static iuLogger* SetLogger(iuLogger* logger) |
121 | 113 | { |
122 | - iuLogger* pre = var::m_pLogger; | |
123 | - var::m_pLogger = logger; | |
114 | + iuLogger* pre = GetLoggerInstanceVariable().pInstance; | |
115 | + GetLoggerInstanceVariable().pInstance = logger; | |
124 | 116 | return pre; |
125 | 117 | } |
126 | 118 |
@@ -167,6 +159,15 @@ | ||
167 | 159 | static inline bool IsShouldUseColor(bool use_color); |
168 | 160 | static inline bool HasColorConsole(); |
169 | 161 | 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; } | |
170 | 171 | }; |
171 | 172 | |
172 | 173 | inline void iuConsole::output(const char *fmt, ...) |
@@ -178,9 +179,10 @@ | ||
178 | 179 | } |
179 | 180 | inline void iuConsole::voutput(const char* fmt, va_list va) |
180 | 181 | { |
181 | - if( var::m_pLogger != NULL ) | |
182 | + iuLogger* pLogger = GetLogger(); | |
183 | + if(pLogger != NULL) | |
182 | 184 | { |
183 | - var::m_pLogger->voutput(fmt, va); | |
185 | + pLogger->voutput(fmt, va); | |
184 | 186 | } |
185 | 187 | else |
186 | 188 | { |
@@ -309,19 +311,4 @@ | ||
309 | 311 | } // end of namespace detail |
310 | 312 | } // end of namespace iutest |
311 | 313 | |
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 | - | |
327 | 314 | #endif // INCG_IRIS_IUTEST_CONSOLE_HPP_DCAC5025_B7BB_424E_A849_9E6FE0A3B460_ |
@@ -55,21 +55,14 @@ | ||
55 | 55 | */ |
56 | 56 | class IFileSystem |
57 | 57 | { |
58 | - template<typename T> | |
59 | - struct Variable | |
60 | - { | |
61 | - static IFileSystem* m_pInstance; | |
62 | - }; | |
63 | - | |
64 | - typedef Variable<void> var; | |
65 | 58 | public: |
66 | 59 | IFileSystem() |
67 | 60 | { |
68 | - var::m_pInstance = this; | |
61 | + SetInstance(this); | |
69 | 62 | } |
70 | 63 | virtual ~IFileSystem() |
71 | 64 | { |
72 | - var::m_pInstance = NULL; | |
65 | + SetInstance(NULL); | |
73 | 66 | } |
74 | 67 | |
75 | 68 | public: |
@@ -76,7 +69,7 @@ | ||
76 | 69 | virtual void Initialize() {} |
77 | 70 | |
78 | 71 | public: |
79 | - static IFileSystem* GetInstance() { return var::m_pInstance; } | |
72 | + static IFileSystem* GetInstance() { return GetInstanceVariable().pInstance; } | |
80 | 73 | |
81 | 74 | public: |
82 | 75 | static IFile* New() |
@@ -121,14 +114,20 @@ | ||
121 | 114 | private: |
122 | 115 | virtual IFile* Create() = 0; |
123 | 116 | 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; } | |
124 | 126 | }; |
125 | 127 | |
126 | 128 | } // end of namespace detail |
127 | 129 | } // end of namespace iutest |
128 | 130 | |
129 | -template<typename T> | |
130 | -::iutest::detail::IFileSystem* ::iutest::detail::IFileSystem::Variable<T>::m_pInstance = NULL; | |
131 | - | |
132 | 131 | namespace iutest |
133 | 132 | { |
134 | 133 |
@@ -88,6 +88,8 @@ | ||
88 | 88 | size_t length() const { return m_path.length(); } |
89 | 89 | |
90 | 90 | public: |
91 | + iuFilePath & operator = (const iuFilePath& rhs) { m_path = rhs.m_path; return *this; } | |
92 | + | |
91 | 93 | iuFilePath& operator == (const iuFilePath& rhs) |
92 | 94 | { |
93 | 95 | m_path = rhs.m_path; |
@@ -34,6 +34,8 @@ | ||
34 | 34 | mfc_iterator(const T& container, POSITION pos) : m_container(container), m_pos(pos) {} |
35 | 35 | mfc_iterator(const mfc_iterator& rhs) : m_container(rhs.m_container), m_pos(rhs.m_pos) {} |
36 | 36 | |
37 | + mfc_iterator& operator = (const mfc_iterator& rhs) { m_container = rhs.m_container; m_pos = m_pos; return *this; } | |
38 | + | |
37 | 39 | mfc_iterator& operator ++ () { advance(); return *this; } |
38 | 40 | mfc_iterator& operator ++ (int) { mfc_iterator r(*this); advance(); return r; } |
39 | 41 |
@@ -68,6 +70,8 @@ | ||
68 | 70 | mfc_map_iterator(const T& container, POSITION pos) : m_container(container), m_pos(pos) {} |
69 | 71 | mfc_map_iterator(const mfc_map_iterator& rhs) : m_container(rhs.m_container), m_pos(rhs.m_pos) {} |
70 | 72 | |
73 | + mfc_map_iterator& operator = (const mfc_map_iterator& rhs) { m_container = rhs.m_container; m_pos = m_pos; return *this; } | |
74 | + | |
71 | 75 | mfc_map_iterator& operator ++ () { advance(); return *this; } |
72 | 76 | mfc_map_iterator& operator ++ (int) { mfc_iterator r(*this); advance(); return r; } |
73 | 77 |
@@ -17,11 +17,11 @@ | ||
17 | 17 | |
18 | 18 | //====================================================================== |
19 | 19 | // define |
20 | -#define IUTEST_VER 0x01160205u //!< iutest version 1.16.2.5 | |
20 | +#define IUTEST_VER 0x01160206u //!< iutest version 1.16.2.6 | |
21 | 21 | #define IUTEST_MAJORVER 0x01u //!< Major Version |
22 | 22 | #define IUTEST_MINORVER 0x16u //!< Minor Version |
23 | 23 | #define IUTEST_MICROVER 0x02u //!< Micro Version |
24 | -#define IUTEST_REVISION 0x05u //!< Revision | |
24 | +#define IUTEST_REVISION 0x06u //!< Revision | |
25 | 25 | |
26 | 26 | #define IUTEST_BUILD IUTEST_MICROVER //!< @deprecated |
27 | 27 |
@@ -54,6 +54,7 @@ | ||
54 | 54 | ../../samples/disabledtest.cpp |
55 | 55 | ../../samples/exception.cpp |
56 | 56 | ../../samples/fixture.cpp |
57 | + ../../samples/japanese.cpp | |
57 | 58 | ../../samples/matcher.cpp |
58 | 59 | ../../samples/parameterized.cpp |
59 | 60 | ../../samples/printto.cpp |
@@ -24,6 +24,7 @@ | ||
24 | 24 | disabledtest.cpp \ |
25 | 25 | exception.cpp \ |
26 | 26 | fixture.cpp \ |
27 | + japanese.cpp \ | |
27 | 28 | matcher.cpp \ |
28 | 29 | parameterized.cpp \ |
29 | 30 | printto.cpp \ |
@@ -31,6 +31,7 @@ | ||
31 | 31 | -I: include |
32 | 32 | -D: |
33 | 33 | - IUTEST_HAS_CLOCK=1 |
34 | + - IUTEST_HAS_TESTNAME_ALIAS_JP=0 | |
34 | 35 | -U: |
35 | 36 | - _WIN32 |
36 | 37 | - _MSC_VER |
@@ -48,6 +49,7 @@ | ||
48 | 49 | - "unusedStructMember:*/iutest_constant.hpp" |
49 | 50 | - "unusedStructMember:*/iutest_defs.hpp" |
50 | 51 | - "unusedStructMember:*/iutest_type_traits.hpp" |
52 | + - "preprocessorErrorDirective:*/iutest_param_tests.hpp" # IUTEST_HAS_TESTFIXTURE_ALIAS_BY_TUPLE negative failure | |
51 | 53 | - unmatchedSuppression |
52 | 54 | --max-configs: 20 |
53 | 55 | #--force: |
@@ -54,6 +56,8 @@ | ||
54 | 56 | ignore: |
55 | 57 | - test/spi_tests_decl.cpp |
56 | 58 | - test/benchmark/*.cpp |
59 | + - test/japanese_tests.cpp # unhandled character(s) | |
60 | + - samples/japanese.cpp # unhandled character(s) | |
57 | 61 | - tools/paiza.io/*.cpp |
58 | 62 | - tools/wandbox/*.cpp |
59 | 63 | - projects/**/*.c |
@@ -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 |
@@ -6,7 +6,7 @@ | ||
6 | 6 | * |
7 | 7 | * @author t.shirayanagi |
8 | 8 | * @par copyright |
9 | - * Copyright (C) 2014-2016, Takazumi Shirayanagi\n | |
9 | + * Copyright (C) 2014-2018, Takazumi Shirayanagi\n | |
10 | 10 | * This software is released under the new BSD License, |
11 | 11 | * see LICENSE |
12 | 12 | */ |
@@ -44,27 +44,6 @@ | ||
44 | 44 | IUTEST_SKIP() << "empty."; |
45 | 45 | } |
46 | 46 | |
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 | - | |
68 | 47 | #if IUTEST_HAS_ASSERTION_RETURN |
69 | 48 | |
70 | 49 | /* --------------------------------------------------- |
@@ -52,7 +52,12 @@ | ||
52 | 52 | |
53 | 53 | SRC_CPP=$(wildcard ../../src/*.cpp) |
54 | 54 | SAMPLES=$(wildcard ../../samples/*.cpp) |
55 | +TESTS=$(wildcard ../../test/*.cpp) | |
55 | 56 | |
57 | +SRCS=$(SRC_CPP) \ | |
58 | + $(TESTS) \ | |
59 | + #$(SAMPLES) \ | |
60 | + | |
56 | 61 | TARGETS=cppcheck_result.xml |
57 | 62 | |
58 | 63 | # |
@@ -73,7 +78,7 @@ | ||
73 | 78 | cppcheck --version |
74 | 79 | |
75 | 80 | 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 | |
77 | 82 | |
78 | 83 | $(TARGETS): $(SRC_CPP) Makefile |
79 | - cppcheck $(IUTEST_INCLUDE) $(OPTIONS) $(SRC_CPP) --xml 2> $@ | |
84 | + cppcheck $(IUTEST_INCLUDE) $(OPTIONS) $(SRCS) --xml 2> $@ |