Skip to content

Commit

Permalink
Update Extract Method tests
Browse files Browse the repository at this point in the history
EXF20 was actually an Extract Method test, not Extract Function
  • Loading branch information
LegalizeAdulthood committed Dec 31, 2023
1 parent d41cef7 commit 46173d5
Show file tree
Hide file tree
Showing 22 changed files with 376 additions and 376 deletions.
42 changes: 21 additions & 21 deletions RefactorTest/ExtractMethod.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@ struct Bar

void Method1()
{
// #TEST#: EM1 Extract Method on next line
// #TEST#: EM1 Extract Method on next line, void goink()
_x = 3;
_y = 4;
}

void ConstOperation() const
{
// #TEST#: EM19 Extract Method on next line
// #TEST#: EM19 Extract Method on next line, void goink(int &x) const
int x = Function1(_x) + Function2();
int y = x * 2;
require_equal(_x + 2, x);
Expand All @@ -35,7 +35,7 @@ struct Bar
int (*result)();
if (x < 0)
{
// #TEST#: EM2 Extract Method on next line
// #TEST#: EM2 Extract Method on next line, void goink(int (*&result)())
result = Function1;
}
else
Expand All @@ -55,7 +55,7 @@ struct Bar
void (Bar::*member)(int);
if (x < 0)
{
// #TEST#: EM3 Extract Method on next line
// #TEST#: EM3 Extract Method on next line, void goink(void (Bar::*&member)())
member = &Bar::Operation1;
}
else
Expand All @@ -71,8 +71,8 @@ struct Bar
MethodPtr member;
if (x < 0)
{
// #TEST#: EM4 Extract Method on next line
// #TEST#: EM20 Extract Method on rhs of assignment
// #TEST#: EM4 Extract Method on next line, void goink(MethodPtr &member)
// #TEST#: EM20 Extract Method on rhs of assignment, MethodPtr goink()
member = &Bar::Operation1;
}
else
Expand All @@ -87,7 +87,7 @@ struct Bar
void (Bar::*member)(int) const;
if (x < 0)
{
// #TEST#: EM5 Extract Method on next line
// #TEST#: EM5 Extract Method on next line, void goink(void (Bar::*&member)(int) const)
member = &Bar::Const1;
}
else
Expand All @@ -103,7 +103,7 @@ struct Bar
ConstMethodPtr member;
if (x < 0)
{
// #TEST#: EM6 Extract Method on next line
// #TEST#: EM6 Extract Method on next line, void goink(ConstMethodPtr &member)
member = &Bar::Const1;
}
else
Expand All @@ -121,7 +121,7 @@ class Foo

void Method1()
{
// #TEST#: EM7 Extract Method on next line
// #TEST#: EM7 Extract Method on next line, void goink()
_x = 3;
_y = 4;
}
Expand All @@ -131,7 +131,7 @@ class Foo
int (*result)();
if (x < 0)
{
// #TEST#: EM8 Extract Method on next line
// #TEST#: EM8 Extract Method on next line, void goink(int (*&result)())
result = Function1;
}
else
Expand All @@ -152,7 +152,7 @@ class Foo
{
if (x < 0)
{
// #TEST#: EM9 Extract Method on next line
// #TEST#: EM9 Extract Method on next line, void goink()
member = &Foo::Operation1;
}
else
Expand All @@ -167,7 +167,7 @@ class Foo
{
if (x < 0)
{
// #TEST#: EM10 Extract Method on next line
// #TEST#: EM10 Extract Method on next line, void goink()
member = &Foo::Operation1;
}
else
Expand All @@ -182,7 +182,7 @@ class Foo
{
if (x < 0)
{
// #TEST#: EM11 Extract Method on next line
// #TEST#: EM11 Extract Method on next line, void goink()
cmember = &Foo::Const1;
}
else
Expand All @@ -198,7 +198,7 @@ class Foo
ConstMethodPtr member;
if (x < 0)
{
// #TEST#: EM12 Extract Method on next line
// #TEST#: EM12 Extract Method on next line, void goink(ConstMethodPtr &member)
member = &Foo::Const1;
}
else
Expand Down Expand Up @@ -229,7 +229,7 @@ union Frob

void Method1()
{
// #TEST#: EM13 Extract Method on next line
// #TEST#: EM13 Extract Method on next line, void goink()
i = 3;
}

Expand All @@ -238,7 +238,7 @@ union Frob
{
if (x < 0)
{
// #TEST#: EM14 Extract Method on next line
// #TEST#: EM14 Extract Method on next line, void goink()
fn = Function1;
}
else
Expand All @@ -258,7 +258,7 @@ union Frob
{
if (x < 0)
{
// #TEST#: EM15 Extract Method on next line
// #TEST#: EM15 Extract Method on next line, void goink()
member = &Frob::Operation1;
}
else
Expand All @@ -274,7 +274,7 @@ union Frob
{
if (x < 0)
{
// #TEST#: EM16 Extract Method on next line
// #TEST#: EM16 Extract Method on next line, void goink()
member_ptr = &Frob::Operation1;
}
else
Expand All @@ -289,7 +289,7 @@ union Frob
{
if (x < 0)
{
// #TEST#: EM17 Extract Method on next line
// #TEST#: EM17 Extract Method on next line, void goink()
cmember = &Frob::Const1;
}
else
Expand All @@ -305,7 +305,7 @@ union Frob
{
if (x < 0)
{
// #TEST#: EM18 Extract Method on next line
// #TEST#: EM18 Extract Method on next line, void goink()
cmember_ptr = &Frob::Const1;
}
else
Expand All @@ -323,7 +323,7 @@ class Operator

operator float()
{
// #TEST#: EXF20 Extract expression and position before Internal
// #TEST#: EM21 Extract return expression, float goink()
return float(operator int());
}

Expand Down
30 changes: 15 additions & 15 deletions results/diffs/EM1.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
diff --git a/RefactorTest/ExtractMethod.cpp b/RefactorTest/ExtractMethod.cpp
index bf17201..5785815 100644
index c5bd1b8..d073f59 100644
--- a/RefactorTest/ExtractMethod.cpp
+++ b/RefactorTest/ExtractMethod.cpp
@@ -15,10 +15,15 @@ namespace ExtractMethodNamespace
int _x;
int _y;
@@ -14,10 +14,15 @@ struct Bar
int _x;
int _y;

+ void Goink()
+ {
+ _x = 3;
+ }
+ void goink()
+ {
+ _x = 3;
+ }
+
void Method1()
{
// #TEST#: EM1 Extract Method on next line
- _x = 3;
+ Goink();
_y = 4;
}
void Method1()
{
// #TEST#: EM1 Extract Method on next line, void goink()
- _x = 3;
+ goink();
_y = 4;
}

34 changes: 17 additions & 17 deletions results/diffs/EM10.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
diff --git a/RefactorTest/ExtractMethod.cpp b/RefactorTest/ExtractMethod.cpp
index bf17201..c5b8316 100644
index 03d4f8d..968c93d 100644
--- a/RefactorTest/ExtractMethod.cpp
+++ b/RefactorTest/ExtractMethod.cpp
@@ -166,12 +166,18 @@ namespace ExtractMethodNamespace
}
@@ -163,12 +163,18 @@ public:
}

typedef void (Foo::*MethodPtr)(int);
typedef void (Foo::*MethodPtr)(int);
+
+ void Goink()
+ {
+ member = &Foo::Operation1;
+ }
+ void goink()
+ {
+ member = &Foo::Operation1;
+ }
+
MethodPtr Method4(int x)
MethodPtr Method4(int x)
{
if (x < 0)
{
// #TEST#: EM10 Extract Method on next line, void goink()
- member = &Foo::Operation1;
+ goink();
}
else
{
if (x < 0)
{
// #TEST#: EM10 Extract Method on next line
- member = &Foo::Operation1;
+ Goink();
}
else
{
34 changes: 17 additions & 17 deletions results/diffs/EM11.txt
Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
diff --git a/RefactorTest/ExtractMethod.cpp b/RefactorTest/ExtractMethod.cpp
index bf17201..a9e9525 100644
index 03d4f8d..48a6ec8 100644
--- a/RefactorTest/ExtractMethod.cpp
+++ b/RefactorTest/ExtractMethod.cpp
@@ -181,12 +181,18 @@ namespace ExtractMethodNamespace
}
@@ -178,12 +178,18 @@ public:
}

void (Foo::*cmember)(int) const;
void (Foo::*cmember)(int) const;
+
+ void Goink()
+ {
+ cmember = &Foo::Const1;
+ }
+ void goink()
+ {
+ cmember = &Foo::Const1;
+ }
+
void (Foo::*Method5(int x))(int) const
void (Foo::*Method5(int x))(int) const
{
if (x < 0)
{
// #TEST#: EM11 Extract Method on next line, void goink()
- cmember = &Foo::Const1;
+ goink();
}
else
{
if (x < 0)
{
// #TEST#: EM11 Extract Method on next line
- cmember = &Foo::Const1;
+ Goink();
}
else
{
36 changes: 18 additions & 18 deletions results/diffs/EM12.txt
Original file line number Diff line number Diff line change
@@ -1,25 +1,25 @@
diff --git a/RefactorTest/ExtractMethod.cpp b/RefactorTest/ExtractMethod.cpp
index bf17201..54a4a6a 100644
index 03d4f8d..b50399e 100644
--- a/RefactorTest/ExtractMethod.cpp
+++ b/RefactorTest/ExtractMethod.cpp
@@ -196,13 +196,19 @@ namespace ExtractMethodNamespace
}
@@ -193,13 +193,19 @@ public:
}

typedef void (Foo::*ConstMethodPtr)(int) const;
typedef void (Foo::*ConstMethodPtr)(int) const;
+
+ void Goink(ConstMethodPtr& member)
+ {
+ member = &Foo::Const1;
+ }
+ void goink(ConstMethodPtr &member)
+ {
+ member = &Foo::Const1;
+ }
+
ConstMethodPtr Method6(int x)
ConstMethodPtr Method6(int x)
{
ConstMethodPtr member;
if (x < 0)
{
// #TEST#: EM12 Extract Method on next line, void goink(ConstMethodPtr &member)
- member = &Foo::Const1;
+ goink(member);
}
else
{
ConstMethodPtr member;
if (x < 0)
{
// #TEST#: EM12 Extract Method on next line
- member = &Foo::Const1;
+ Goink(member);
}
else
{
30 changes: 15 additions & 15 deletions results/diffs/EM13.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
diff --git a/RefactorTest/ExtractMethod.cpp b/RefactorTest/ExtractMethod.cpp
index bf17201..7dbd017 100644
index 03d4f8d..ca613d4 100644
--- a/RefactorTest/ExtractMethod.cpp
+++ b/RefactorTest/ExtractMethod.cpp
@@ -230,10 +230,15 @@ namespace ExtractMethodNamespace
float f;
double d;
@@ -227,10 +227,15 @@ union Frob
float f;
double d;

+ void Goink()
+ {
+ i = 3;
+ }
+ void goink()
+ {
+ i = 3;
+ }
+
void Method1()
{
// #TEST#: EM13 Extract Method on next line
- i = 3;
+ Goink();
}
void Method1()
{
// #TEST#: EM13 Extract Method on next line, void goink()
- i = 3;
+ goink();
}

int (*fn)();
int (*fn)();
Loading

0 comments on commit 46173d5

Please sign in to comment.