-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore test case to Extract Function in C file. Update diffs.
- Loading branch information
1 parent
ac555a6
commit 7571485
Showing
22 changed files
with
377 additions
and
337 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
diff --git a/RefactorTest/ExtractFunction.cpp b/RefactorTest/ExtractFunction.cpp | ||
index d6416f3..d4a9acc 100644 | ||
index e4fa731..4b3f11a 100644 | ||
--- a/RefactorTest/ExtractFunction.cpp | ||
+++ b/RefactorTest/ExtractFunction.cpp | ||
@@ -7,10 +7,16 @@ extern void TestExtractFunctionCFile(); | ||
@@ -6,10 +6,16 @@ extern void TestExtractFunctionCFile(); | ||
|
||
namespace ExtractFunction | ||
{ | ||
+ void Goink(int& x) | ||
+ { | ||
+ x = 3; | ||
+ } | ||
+void goink(int &x) | ||
+{ | ||
+ x = 3; | ||
+} | ||
+ | ||
int TestInteger() | ||
{ | ||
// #TEST#: EXF1 Extract function on statement | ||
- int x = 3; | ||
+ int x; | ||
+ Goink(x); | ||
REQUIRE_EQUAL(3, x); | ||
// #TEST#: EXF2 Extract function on statement | ||
x *= 3; | ||
int TestInteger() | ||
{ | ||
// #TEST#: EXF1 Extract function on statement | ||
- int x = 3; | ||
+ int x; | ||
+ goink(x); | ||
REQUIRE_EQUAL(3, x); | ||
// #TEST#: EXF2 Extract function on statement | ||
x *= 3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
diff --git a/RefactorTest/ExtractFunction.cpp b/RefactorTest/ExtractFunction.cpp | ||
index d6416f3..ef19526 100644 | ||
index e4fa731..8db307b 100644 | ||
--- a/RefactorTest/ExtractFunction.cpp | ||
+++ b/RefactorTest/ExtractFunction.cpp | ||
@@ -7,6 +7,11 @@ extern void TestExtractFunctionCFile(); | ||
@@ -6,6 +6,11 @@ extern void TestExtractFunctionCFile(); | ||
|
||
namespace ExtractFunction | ||
{ | ||
+ void Goink(int& x) | ||
+ { | ||
+ x &= 3; | ||
+ } | ||
+void goink(int &x) | ||
+{ | ||
+ x &= 3; | ||
+} | ||
+ | ||
int TestInteger() | ||
{ | ||
// #TEST#: EXF1 Extract function on statement | ||
@@ -38,7 +43,7 @@ namespace ExtractFunction | ||
x |= 3; | ||
REQUIRE_EQUAL(11, x); | ||
// #TEST#: EXF10 Extract function on statement | ||
- x &= 3; | ||
+ Goink(x); | ||
REQUIRE_EQUAL(3, x); | ||
// #TEST#: EXF11 Extract function on expression | ||
return x + 3; | ||
int TestInteger() | ||
{ | ||
// #TEST#: EXF1 Extract function on statement | ||
@@ -37,7 +42,7 @@ int TestInteger() | ||
x |= 3; | ||
REQUIRE_EQUAL(11, x); | ||
// #TEST#: EXF10 Extract function on statement | ||
- x &= 3; | ||
+ goink(x); | ||
REQUIRE_EQUAL(3, x); | ||
// #TEST#: EXF11 Extract function on expression | ||
return x + 3; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
diff --git a/RefactorTest/ExtractFunction.cpp b/RefactorTest/ExtractFunction.cpp | ||
index d6416f3..39a76a7 100644 | ||
index e4fa731..fbe50c3 100644 | ||
--- a/RefactorTest/ExtractFunction.cpp | ||
+++ b/RefactorTest/ExtractFunction.cpp | ||
@@ -7,6 +7,11 @@ extern void TestExtractFunctionCFile(); | ||
@@ -6,6 +6,11 @@ extern void TestExtractFunctionCFile(); | ||
|
||
namespace ExtractFunction | ||
{ | ||
+ int Goink(int x) | ||
+ { | ||
+ return x + 3; | ||
+ } | ||
+int goink(int x) | ||
+{ | ||
+ return x + 3; | ||
+} | ||
+ | ||
int TestInteger() | ||
{ | ||
// #TEST#: EXF1 Extract function on statement | ||
@@ -41,7 +46,7 @@ namespace ExtractFunction | ||
x &= 3; | ||
REQUIRE_EQUAL(3, x); | ||
// #TEST#: EXF11 Extract function on expression | ||
- return x + 3; | ||
+ return Goink(x); | ||
} | ||
int TestInteger() | ||
{ | ||
// #TEST#: EXF1 Extract function on statement | ||
@@ -40,7 +45,7 @@ int TestInteger() | ||
x &= 3; | ||
REQUIRE_EQUAL(3, x); | ||
// #TEST#: EXF11 Extract function on expression | ||
- return x + 3; | ||
+ return goink(x); | ||
} | ||
|
||
int Function1(int x) { return x; } | ||
int Function1(int x) { return x; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
diff --git a/RefactorTest/ExtractFunction.cpp b/RefactorTest/ExtractFunction.cpp | ||
index d6416f3..7f619ac 100644 | ||
index 02dc2dd..2ec052d 100644 | ||
--- a/RefactorTest/ExtractFunction.cpp | ||
+++ b/RefactorTest/ExtractFunction.cpp | ||
@@ -47,13 +47,18 @@ namespace ExtractFunction | ||
int Function1(int x) { return x; } | ||
int Function2(int x) { return x; } | ||
@@ -52,13 +52,18 @@ int Function2(int x) | ||
return x; | ||
} | ||
|
||
+ void Goink(int(*& function)(int)) | ||
+ { | ||
+ function = Function1; | ||
+ } | ||
+void goink(int (*&function)(int)) | ||
+{ | ||
+ function = Function1; | ||
+} | ||
+ | ||
int (*TestFunction(int x))(int) | ||
int (*TestFunction(int x))(int) | ||
{ | ||
int (*function)(int); | ||
if (x > 0) | ||
{ | ||
// #TEST#: EXF12 Extract function on statement | ||
- function = Function1; | ||
+ goink(function); | ||
} | ||
else | ||
{ | ||
int (*function)(int); | ||
if (x > 0) | ||
{ | ||
// #TEST#: EXF12 Extract function on statement | ||
- function = Function1; | ||
+ Goink(function); | ||
} | ||
else | ||
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
diff --git a/RefactorTest/ExtractFunction.cpp b/RefactorTest/ExtractFunction.cpp | ||
index d6416f3..7b2fba7 100644 | ||
index 02dc2dd..53a5ecc 100644 | ||
--- a/RefactorTest/ExtractFunction.cpp | ||
+++ b/RefactorTest/ExtractFunction.cpp | ||
@@ -63,13 +63,19 @@ namespace ExtractFunction | ||
} | ||
@@ -68,13 +68,19 @@ int (*TestFunction(int x))(int) | ||
} | ||
|
||
typedef int Function(int); | ||
typedef int Function(int); | ||
+ | ||
+ void Goink(Function*& function) | ||
+ { | ||
+ function = Function1; | ||
+ } | ||
+void goink(Function *&function) | ||
+{ | ||
+ function = Function1; | ||
+} | ||
+ | ||
Function *TestFunction2(int x) | ||
Function *TestFunction2(int x) | ||
{ | ||
Function *function; | ||
if (x > 0) | ||
{ | ||
// #TEST#: EXF13 Extract function on statement | ||
- function = Function1; | ||
+ goink(function); | ||
} | ||
else | ||
{ | ||
Function *function; | ||
if (x > 0) | ||
{ | ||
// #TEST#: EXF13 Extract function on statement | ||
- function = Function1; | ||
+ Goink(function); | ||
} | ||
else | ||
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,24 @@ | ||
diff --git a/RefactorTest/ExtractFunction.cpp b/RefactorTest/ExtractFunction.cpp | ||
index d6416f3..7c920e2 100644 | ||
index 02dc2dd..8d7fef1 100644 | ||
--- a/RefactorTest/ExtractFunction.cpp | ||
+++ b/RefactorTest/ExtractFunction.cpp | ||
@@ -88,13 +88,18 @@ namespace ExtractFunction | ||
int Method2() const { return 2; } | ||
}; | ||
@@ -105,13 +105,18 @@ public: | ||
} | ||
}; | ||
|
||
+ void Goink(int( Foo::*& member)(int)) | ||
+ { | ||
+ member = &Foo::Operation1; | ||
+ } | ||
+void goink(int (Foo::*&member)(int)) | ||
+{ | ||
+ member = &Foo::Operation1; | ||
+} | ||
+ | ||
int (Foo::*TestMember(int x))(int) | ||
int (Foo::*TestMember(int x))(int) | ||
{ | ||
int (Foo::*member)(int); | ||
if (x > 0) | ||
{ | ||
// #TEST#: EXF14 Extract function on statement | ||
- member = &Foo::Operation1; | ||
+ goink(member); | ||
} | ||
else | ||
{ | ||
int (Foo::*member)(int); | ||
if (x > 0) | ||
{ | ||
// #TEST#: EXF14 Extract function on statement | ||
- member = &Foo::Operation1; | ||
+ Goink(member); | ||
} | ||
else | ||
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,25 @@ | ||
diff --git a/RefactorTest/ExtractFunction.cpp b/RefactorTest/ExtractFunction.cpp | ||
index d6416f3..2a5ccd8 100644 | ||
index 02dc2dd..bd99abd 100644 | ||
--- a/RefactorTest/ExtractFunction.cpp | ||
+++ b/RefactorTest/ExtractFunction.cpp | ||
@@ -104,13 +104,19 @@ namespace ExtractFunction | ||
} | ||
@@ -121,13 +121,19 @@ int (Foo::*TestMember(int x))(int) | ||
} | ||
|
||
typedef int (Foo::*PtrMemberT)(int); | ||
typedef int (Foo::*PtrMemberT)(int); | ||
+ | ||
+ void Goink(PtrMemberT& member) | ||
+ { | ||
+ member = &Foo::Operation1; | ||
+ } | ||
+void goink(PtrMemberT &member) | ||
+{ | ||
+ member = &Foo::Operation1; | ||
+} | ||
+ | ||
PtrMemberT TestMember2(int x) | ||
PtrMemberT TestMember2(int x) | ||
{ | ||
PtrMemberT member; | ||
if (x > 0) | ||
{ | ||
// #TEST#: EXF15 Extract function on statement | ||
- member = &Foo::Operation1; | ||
+ goink(member); | ||
} | ||
else | ||
{ | ||
PtrMemberT member; | ||
if (x > 0) | ||
{ | ||
// #TEST#: EXF15 Extract function on statement | ||
- member = &Foo::Operation1; | ||
+ Goink(member); | ||
} | ||
else | ||
{ |
Oops, something went wrong.