-
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.
Add Replace NULL/0 With nullptr test file diff
- Loading branch information
1 parent
2b3d6ef
commit ce262ed
Showing
1 changed file
with
93 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
diff --git a/RefactorTest/ReplaceNullZeroWithNullPtr.cpp b/RefactorTest/ReplaceNullZeroWithNullPtr.cpp | ||
index ee4f918..fdf461f 100644 | ||
--- a/RefactorTest/ReplaceNullZeroWithNullPtr.cpp | ||
+++ b/RefactorTest/ReplaceNullZeroWithNullPtr.cpp | ||
@@ -7,20 +7,20 @@ | ||
class Initializer | ||
{ | ||
public: | ||
- Initializer(char *p_ = NULL, // #TEST#: RZNP1 Replace NULL with nullptr | ||
- char *q_ = 0, // #TEST#: RZNP2 Replace 0 with nullptr | ||
- char const *f_ = NULL, // #TEST#: RZNP3 Replace NULL with nullptr | ||
- char const *g_ = 0, // #TEST#: RZNP4 Replace 0 with nullptr | ||
- char const *const h_ = NULL, // #TEST#: RZNP5 Replace NULL with nullptr | ||
- char const *const i_ = 0) // #TEST#: RZNP6 Replace 0 with nullptr | ||
+ Initializer(char *p_ = nullptr, // #TEST#: RZNP1 Replace NULL with nullptr | ||
+ char *q_ = nullptr, // #TEST#: RZNP2 Replace 0 with nullptr | ||
+ char const *f_ = nullptr, // #TEST#: RZNP3 Replace NULL with nullptr | ||
+ char const *g_ = nullptr, // #TEST#: RZNP4 Replace 0 with nullptr | ||
+ char const *const h_ = nullptr, // #TEST#: RZNP5 Replace NULL with nullptr | ||
+ char const *const i_ = nullptr) // #TEST#: RZNP6 Replace 0 with nullptr | ||
: p(p_), | ||
q(q_), | ||
- d(NULL), // #TEST#: RZNP7 Replace NULL with nullptr | ||
- e(0), // #TEST#: RZNP8 Replace 0 with nullptr | ||
- f(NULL), // #TEST#: RZNP9 Replace NULL with nullptr | ||
- g(0), // #TEST#: RZNP10 Replace 0 with nullptr | ||
- h(NULL), // #TEST#: RZNP11 Replace NULL with nullptr | ||
- i(0) // #TEST#: RZNP12 Replace 0 with nullptr | ||
+ d(nullptr), // #TEST#: RZNP7 Replace NULL with nullptr | ||
+ e(nullptr), // #TEST#: RZNP8 Replace 0 with nullptr | ||
+ f(nullptr), // #TEST#: RZNP9 Replace NULL with nullptr | ||
+ g(nullptr), // #TEST#: RZNP10 Replace 0 with nullptr | ||
+ h(nullptr), // #TEST#: RZNP11 Replace NULL with nullptr | ||
+ i(nullptr) // #TEST#: RZNP12 Replace 0 with nullptr | ||
{ | ||
REQUIRE_EQUAL(true, !p_); | ||
REQUIRE_EQUAL(true, !q_); | ||
@@ -67,12 +67,12 @@ static void TestClass() | ||
i.check(); | ||
} | ||
|
||
-static void TestDefaultArguments(char *p = NULL, // #TEST#: RZNP13 Replace NULL with nullptr | ||
- char *q = 0, // #TEST#: RZNP14 Replace 0 with nullptr | ||
- char const *f = NULL, // #TEST#: RZNP15 Replace NULL with nullptr | ||
- char const *g = 0, // #TEST#: RZNP16 Replace 0 with nullptr | ||
- char const *const h = NULL, // #TEST#: RZNP17 Replace NULL with nullptr | ||
- char const *const i = 0) // #TEST#: RZNP18 Replace 0 with nullptr | ||
+static void TestDefaultArguments(char *p = nullptr, // #TEST#: RZNP13 Replace NULL with nullptr | ||
+ char *q = nullptr, // #TEST#: RZNP14 Replace 0 with nullptr | ||
+ char const *f = nullptr, // #TEST#: RZNP15 Replace NULL with nullptr | ||
+ char const *g = nullptr, // #TEST#: RZNP16 Replace 0 with nullptr | ||
+ char const *const h = nullptr, // #TEST#: RZNP17 Replace NULL with nullptr | ||
+ char const *const i = nullptr) // #TEST#: RZNP18 Replace 0 with nullptr | ||
{ | ||
REQUIRE_EQUAL(true, !p); | ||
REQUIRE_EQUAL(true, !q); | ||
@@ -84,14 +84,14 @@ static void TestDefaultArguments(char *p = NULL, // #TEST#: RZNP13 R | ||
|
||
static void TestAssignment() | ||
{ | ||
- char *a = NULL; // #TEST#: RZNP19 Replace NULL with nullptr | ||
- char *b = 0; // #TEST#: RZNP20 Replace 0 with nullptr | ||
- char c = 0; // #TEST#: RZNP21 Should not be available | ||
- char *d = nullptr; // #TEST#: RZNP22 Should not be available | ||
- char const *f = NULL; // #TEST#: RZNP23 Replace NULL with nullptr | ||
- char const *g = 0; // #TEST#: RZNP24 Replace 0 with nullptr | ||
- char const *const h = NULL; // #TEST#: RZNP25 Replace NULL with nullptr | ||
- char const *const i = 0; // #TEST#: RZNP26 Replace 0 with nullptr | ||
+ char *a = nullptr; // #TEST#: RZNP19 Replace NULL with nullptr | ||
+ char *b = nullptr; // #TEST#: RZNP20 Replace 0 with nullptr | ||
+ char c = 0; // #TEST#: RZNP21 Should not be available | ||
+ char *d = nullptr; // #TEST#: RZNP22 Should not be available | ||
+ char const *f = nullptr; // #TEST#: RZNP23 Replace NULL with nullptr | ||
+ char const *g = nullptr; // #TEST#: RZNP24 Replace 0 with nullptr | ||
+ char const *const h = nullptr; // #TEST#: RZNP25 Replace NULL with nullptr | ||
+ char const *const i = nullptr; // #TEST#: RZNP26 Replace 0 with nullptr | ||
|
||
REQUIRE_EQUAL(true, !a); | ||
REQUIRE_EQUAL(true, !b); | ||
@@ -110,11 +110,11 @@ static void TestMemberPointers() | ||
int Method0() { return 0; } | ||
}; | ||
// #TEST#: RZNP27 Replace NULL with nullptr | ||
- int (Foo::*member)() = NULL; | ||
+ int (Foo::*member)() = nullptr; | ||
REQUIRE_EQUAL(true, !member); | ||
|
||
// #TEST#: RZNP28 Replace 0 with nullptr | ||
- member = 0; | ||
+ member = nullptr; | ||
REQUIRE_EQUAL(true, !member); | ||
} | ||
|