2016-05-20 03:09:22 +02:00
|
|
|
#include <GameConfig.hpp>
|
2016-09-09 22:13:22 +02:00
|
|
|
#include <boost/test/unit_test.hpp>
|
2016-05-20 03:09:22 +02:00
|
|
|
#include <fstream>
|
|
|
|
|
|
|
|
BOOST_AUTO_TEST_SUITE(ConfigTests)
|
|
|
|
|
2017-01-15 03:16:46 +01:00
|
|
|
|
2016-09-09 22:13:22 +02:00
|
|
|
BOOST_AUTO_TEST_CASE(test_loading) {
|
|
|
|
// Write out a temporary file
|
|
|
|
std::ofstream test_config("/tmp/openrw_test.ini");
|
|
|
|
test_config << "[game]\n"
|
2017-01-06 22:45:25 +01:00
|
|
|
<< "\tpath=\t/dev/test\n"
|
|
|
|
<< " language = american ;Comment\n"
|
|
|
|
<< ";lineComment\n"
|
|
|
|
<< "nonexistingkey=somevalue"
|
|
|
|
<< std::endl;
|
2016-05-20 03:09:22 +02:00
|
|
|
|
2016-09-09 22:13:22 +02:00
|
|
|
GameConfig config("openrw_test.ini", "/tmp");
|
2016-05-20 03:09:22 +02:00
|
|
|
|
2016-09-09 22:13:22 +02:00
|
|
|
BOOST_CHECK(config.isValid());
|
2016-05-20 03:09:22 +02:00
|
|
|
|
2016-09-09 22:13:22 +02:00
|
|
|
BOOST_CHECK_EQUAL(config.getGameDataPath(), "/dev/test");
|
2017-01-06 22:45:25 +01:00
|
|
|
BOOST_CHECK_EQUAL(config.getGameLanguage(), "american");
|
2017-01-15 03:16:46 +01:00
|
|
|
BOOST_CHECK_EQUAL(config.getInputInvertY(), false);
|
2016-05-20 03:09:22 +02:00
|
|
|
}
|
|
|
|
|
2017-01-06 22:45:25 +01:00
|
|
|
|
2016-05-20 03:09:22 +02:00
|
|
|
BOOST_AUTO_TEST_SUITE_END()
|