@@ -36,7 +36,7 @@ class TestDivision : public TestFixture
3636 { }
3737
3838private:
39- void check (const char code[], bool style = true , bool all = true )
39+ void check (const char code[], bool style = true )
4040 {
4141 // Tokenize..
4242 Tokenizer tokenizer;
@@ -47,7 +47,6 @@ class TestDivision : public TestFixture
4747 errout.str (" " );
4848
4949 Settings settings;
50- settings.inconclusive = all;
5150 settings._checkCodingStyle = style;
5251
5352 // Check for unsigned divisions..
@@ -59,7 +58,6 @@ class TestDivision : public TestFixture
5958 {
6059 TEST_CASE (division1);
6160 TEST_CASE (division2);
62- TEST_CASE (division3);
6361 TEST_CASE (division4);
6462 TEST_CASE (division5);
6563 TEST_CASE (division6);
@@ -76,7 +74,8 @@ class TestDivision : public TestFixture
7674 " unsigned int uvar = 2;\n "
7775 " return ivar / uvar;\n "
7876 " }\n " );
79- ASSERT_EQUALS (" [test.cpp:5]: (possible style) Division with signed and unsigned operators\n " , errout.str ());
77+ TODO_ASSERT_EQUALS (" [test.cpp:5]: (style) Division with signed and unsigned operators\n " , errout.str ());
78+ ASSERT_EQUALS (" " , errout.str ());
8079 }
8180
8281 void division2 ()
@@ -87,20 +86,8 @@ class TestDivision : public TestFixture
8786 " unsigned int uvar = 2;\n "
8887 " return uvar / ivar;\n "
8988 " }\n " );
90- ASSERT_EQUALS (" [test.cpp:5]: (possible style) Division with signed and unsigned operators\n " , errout.str ());
91- }
92-
93- void division3 ()
94- {
95- check (" typedef int s32;\n "
96- " typedef unsigned int u32;\n "
97- " void f()\n "
98- " {\n "
99- " s32 ivar = -2;\n "
100- " u32 uvar = 2;\n "
101- " return uvar / ivar;\n "
102- " }\n " );
103- ASSERT_EQUALS (" [test.cpp:7]: (possible style) Division with signed and unsigned operators\n " , errout.str ());
89+ TODO_ASSERT_EQUALS (" [test.cpp:5]: (style) Division with signed and unsigned operators\n " , errout.str ());
90+ ASSERT_EQUALS (" " , errout.str ());
10491 }
10592
10693 void division4 ()
@@ -155,8 +142,7 @@ class TestDivision : public TestFixture
155142 check (" void foo()\n "
156143 " {\n "
157144 " unsigned int val = 32;\n "
158- " int i = -96 / val; }\n "
159- );
145+ " int i = -96 / val; }\n " );
160146 ASSERT_EQUALS (" [test.cpp:4]: (error) Unsigned division. The result will be wrong.\n " , errout.str ());
161147 }
162148
@@ -169,35 +155,26 @@ class TestDivision : public TestFixture
169155 " unsigned int a;\n "
170156 " unsigned int c = a / b;\n "
171157 " }\n "
172- " }\n " , false , true );
158+ " }\n " , true );
173159 ASSERT_EQUALS (" " , errout.str ());
174160
175161 check (" void foo(int b)\n "
176162 " {\n "
177- " if (b > 0)\n "
163+ " if (b < 0)\n "
178164 " {\n "
179165 " unsigned int a;\n "
180166 " unsigned int c = a / b;\n "
181167 " }\n "
182- " }\n " , true , false );
168+ " }\n " , true );
183169 ASSERT_EQUALS (" " , errout.str ());
184-
185- check (" void foo(int b)\n "
186- " {\n "
187- " if (b > 0)\n "
188- " {\n "
189- " unsigned int a;\n "
190- " unsigned int c = a / b;\n "
191- " }\n "
192- " }\n " , true , true );
193- ASSERT_EQUALS (" [test.cpp:6]: (possible style) Division with signed and unsigned operators\n " , errout.str ());
170+ TODO_ASSERT_EQUALS (" unsigned division" , errout.str ());
194171
195172 check (" void a(int i) { }\n "
196173 " int foo( unsigned int sz )\n "
197174 " {\n "
198175 " register unsigned int i=1;\n "
199176 " return i/sz;\n "
200- " }\n " , true , true );
177+ " }\n " , true );
201178 ASSERT_EQUALS (" " , errout.str ());
202179 }
203180
@@ -209,28 +186,17 @@ class TestDivision : public TestFixture
209186 " unsigned long uvar = 2;\n "
210187 " return ivar / uvar;\n "
211188 " }\n " );
212- ASSERT_EQUALS (" [test.cpp:5]: (possible style) Division with signed and unsigned operators\n " , errout.str ());
189+ ASSERT_EQUALS (" " , errout.str ());
190+ TODO_ASSERT_EQUALS (" unsigned division" , errout.str ());
213191
214192 check (" void f()\n "
215193 " {\n "
216194 " int ivar = -2;\n "
217195 " unsigned long long uvar = 2;\n "
218196 " return ivar / uvar;\n "
219197 " }\n " );
220- ASSERT_EQUALS (" [test.cpp:5]: (possible style) Division with signed and unsigned operators\n " , errout.str ());
221-
222- check (" template<class A, class B> class C\n "
223- " {\n "
224- " A a;\n "
225- " B b;\n "
226- " void foo() { a / b; }\n "
227- " };\n "
228- " C<int, unsigned int> c1;\n "
229- " C<int, unsigned long> c2;\n "
230- " C<int, unsigned long long> c3;\n " );
231- ASSERT_EQUALS (" [test.cpp:5]: (possible style) Division with signed and unsigned operators\n "
232- " [test.cpp:5]: (possible style) Division with signed and unsigned operators\n "
233- " [test.cpp:5]: (possible style) Division with signed and unsigned operators\n " , errout.str ());
198+ ASSERT_EQUALS (" " , errout.str ());
199+ TODO_ASSERT_EQUALS (" unsigned division" , errout.str ());
234200 }
235201};
236202
0 commit comments