diff --git a/test/testtokenize.cpp b/test/testtokenize.cpp index 20dd88230..ebfff24ef 100644 --- a/test/testtokenize.cpp +++ b/test/testtokenize.cpp @@ -78,22 +78,22 @@ private: TEST_CASE(longtok); - TEST_CASE(removeCast1); - TEST_CASE(removeCast2); - TEST_CASE(removeCast3); - TEST_CASE(removeCast4); - TEST_CASE(removeCast5); - TEST_CASE(removeCast7); - TEST_CASE(removeCast8); - TEST_CASE(removeCast9); - TEST_CASE(removeCast10); - TEST_CASE(removeCast11); - TEST_CASE(removeCast12); - TEST_CASE(removeCast13); - TEST_CASE(removeCast14); - TEST_CASE(removeCast15); // #5996 - don't remove cast in 'a+static_cast(b?60:0)' - TEST_CASE(removeCast16); // #6278 - TEST_CASE(removeCast17); // #6110 - don't remove any parentheses in 'a(b)(c)' + TEST_CASE(simplifyCasts1); + TEST_CASE(simplifyCasts2); + TEST_CASE(simplifyCasts3); + TEST_CASE(simplifyCasts4); + TEST_CASE(simplifyCasts5); + TEST_CASE(simplifyCasts7); + TEST_CASE(simplifyCasts8); + TEST_CASE(simplifyCasts9); + TEST_CASE(simplifyCasts10); + TEST_CASE(simplifyCasts11); + TEST_CASE(simplifyCasts12); + TEST_CASE(simplifyCasts13); + TEST_CASE(simplifyCasts14); + TEST_CASE(simplifyCasts15); // #5996 - don't remove cast in 'a+static_cast(b?60:0)' + TEST_CASE(simplifyCasts16); // #6278 + TEST_CASE(simplifyCasts17); // #6110 - don't remove any parentheses in 'a(b)(c)' TEST_CASE(inlineasm); TEST_CASE(simplifyAsm2); // #4725 (writing asm() around "^{}") @@ -882,64 +882,64 @@ private: // Don’t remove "(int *)".. - void removeCast1() { + void simplifyCasts1() { const char code[] = "int *f(int *);"; ASSERT_EQUALS("int * f ( int * ) ;", tokenizeAndStringify(code, true)); } // remove static_cast.. - void removeCast2() { + void simplifyCasts2() { const char code[] = "t = (static_cast *>(&p));\n"; ASSERT_EQUALS("t = & p ;", tokenizeAndStringify(code, true)); } - void removeCast3() { + void simplifyCasts3() { // ticket #961 const char code[] = "assert (iplen >= (unsigned) ipv4->ip_hl * 4 + 20);"; const char expected[] = "assert ( iplen >= ipv4 . ip_hl * 4 + 20 ) ;"; ASSERT_EQUALS(expected, tokenizeAndStringify(code, true)); } - void removeCast4() { + void simplifyCasts4() { // ticket #970 const char code[] = "if (a >= (unsigned)(b)) {}"; const char expected[] = "if ( a >= ( unsigned int ) ( b ) ) { }"; ASSERT_EQUALS(expected, tokenizeAndStringify(code, true)); } - void removeCast5() { + void simplifyCasts5() { // ticket #1817 ASSERT_EQUALS("a . data = f ;", tokenizeAndStringify("a->data = reinterpret_cast(static_cast(f));", true)); } - void removeCast7() { + void simplifyCasts7() { ASSERT_EQUALS("str = malloc ( 3 )", tokenizeAndStringify("str=(char **)malloc(3)", true)); } - void removeCast8() { + void simplifyCasts8() { ASSERT_EQUALS("ptr1 = ptr2", tokenizeAndStringify("ptr1=(int * **)ptr2", true)); } - void removeCast9() { + void simplifyCasts9() { ASSERT_EQUALS("f ( ( double ) ( v1 ) * v2 )", tokenizeAndStringify("f((double)(v1)*v2)", true)); ASSERT_EQUALS("int v1 ; f ( ( double ) ( v1 ) * v2 )", tokenizeAndStringify("int v1; f((double)(v1)*v2)", true)); ASSERT_EQUALS("f ( ( A ) ( B ) & x )", tokenizeAndStringify("f((A)(B)&x)", true)); // #4439 } - void removeCast10() { + void simplifyCasts10() { ASSERT_EQUALS("; ( * f ) ( p ) ;", tokenizeAndStringify("; (*(void (*)(char *))f)(p);", true)); } - void removeCast11() { + void simplifyCasts11() { ASSERT_EQUALS("; x = 0 ;", tokenizeAndStringify("; *(int *)&x = 0;", true)); } - void removeCast12() { + void simplifyCasts12() { // #3935 - don't remove this cast ASSERT_EQUALS("; ( ( short * ) data ) [ 5 ] = 0 ;", tokenizeAndStringify("; ((short*)data)[5] = 0;", true)); } - void removeCast13() { + void simplifyCasts13() { // casting deref / address of ASSERT_EQUALS("; int x ; x = * y ;", tokenizeAndStringify(";int x=(int)*y;",true)); ASSERT_EQUALS("; int x ; x = & y ;", tokenizeAndStringify(";int x=(int)&y;",true)); @@ -957,24 +957,24 @@ private: ASSERT_EQUALS("; int a ; a = ( int ) ~ c ;", tokenizeAndStringify("; int a = (int)~c;", true)); } - void removeCast14() { // const + void simplifyCasts14() { // const // #5081 ASSERT_EQUALS("( ! ( & s ) . a )", tokenizeAndStringify("(! ( (struct S const *) &s)->a)", true)); // #5244 ASSERT_EQUALS("bar ( & ptr ) ;", tokenizeAndStringify("bar((const X**)&ptr);",true)); } - void removeCast15() { // #5996 - don't remove cast in 'a+static_cast(b?60:0)' + void simplifyCasts15() { // #5996 - don't remove cast in 'a+static_cast(b?60:0)' ASSERT_EQUALS("a + ( b ? 60 : 0 ) ;", tokenizeAndStringify("a + static_cast(b ? 60 : 0);", true)); } - void removeCast16() { // #6278 + void simplifyCasts16() { // #6278 ASSERT_EQUALS("Get ( pArray ) ;", tokenizeAndStringify("Get((CObject*&)pArray);", true)); } - void removeCast17() { // #6110 - don't remove any parentheses in 'a(b)(c)' + void simplifyCasts17() { // #6110 - don't remove any parentheses in 'a(b)(c)' ASSERT_EQUALS("if ( a ( b ) ( c ) >= 3 )", tokenizeAndStringify("if (a(b)(c) >= 3)", true)); }