14 #define GETTEXT_DOMAIN "wesnoth-test"
18 #include <boost/test/unit_test.hpp>
19 #include <boost/assign.hpp>
26 std::vector<std::string> args = {
"wesnoth"};
32 BOOST_CHECK(!co.
clock);
35 BOOST_CHECK(!co.
debug);
36 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
37 BOOST_CHECK(!co.debug_dot_domain);
38 BOOST_CHECK(!co.debug_dot_level);
44 BOOST_CHECK(!co.
gzip);
45 BOOST_CHECK(!co.
help);
46 BOOST_CHECK(!co.
load);
63 BOOST_CHECK(!co.
nogui);
67 BOOST_CHECK(!co.
path);
81 BOOST_CHECK(!co.
test);
94 std::vector<std::string> args = {
99 "--preprocess-output-macros",
107 BOOST_CHECK(!co.
clock);
110 BOOST_CHECK(!co.
debug);
111 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
112 BOOST_CHECK(!co.debug_dot_domain);
113 BOOST_CHECK(!co.debug_dot_level);
116 BOOST_CHECK(!co.
fps);
119 BOOST_CHECK(!co.
gzip);
120 BOOST_CHECK(!co.
help);
121 BOOST_CHECK(!co.
load);
122 BOOST_CHECK(!co.
log);
139 BOOST_CHECK(!co.
nogui);
143 BOOST_CHECK(!co.
path);
156 BOOST_CHECK(co.
test && co.
test->empty());
169 std::vector<std::string> args = {
171 "--ai-config=1:aifoo",
172 "--ai-config=2:aibar",
173 "--algorithm=3:algfoo",
174 "--algorithm=4:algbar",
175 "--campaign=campfoo",
176 "--campaign-difficulty=16",
177 "--campaign-scenario=scenfoo",
179 "--controller=5:confoo",
180 "--controller=6:conbar",
181 "--data-dir=datadirfoo",
184 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
185 "--debug-dot-domain=ddfoo",
186 "--debug-dot-level=dlfoo",
193 "--gunzip=gunzipfoo.gz",
196 "--ignore-map-settings",
199 "--log-error=errfoo,errbar/*",
200 "--log-warning=warnfoo,warnfoo/bar",
201 "--log-info=infofoo",
202 "--log-debug=dbgfoo,dbgbar,dbg/foo/bar/baz",
203 "--logdomains=filterfoo",
212 "--parm=7:parmfoo:valfoo",
213 "--parm=8:parmbar:valbar",
215 "--preprocess",
"preppathfoo",
"preptargfoo",
216 "--preprocess-defines=DEFFOO,DEFBAR",
217 "--preprocess-input-macros=inmfoo",
218 "--preprocess-output-macros=outmfoo",
219 "--resolution=800x600",
221 "--scenario=scenfoo",
222 "--screenshot",
"mapfoo",
"outssfoo",
228 "--userconfig-dir=userconfigdirfoo",
230 "--userdata-dir=userdatadirfoo",
242 BOOST_CHECK(co.
clock);
245 BOOST_CHECK(co.
debug);
246 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
247 BOOST_CHECK(co.debug_dot_domain && *co.debug_dot_domain ==
"ddfoo");
248 BOOST_CHECK(co.debug_dot_level && *co.debug_dot_level ==
"dlfoo");
254 BOOST_CHECK(co.
gzip && *co.
gzip ==
"gzipfoo");
255 BOOST_CHECK(co.
help);
256 BOOST_CHECK(co.
load && *co.
load ==
"loadfoo");
258 BOOST_CHECK(co.
log->size()==8);
259 BOOST_CHECK(co.
log->at(0).get<0>() == 0 && co.
log->at(1).get<0>() == 0);
260 BOOST_CHECK(co.
log->at(0).get<1>() ==
"errfoo" && co.
log->at(1).get<1>() ==
"errbar/*");
261 BOOST_CHECK(co.
log->at(2).get<0>() == 1 && co.
log->at(3).get<0>() == 1);
262 BOOST_CHECK(co.
log->at(2).get<1>() ==
"warnfoo" && co.
log->at(3).get<1>() ==
"warnfoo/bar");
263 BOOST_CHECK(co.
log->at(4).get<0>() == 2);
264 BOOST_CHECK(co.
log->at(4).get<1>() ==
"infofoo");
265 BOOST_CHECK(co.
log->at(5).get<0>() == 3 && co.
log->at(6).get<0>() == 3 && co.
log->at(7).get<0>() == 3);
266 BOOST_CHECK(co.
log->at(5).get<1>() ==
"dbgfoo" && co.
log->at(6).get<1>() ==
"dbgbar" && co.
log->at(7).get<1>() ==
"dbg/foo/bar/baz");
295 BOOST_CHECK(co.
nogui);
299 BOOST_CHECK(co.
path);
312 BOOST_CHECK(co.
test && *co.
test ==
"testfoo");
325 std::vector<std::string> args = {
334 BOOST_CHECK(!co.
clock);
337 BOOST_CHECK(!co.
debug);
338 #ifdef DEBUG_WINDOW_LAYOUT_GRAPHS
339 BOOST_CHECK(!co.debug_dot_domain);
340 BOOST_CHECK(!co.debug_dot_level);
343 BOOST_CHECK(!co.
fps);
346 BOOST_CHECK(!co.
gzip);
347 BOOST_CHECK(!co.
help);
348 BOOST_CHECK(!co.
load);
349 BOOST_CHECK(!co.
log);
366 BOOST_CHECK(!co.
nogui);
370 BOOST_CHECK(!co.
path);
383 BOOST_CHECK(!co.
test);
394 BOOST_AUTO_TEST_SUITE_END()
boost::optional< std::vector< boost::tuple< unsigned int, std::string, std::string > > > multiplayer_parm
Non-empty if –parm was given on the command line. Vector of pairs (side number, parm name...
bool nogui
True if –nogui was given on the command line. Disables GUI.
boost::optional< std::string > multiplayer_turns
Non-empty if –turns was given on the command line. Dependent on –multiplayer.
boost::optional< std::vector< boost::tuple< unsigned int, std::string > > > multiplayer_algorithm
Non-empty if –algorithm was given on the command line. Vector of pairs (side number, value). Dependent on –multiplayer.
bool userdata_path
True if –userdata-path was given on the command line. Prints path to user data directory and exits...
boost::optional< std::string > multiplayer_scenario
Non-empty if –scenario was given on the command line. Dependent on –multiplayer.
bool multiplayer_ignore_map_settings
True if –ignore-map-settings was given at the command line. Do not use map settings.
boost::optional< std::string > gunzip
Non-empty if –gunzip was given on the command line. Uncompresses a .gz file and exits.
boost::optional< std::string > campaign_scenario
Non-empty if –campaign-scenario was given on the command line. Chooses starting scenario in the camp...
boost::optional< int > max_fps
Max FPS specified by –max-fps option.
boost::optional< unsigned int > rng_seed
RNG seed specified by –rng-seed option. Initializes RNG with given seed.
bool fps
True if –fps was given on the command line. Shows number of fps.
BOOST_AUTO_TEST_SUITE(test_map_location)
boost::optional< std::string > data_dir
Non-empty if –data-dir was given on the command line. Sets the config dir to the specified one...
boost::optional< std::vector< boost::tuple< int, std::string > > > log
Contains parsed arguments of –log-* (e.g.
boost::optional< std::string > multiplayer_era
Non-empty if –era was given on the command line. Dependent on –multiplayer.
boost::optional< std::string > multiplayer_label
Non-empty if –label was given on the command line. Dependent on –multiplayer.
boost::optional< std::string > load
Non-empty if –load was given on the command line. Savegame specified to load after start...
bool preprocess
True if –preprocess was given on the command line. Starts Wesnoth in preprocessor-only mode...
bool with_replay
True if –with-replay was given on the command line. Shows replay of the loaded file.
boost::optional< std::string > userconfig_dir
Non-empty if –userconfig-dir was given on the command line. Sets the user config dir to the specifie...
boost::optional< std::vector< boost::tuple< unsigned int, std::string > > > multiplayer_controller
Non-empty if –controller was given on the command line. Vector of pairs (side number, controller). Dependent on –multiplayer.
bool nodelay
True if –nodelay was given on the command line.
boost::optional< std::string > logdomains
Non-empty if –logdomains was given on the command line. Prints possible logdomains filtered by given...
bool windowed
True if –windowed was given on the command line. Starts Wesnoth in windowed mode.
boost::optional< std::string > editor
Non-empty if –editor was given on the command line. Goes directly into editor. If string is longer t...
boost::optional< std::string > userdata_dir
Non-empty if –userdata-dir was given on the command line. Sets the user data dir to the specified on...
boost::optional< std::string > gzip
Non-empty if –gzip was given on the command line. Compresses a file to .gz and exits.
boost::optional< std::string > preprocess_output_macros
Non-empty if –preprocess-output-macros was given on the command line. Outputs all preprocessed macro...
boost::optional< std::string > test
Non-empty if –test was given on the command line. Goes directly into test mode, into a scenario...
bool multiplayer
True if –multiplayer was given on the command line. Goes directly into multiplayer mode...
bool clock
True if –clock was given on the command line. Enables.
bool userconfig_path
True if –userconfig-path was given on the command line. Prints path to user config directory and exi...
bool path
True if –path was given on the command line. Prints the path to data directory and exits...
boost::optional< int > campaign_difficulty
Non-empty if –campaign-difficulty was given on the command line. Numerical difficulty of the campaig...
bool nomusic
True if –nomusic was given on the command line. Disables music.
boost::optional< std::string > preprocess_target
Target (output) path that was given to the –preprocess option.
bool debug
True if –debug was given on the command line. Enables debug mode.
bool nocache
True if –nocache was given on the command line. Disables cache usage.
boost::optional< std::string > screenshot_map_file
Map file to make a screenshot of. First parameter given after –screenshot.
boost::optional< std::string > preprocess_path
Path to parse that was given to the –preprocess option.
bool new_widgets
True if –new-widgets was given on the command line. Hidden option to enable the new widget toolkit...
boost::optional< std::vector< boost::tuple< unsigned int, std::string > > > multiplayer_ai_config
Non-empty if –ai-config was given on the command line. Vector of pairs (side number, value). Dependent on –multiplayer.
boost::optional< std::vector< boost::tuple< unsigned int, std::string > > > multiplayer_side
Non-empty if –side was given on the command line. Vector of pairs (side number, faction id)...
bool data_path
True if –data-path was given on the command line. Prints path to data directory and exits...
bool screenshot
True if –screenshot was given on the command line. Starts Wesnoth in screenshot mode.
bool version
True if –version was given on the command line. Prints version and exits.
boost::optional< std::string > screenshot_output_file
Output file to put screenshot in. Second parameter given after –screenshot.
bool fullscreen
True if –fullscreen was given on the command line. Starts Wesnoth in fullscreen mode.
bool validcache
True if –validcache was given on the command line. Makes Wesnoth assume the cache is valid...
boost::optional< std::vector< std::string > > preprocess_defines
Defines that were given to the –preprocess option.
bool nosound
True if –nosound was given on the command line. Disables sound.
boost::optional< std::string > preprocess_input_macros
Non-empty if –preprocess-input-macros was given on the command line. Specifies a file that contains ...
bool multiplayer_exit_at_end
True if –exit-at-and was given on the command line. Dependent on –multiplayer.
boost::optional< std::string > campaign
Non-empty if –campaign was given on the command line. ID of the campaign we want to start...
BOOST_AUTO_TEST_CASE(test_empty_options)
bool help
True if –help was given on the command line. Prints help and exits.
boost::optional< std::string > server
Non-empty if –server was given on the command line. Connects Wesnoth to specified server...
boost::optional< boost::tuple< int, int > > resolution
Pair of AxB values specified after –resolution. Changes Wesnoth resolution.