Skip to content

Commit 9f4d4bd

Browse files
committed
cppcheck-opensource#6167 Refactoring: rename test functions. Rename TestTokenizer::removeCast*. TestTokenizer::varid* doesn't exist (anymore?).
1 parent 47634a0 commit 9f4d4bd

1 file changed

Lines changed: 32 additions & 32 deletions

File tree

test/testtokenize.cpp

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -78,22 +78,22 @@ class TestTokenizer : public TestFixture {
7878

7979
TEST_CASE(longtok);
8080

81-
TEST_CASE(removeCast1);
82-
TEST_CASE(removeCast2);
83-
TEST_CASE(removeCast3);
84-
TEST_CASE(removeCast4);
85-
TEST_CASE(removeCast5);
86-
TEST_CASE(removeCast7);
87-
TEST_CASE(removeCast8);
88-
TEST_CASE(removeCast9);
89-
TEST_CASE(removeCast10);
90-
TEST_CASE(removeCast11);
91-
TEST_CASE(removeCast12);
92-
TEST_CASE(removeCast13);
93-
TEST_CASE(removeCast14);
94-
TEST_CASE(removeCast15); // #5996 - don't remove cast in 'a+static_cast<int>(b?60:0)'
95-
TEST_CASE(removeCast16); // #6278
96-
TEST_CASE(removeCast17); // #6110 - don't remove any parentheses in 'a(b)(c)'
81+
TEST_CASE(simplifyCasts1);
82+
TEST_CASE(simplifyCasts2);
83+
TEST_CASE(simplifyCasts3);
84+
TEST_CASE(simplifyCasts4);
85+
TEST_CASE(simplifyCasts5);
86+
TEST_CASE(simplifyCasts7);
87+
TEST_CASE(simplifyCasts8);
88+
TEST_CASE(simplifyCasts9);
89+
TEST_CASE(simplifyCasts10);
90+
TEST_CASE(simplifyCasts11);
91+
TEST_CASE(simplifyCasts12);
92+
TEST_CASE(simplifyCasts13);
93+
TEST_CASE(simplifyCasts14);
94+
TEST_CASE(simplifyCasts15); // #5996 - don't remove cast in 'a+static_cast<int>(b?60:0)'
95+
TEST_CASE(simplifyCasts16); // #6278
96+
TEST_CASE(simplifyCasts17); // #6110 - don't remove any parentheses in 'a(b)(c)'
9797

9898
TEST_CASE(inlineasm);
9999
TEST_CASE(simplifyAsm2); // #4725 (writing asm() around "^{}")
@@ -882,64 +882,64 @@ class TestTokenizer : public TestFixture {
882882

883883

884884
// Don’t remove "(int *)"..
885-
void removeCast1() {
885+
void simplifyCasts1() {
886886
const char code[] = "int *f(int *);";
887887
ASSERT_EQUALS("int * f ( int * ) ;", tokenizeAndStringify(code, true));
888888
}
889889

890890
// remove static_cast..
891-
void removeCast2() {
891+
void simplifyCasts2() {
892892
const char code[] = "t = (static_cast<std::vector<int> *>(&p));\n";
893893
ASSERT_EQUALS("t = & p ;", tokenizeAndStringify(code, true));
894894
}
895895

896-
void removeCast3() {
896+
void simplifyCasts3() {
897897
// ticket #961
898898
const char code[] = "assert (iplen >= (unsigned) ipv4->ip_hl * 4 + 20);";
899899
const char expected[] = "assert ( iplen >= ipv4 . ip_hl * 4 + 20 ) ;";
900900
ASSERT_EQUALS(expected, tokenizeAndStringify(code, true));
901901
}
902902

903-
void removeCast4() {
903+
void simplifyCasts4() {
904904
// ticket #970
905905
const char code[] = "if (a >= (unsigned)(b)) {}";
906906
const char expected[] = "if ( a >= ( unsigned int ) ( b ) ) { }";
907907
ASSERT_EQUALS(expected, tokenizeAndStringify(code, true));
908908
}
909909

910-
void removeCast5() {
910+
void simplifyCasts5() {
911911
// ticket #1817
912912
ASSERT_EQUALS("a . data = f ;", tokenizeAndStringify("a->data = reinterpret_cast<void*>(static_cast<intptr_t>(f));", true));
913913
}
914914

915-
void removeCast7() {
915+
void simplifyCasts7() {
916916
ASSERT_EQUALS("str = malloc ( 3 )", tokenizeAndStringify("str=(char **)malloc(3)", true));
917917
}
918918

919-
void removeCast8() {
919+
void simplifyCasts8() {
920920
ASSERT_EQUALS("ptr1 = ptr2", tokenizeAndStringify("ptr1=(int * **)ptr2", true));
921921
}
922922

923-
void removeCast9() {
923+
void simplifyCasts9() {
924924
ASSERT_EQUALS("f ( ( double ) ( v1 ) * v2 )", tokenizeAndStringify("f((double)(v1)*v2)", true));
925925
ASSERT_EQUALS("int v1 ; f ( ( double ) ( v1 ) * v2 )", tokenizeAndStringify("int v1; f((double)(v1)*v2)", true));
926926
ASSERT_EQUALS("f ( ( A ) ( B ) & x )", tokenizeAndStringify("f((A)(B)&x)", true)); // #4439
927927
}
928928

929-
void removeCast10() {
929+
void simplifyCasts10() {
930930
ASSERT_EQUALS("; ( * f ) ( p ) ;", tokenizeAndStringify("; (*(void (*)(char *))f)(p);", true));
931931
}
932932

933-
void removeCast11() {
933+
void simplifyCasts11() {
934934
ASSERT_EQUALS("; x = 0 ;", tokenizeAndStringify("; *(int *)&x = 0;", true));
935935
}
936936

937-
void removeCast12() {
937+
void simplifyCasts12() {
938938
// #3935 - don't remove this cast
939939
ASSERT_EQUALS("; ( ( short * ) data ) [ 5 ] = 0 ;", tokenizeAndStringify("; ((short*)data)[5] = 0;", true));
940940
}
941941

942-
void removeCast13() {
942+
void simplifyCasts13() {
943943
// casting deref / address of
944944
ASSERT_EQUALS("; int x ; x = * y ;", tokenizeAndStringify(";int x=(int)*y;",true));
945945
ASSERT_EQUALS("; int x ; x = & y ;", tokenizeAndStringify(";int x=(int)&y;",true));
@@ -957,24 +957,24 @@ class TestTokenizer : public TestFixture {
957957
ASSERT_EQUALS("; int a ; a = ( int ) ~ c ;", tokenizeAndStringify("; int a = (int)~c;", true));
958958
}
959959

960-
void removeCast14() { // const
960+
void simplifyCasts14() { // const
961961
// #5081
962962
ASSERT_EQUALS("( ! ( & s ) . a )", tokenizeAndStringify("(! ( (struct S const *) &s)->a)", true));
963963
// #5244
964964
ASSERT_EQUALS("bar ( & ptr ) ;", tokenizeAndStringify("bar((const X**)&ptr);",true));
965965
}
966966

967-
void removeCast15() { // #5996 - don't remove cast in 'a+static_cast<int>(b?60:0)'
967+
void simplifyCasts15() { // #5996 - don't remove cast in 'a+static_cast<int>(b?60:0)'
968968
ASSERT_EQUALS("a + ( b ? 60 : 0 ) ;",
969969
tokenizeAndStringify("a + static_cast<int>(b ? 60 : 0);", true));
970970
}
971971

972-
void removeCast16() { // #6278
972+
void simplifyCasts16() { // #6278
973973
ASSERT_EQUALS("Get ( pArray ) ;",
974974
tokenizeAndStringify("Get((CObject*&)pArray);", true));
975975
}
976976

977-
void removeCast17() { // #6110 - don't remove any parentheses in 'a(b)(c)'
977+
void simplifyCasts17() { // #6110 - don't remove any parentheses in 'a(b)(c)'
978978
ASSERT_EQUALS("if ( a ( b ) ( c ) >= 3 )",
979979
tokenizeAndStringify("if (a(b)(c) >= 3)", true));
980980
}

0 commit comments

Comments
 (0)