Skip to content

Commit f871f15

Browse files
committed
scripted-diff: replace gArgs with argsman
-BEGIN VERIFY SCRIPT- sed -i 's/\<gArgs\>/m_args/g' src/test/getarg_tests.cpp -END VERIFY SCRIPT-
1 parent 357f02b commit f871f15

File tree

1 file changed

+59
-59
lines changed

1 file changed

+59
-59
lines changed

src/test/getarg_tests.cpp

+59-59
Original file line numberDiff line numberDiff line change
@@ -39,14 +39,14 @@ void LocalTestingSetup :: ResetArgs(const std::string& strArg)
3939
vecChar.push_back(s.c_str());
4040

4141
std::string error;
42-
BOOST_CHECK(gArgs.ParseParameters(vecChar.size(), vecChar.data(), error));
42+
BOOST_CHECK(m_args.ParseParameters(vecChar.size(), vecChar.data(), error));
4343
}
4444

4545
void LocalTestingSetup :: SetupArgs(const std::vector<std::pair<std::string, unsigned int>>& args)
4646
{
47-
gArgs.ClearArgs();
47+
m_args.ClearArgs();
4848
for (const auto& arg : args) {
49-
gArgs.AddArg(arg.first, "", arg.second, OptionsCategory::OPTIONS);
49+
m_args.AddArg(arg.first, "", arg.second, OptionsCategory::OPTIONS);
5050
}
5151
}
5252

@@ -55,52 +55,52 @@ BOOST_AUTO_TEST_CASE(boolarg)
5555
const auto foo = std::make_pair("-foo", ArgsManager::ALLOW_ANY);
5656
SetupArgs({foo});
5757
ResetArgs("-foo");
58-
BOOST_CHECK(gArgs.GetBoolArg("-foo", false));
59-
BOOST_CHECK(gArgs.GetBoolArg("-foo", true));
58+
BOOST_CHECK(m_args.GetBoolArg("-foo", false));
59+
BOOST_CHECK(m_args.GetBoolArg("-foo", true));
6060

61-
BOOST_CHECK(!gArgs.GetBoolArg("-fo", false));
62-
BOOST_CHECK(gArgs.GetBoolArg("-fo", true));
61+
BOOST_CHECK(!m_args.GetBoolArg("-fo", false));
62+
BOOST_CHECK(m_args.GetBoolArg("-fo", true));
6363

64-
BOOST_CHECK(!gArgs.GetBoolArg("-fooo", false));
65-
BOOST_CHECK(gArgs.GetBoolArg("-fooo", true));
64+
BOOST_CHECK(!m_args.GetBoolArg("-fooo", false));
65+
BOOST_CHECK(m_args.GetBoolArg("-fooo", true));
6666

6767
ResetArgs("-foo=0");
68-
BOOST_CHECK(!gArgs.GetBoolArg("-foo", false));
69-
BOOST_CHECK(!gArgs.GetBoolArg("-foo", true));
68+
BOOST_CHECK(!m_args.GetBoolArg("-foo", false));
69+
BOOST_CHECK(!m_args.GetBoolArg("-foo", true));
7070

7171
ResetArgs("-foo=1");
72-
BOOST_CHECK(gArgs.GetBoolArg("-foo", false));
73-
BOOST_CHECK(gArgs.GetBoolArg("-foo", true));
72+
BOOST_CHECK(m_args.GetBoolArg("-foo", false));
73+
BOOST_CHECK(m_args.GetBoolArg("-foo", true));
7474

7575
// New 0.6 feature: auto-map -nosomething to !-something:
7676
ResetArgs("-nofoo");
77-
BOOST_CHECK(!gArgs.GetBoolArg("-foo", false));
78-
BOOST_CHECK(!gArgs.GetBoolArg("-foo", true));
77+
BOOST_CHECK(!m_args.GetBoolArg("-foo", false));
78+
BOOST_CHECK(!m_args.GetBoolArg("-foo", true));
7979

8080
ResetArgs("-nofoo=1");
81-
BOOST_CHECK(!gArgs.GetBoolArg("-foo", false));
82-
BOOST_CHECK(!gArgs.GetBoolArg("-foo", true));
81+
BOOST_CHECK(!m_args.GetBoolArg("-foo", false));
82+
BOOST_CHECK(!m_args.GetBoolArg("-foo", true));
8383

8484
ResetArgs("-foo -nofoo"); // -nofoo should win
85-
BOOST_CHECK(!gArgs.GetBoolArg("-foo", false));
86-
BOOST_CHECK(!gArgs.GetBoolArg("-foo", true));
85+
BOOST_CHECK(!m_args.GetBoolArg("-foo", false));
86+
BOOST_CHECK(!m_args.GetBoolArg("-foo", true));
8787

8888
ResetArgs("-foo=1 -nofoo=1"); // -nofoo should win
89-
BOOST_CHECK(!gArgs.GetBoolArg("-foo", false));
90-
BOOST_CHECK(!gArgs.GetBoolArg("-foo", true));
89+
BOOST_CHECK(!m_args.GetBoolArg("-foo", false));
90+
BOOST_CHECK(!m_args.GetBoolArg("-foo", true));
9191

9292
ResetArgs("-foo=0 -nofoo=0"); // -nofoo=0 should win
93-
BOOST_CHECK(gArgs.GetBoolArg("-foo", false));
94-
BOOST_CHECK(gArgs.GetBoolArg("-foo", true));
93+
BOOST_CHECK(m_args.GetBoolArg("-foo", false));
94+
BOOST_CHECK(m_args.GetBoolArg("-foo", true));
9595

9696
// New 0.6 feature: treat -- same as -:
9797
ResetArgs("--foo=1");
98-
BOOST_CHECK(gArgs.GetBoolArg("-foo", false));
99-
BOOST_CHECK(gArgs.GetBoolArg("-foo", true));
98+
BOOST_CHECK(m_args.GetBoolArg("-foo", false));
99+
BOOST_CHECK(m_args.GetBoolArg("-foo", true));
100100

101101
ResetArgs("--nofoo=1");
102-
BOOST_CHECK(!gArgs.GetBoolArg("-foo", false));
103-
BOOST_CHECK(!gArgs.GetBoolArg("-foo", true));
102+
BOOST_CHECK(!m_args.GetBoolArg("-foo", false));
103+
BOOST_CHECK(!m_args.GetBoolArg("-foo", true));
104104

105105
}
106106

@@ -110,24 +110,24 @@ BOOST_AUTO_TEST_CASE(stringarg)
110110
const auto bar = std::make_pair("-bar", ArgsManager::ALLOW_ANY);
111111
SetupArgs({foo, bar});
112112
ResetArgs("");
113-
BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", ""), "");
114-
BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", "eleven"), "eleven");
113+
BOOST_CHECK_EQUAL(m_args.GetArg("-foo", ""), "");
114+
BOOST_CHECK_EQUAL(m_args.GetArg("-foo", "eleven"), "eleven");
115115

116116
ResetArgs("-foo -bar");
117-
BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", ""), "");
118-
BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", "eleven"), "");
117+
BOOST_CHECK_EQUAL(m_args.GetArg("-foo", ""), "");
118+
BOOST_CHECK_EQUAL(m_args.GetArg("-foo", "eleven"), "");
119119

120120
ResetArgs("-foo=");
121-
BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", ""), "");
122-
BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", "eleven"), "");
121+
BOOST_CHECK_EQUAL(m_args.GetArg("-foo", ""), "");
122+
BOOST_CHECK_EQUAL(m_args.GetArg("-foo", "eleven"), "");
123123

124124
ResetArgs("-foo=11");
125-
BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", ""), "11");
126-
BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", "eleven"), "11");
125+
BOOST_CHECK_EQUAL(m_args.GetArg("-foo", ""), "11");
126+
BOOST_CHECK_EQUAL(m_args.GetArg("-foo", "eleven"), "11");
127127

128128
ResetArgs("-foo=eleven");
129-
BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", ""), "eleven");
130-
BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", "eleven"), "eleven");
129+
BOOST_CHECK_EQUAL(m_args.GetArg("-foo", ""), "eleven");
130+
BOOST_CHECK_EQUAL(m_args.GetArg("-foo", "eleven"), "eleven");
131131

132132
}
133133

@@ -137,20 +137,20 @@ BOOST_AUTO_TEST_CASE(intarg)
137137
const auto bar = std::make_pair("-bar", ArgsManager::ALLOW_ANY);
138138
SetupArgs({foo, bar});
139139
ResetArgs("");
140-
BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", 11), 11);
141-
BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", 0), 0);
140+
BOOST_CHECK_EQUAL(m_args.GetArg("-foo", 11), 11);
141+
BOOST_CHECK_EQUAL(m_args.GetArg("-foo", 0), 0);
142142

143143
ResetArgs("-foo -bar");
144-
BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", 11), 0);
145-
BOOST_CHECK_EQUAL(gArgs.GetArg("-bar", 11), 0);
144+
BOOST_CHECK_EQUAL(m_args.GetArg("-foo", 11), 0);
145+
BOOST_CHECK_EQUAL(m_args.GetArg("-bar", 11), 0);
146146

147147
ResetArgs("-foo=11 -bar=12");
148-
BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", 0), 11);
149-
BOOST_CHECK_EQUAL(gArgs.GetArg("-bar", 11), 12);
148+
BOOST_CHECK_EQUAL(m_args.GetArg("-foo", 0), 11);
149+
BOOST_CHECK_EQUAL(m_args.GetArg("-bar", 11), 12);
150150

151151
ResetArgs("-foo=NaN -bar=NotANumber");
152-
BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", 1), 0);
153-
BOOST_CHECK_EQUAL(gArgs.GetArg("-bar", 11), 0);
152+
BOOST_CHECK_EQUAL(m_args.GetArg("-foo", 1), 0);
153+
BOOST_CHECK_EQUAL(m_args.GetArg("-bar", 11), 0);
154154
}
155155

156156
BOOST_AUTO_TEST_CASE(doubledash)
@@ -159,11 +159,11 @@ BOOST_AUTO_TEST_CASE(doubledash)
159159
const auto bar = std::make_pair("-bar", ArgsManager::ALLOW_ANY);
160160
SetupArgs({foo, bar});
161161
ResetArgs("--foo");
162-
BOOST_CHECK_EQUAL(gArgs.GetBoolArg("-foo", false), true);
162+
BOOST_CHECK_EQUAL(m_args.GetBoolArg("-foo", false), true);
163163

164164
ResetArgs("--foo=verbose --bar=1");
165-
BOOST_CHECK_EQUAL(gArgs.GetArg("-foo", ""), "verbose");
166-
BOOST_CHECK_EQUAL(gArgs.GetArg("-bar", 0), 1);
165+
BOOST_CHECK_EQUAL(m_args.GetArg("-foo", ""), "verbose");
166+
BOOST_CHECK_EQUAL(m_args.GetArg("-bar", 0), 1);
167167
}
168168

169169
BOOST_AUTO_TEST_CASE(boolargno)
@@ -172,24 +172,24 @@ BOOST_AUTO_TEST_CASE(boolargno)
172172
const auto bar = std::make_pair("-bar", ArgsManager::ALLOW_ANY);
173173
SetupArgs({foo, bar});
174174
ResetArgs("-nofoo");
175-
BOOST_CHECK(!gArgs.GetBoolArg("-foo", true));
176-
BOOST_CHECK(!gArgs.GetBoolArg("-foo", false));
175+
BOOST_CHECK(!m_args.GetBoolArg("-foo", true));
176+
BOOST_CHECK(!m_args.GetBoolArg("-foo", false));
177177

178178
ResetArgs("-nofoo=1");
179-
BOOST_CHECK(!gArgs.GetBoolArg("-foo", true));
180-
BOOST_CHECK(!gArgs.GetBoolArg("-foo", false));
179+
BOOST_CHECK(!m_args.GetBoolArg("-foo", true));
180+
BOOST_CHECK(!m_args.GetBoolArg("-foo", false));
181181

182182
ResetArgs("-nofoo=0");
183-
BOOST_CHECK(gArgs.GetBoolArg("-foo", true));
184-
BOOST_CHECK(gArgs.GetBoolArg("-foo", false));
183+
BOOST_CHECK(m_args.GetBoolArg("-foo", true));
184+
BOOST_CHECK(m_args.GetBoolArg("-foo", false));
185185

186186
ResetArgs("-foo --nofoo"); // --nofoo should win
187-
BOOST_CHECK(!gArgs.GetBoolArg("-foo", true));
188-
BOOST_CHECK(!gArgs.GetBoolArg("-foo", false));
187+
BOOST_CHECK(!m_args.GetBoolArg("-foo", true));
188+
BOOST_CHECK(!m_args.GetBoolArg("-foo", false));
189189

190190
ResetArgs("-nofoo -foo"); // foo always wins:
191-
BOOST_CHECK(gArgs.GetBoolArg("-foo", true));
192-
BOOST_CHECK(gArgs.GetBoolArg("-foo", false));
191+
BOOST_CHECK(m_args.GetBoolArg("-foo", true));
192+
BOOST_CHECK(m_args.GetBoolArg("-foo", false));
193193
}
194194

195195
BOOST_AUTO_TEST_CASE(logargs)
@@ -209,7 +209,7 @@ BOOST_AUTO_TEST_CASE(logargs)
209209
});
210210

211211
// Log the arguments
212-
gArgs.LogArgs();
212+
m_args.LogArgs();
213213

214214
LogInstance().DeleteCallback(print_connection);
215215
// Check that what should appear does, and what shouldn't doesn't.

0 commit comments

Comments
 (0)