-
Notifications
You must be signed in to change notification settings - Fork 4
Expand file tree
/
Copy pathChangeSignature.cpp
More file actions
82 lines (69 loc) · 2.06 KB
/
ChangeSignature.cpp
File metadata and controls
82 lines (69 loc) · 2.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#include "ChangeSignature.h"
#include "Require.h"
// Changes the signature of a function or method in both a header and source file;
namespace ChangeSignatureNamespace
{
// #TEST#: CS21 Rename first parameter to operand1
// #TEST#: CS22 Rename second parameter to operand2
// #TEST#: CS23 Rename function to Primitive
// #TEST#: CS24 Add const qualifier to first parameter
// #TEST#: CS25 Add const qualifier to second parameter
int Function2(int a, int b)
{
return a + b;
}
// #TEST#: CS26 Rename first parameter to goink
// #TEST#: CS27 Rename second parameter to goink
// #TEST#: CS28 Rename method to Primitive
// #TEST#: CS29 Change type of first parameter to float
// #TEST#: CS30 Change return type to float
int ChangeSignature::Method2(int a, int b)
{
return a + b;
}
namespace
{
void f1()
{
// #TEST#: CS31 Rename first parameter to operand1
// #TEST#: CS32 Rename second parameter to operand2
// #TEST#: CS33 Rename function to Primitive
// #TEST#: CS34 Add const qualifier to first parameter
// #TEST#: CS35 Add const qualifier to second parameter
REQUIRE_EQUAL(7, Function1(3, 4));
}
void f2()
{
// #TEST#: CS36 Rename first parameter to operand1
// #TEST#: CS37 Rename second parameter to operand2
// #TEST#: CS38 Rename function to Primitive
// #TEST#: CS39 Add const qualifier to first parameter
// #TEST#: CS40 Add const qualifier to second parameter
REQUIRE_EQUAL(7, Function2(3, 4));
}
void f4()
{
ChangeSignature cs;
REQUIRE_EQUAL(3, cs.Method1(1, 2));
}
} // namespace
} // namespace ChangeSignatureNamespace
namespace
{
void f3()
{
// #TEST#: CS41 Rename first parameter to operand1
// #TEST#: CS42 Rename second parameter to operand2
// #TEST#: CS43 Rename function to Primitive
// #TEST#: CS44 Add const qualifier to first parameter
// #TEST#: CS45 Add const qualifier to second parameter
REQUIRE_EQUAL(7, ChangeSignatureNamespace::Function1(3, 4));
}
} // namespace
void TestChangeSignature()
{
using namespace ChangeSignatureNamespace;
f1();
f2();
f3();
}