-
Notifications
You must be signed in to change notification settings - Fork 183
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests: remove TESTS_NODATA configuration option
Add --nodata argument to the tests executable. This will at runtime disable the tests that require game data. How to use: ./rwtests ./rwtests -- --help ./rwtests -- --nodata
- Loading branch information
Showing
30 changed files
with
290 additions
and
206 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
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
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
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
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
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,64 @@ | ||
#ifndef _RWTESTS_BOOST_FIXES_HPP_ | ||
#define _RWTESTS_BOOST_FIXES_HPP_ | ||
|
||
#include <fonts/GameTexts.hpp> | ||
|
||
#include <boost/test/unit_test.hpp> | ||
#include <glm/gtx/string_cast.hpp> | ||
|
||
// Boost moved the print_log_value struct in version 1.59 | ||
// TODO: use another testing library | ||
#if BOOST_VERSION >= 105900 | ||
#define BOOST_NS_MAGIC namespace tt_detail { | ||
#define BOOST_NS_MAGIC_CLOSING } | ||
#else | ||
#define BOOST_NS_MAGIC | ||
#define BOOST_NS_MAGIC_CLOSING | ||
#endif | ||
|
||
namespace boost { | ||
namespace test_tools { | ||
BOOST_NS_MAGIC | ||
template <> | ||
struct print_log_value<glm::vec3> { | ||
void operator()(std::ostream& s, glm::vec3 const& v) { | ||
s << glm::to_string(v); | ||
} | ||
}; | ||
BOOST_NS_MAGIC_CLOSING | ||
} | ||
} | ||
|
||
#if BOOST_VERSION < 106400 | ||
namespace boost { | ||
namespace test_tools { | ||
BOOST_NS_MAGIC | ||
template <> | ||
struct print_log_value<std::nullptr_t> { | ||
void operator()(std::ostream& s, std::nullptr_t) { | ||
s << "nullptr"; | ||
} | ||
}; | ||
BOOST_NS_MAGIC_CLOSING | ||
} | ||
} | ||
#endif | ||
|
||
namespace boost { | ||
namespace test_tools { | ||
BOOST_NS_MAGIC | ||
template <> | ||
struct print_log_value<GameString> { | ||
void operator()(std::ostream& s, GameString const& v) { | ||
for (GameString::size_type i = 0u; i < v.size(); ++i) { | ||
s << static_cast<char>(v[i]); | ||
} | ||
} | ||
}; | ||
BOOST_NS_MAGIC_CLOSING | ||
} | ||
} | ||
|
||
#undef BOOST_NS_MAGIC | ||
#undef BOOST_NS_MAGIC_CLOSING | ||
#endif |
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 |
---|---|---|
@@ -1,2 +1,52 @@ | ||
#define BOOST_TEST_MODULE openrw | ||
#include <boost/test/unit_test.hpp> | ||
#include <boost/program_options.hpp> | ||
|
||
#include "test_Globals.hpp" | ||
|
||
#include <iostream> | ||
|
||
static bool global_texture_ran = false; | ||
|
||
class RWTestGlobalFixture { | ||
public: | ||
RWTestGlobalFixture() { | ||
int argc = utf::framework::master_test_suite().argc; | ||
char** argv= utf::framework::master_test_suite().argv; | ||
parse_args(argc, argv); | ||
|
||
global_texture_ran = true; | ||
} | ||
private: | ||
void parse_args(int argc, char** argv) { | ||
namespace po = boost::program_options; | ||
po::options_description test_options("Test options"); | ||
test_options.add_options()( | ||
"nodata", "Disable tests that need game data")( | ||
"help", "Show this help message"); | ||
|
||
po::variables_map vm; | ||
try { | ||
po::store(po::parse_command_line(argc, argv, test_options), vm); | ||
po::notify(vm); | ||
} catch (po::error& ex) { | ||
std::cout << "Error parsing arguments: " << ex.what() << std::endl; | ||
std::cerr << test_options; | ||
_exit(EXIT_FAILURE); | ||
} | ||
if (vm.count("help")) { | ||
std::cout << test_options; | ||
_exit(EXIT_SUCCESS); | ||
} | ||
|
||
if (vm.count("nodata")) { | ||
global_args.with_data = false; | ||
} | ||
} | ||
}; | ||
|
||
BOOST_TEST_GLOBAL_FIXTURE(RWTestGlobalFixture); | ||
|
||
BOOST_AUTO_TEST_CASE(test_global_fixture) { | ||
BOOST_TEST_REQUIRE(global_texture_ran); | ||
} |
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
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
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
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
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
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
Oops, something went wrong.