16 #define GETTEXT_DOMAIN "wesnoth-test"
18 #include <boost/test/unit_test.hpp>
35 std::vector<std::string> ddns = {
"NUL",
"CON",
"AUX",
"PRN",
"CONIN$",
"CONOUT$" };
36 for(
unsigned i = 1;
i < 10; ++
i) {
37 ddns.emplace_back(std::string{
"LPT"} + std::to_string(
i));
38 ddns.emplace_back(std::string{
"COM"} + std::to_string(
i));
41 for(
const auto& name : ddns) {
49 BOOST_CHECK(
addon_name_legal(
"-0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ_abcdefghijklmnopqrstuvwxyz") );
68 const std::string plain =
"ABC";
77 const char bin_escape =
'\x01';
78 const std::string bin_special =
"\x0D\xFE";
79 const std::string raw =
"ABC \x01 DEF \x0D\x0A JKL \xFE MNO";
94 for(
const char c : raw)
96 if(
c == bin_escape || bin_special.find(
c) != std::string::npos) {
97 encoded += bin_escape;
114 const unsigned recursive_steps = 16;
115 std::string recursive_encoded = raw;
117 for(
unsigned n = 0;
n < recursive_steps; ++
n) {
121 BOOST_CHECK( recursive_encoded != raw );
123 for(
unsigned n = 0;
n < recursive_steps; ++
n) {
127 BOOST_CHECK( recursive_encoded == raw );
130 BOOST_AUTO_TEST_SUITE_END()
BOOST_AUTO_TEST_CASE(validation)
BOOST_AUTO_TEST_SUITE(filesystem)
static map_location::direction n
bool addon_name_legal(const std::string &name)
Checks whether an add-on id/name is legal or not.
std::string unencode_binary(const std::string &str)
bool addon_filename_legal(const std::string &name)
Checks whether an add-on file name is legal or not.
std::string encode_binary(const std::string &str)