Fix Visual Studio undefined behavior test errors
This commit is contained in:
@@ -14,8 +14,13 @@
|
||||
#include "race.hpp"
|
||||
|
||||
static void set_item_name(legacy::item_record_type& item, const std::string& full, const std::string& name) {
|
||||
std::copy_n(full.begin(), std::min<size_t>(25, 1 + full.size()), item.full_name);
|
||||
std::copy_n(name.begin(), std::min<size_t>(15, 1 + name.size()), item.name);
|
||||
size_t full_size = std::min<size_t>(24, full.size());
|
||||
std::copy_n(full.begin(), full_size, item.full_name);
|
||||
item.full_name[full_size] = '\0';
|
||||
|
||||
size_t name_size = std::min<size_t>(14, name.size());
|
||||
std::copy_n(name.begin(), name_size, item.name);
|
||||
item.name[name_size] = '\0';
|
||||
}
|
||||
|
||||
TEST_CASE("Converting items from legacy scenarios") {
|
||||
|
@@ -80,6 +80,8 @@ TEST_CASE("Saving an outdoors sector") {
|
||||
wand.friendly[1] = 12;
|
||||
wand.end_spec1 = 210;
|
||||
wand.end_spec2 = 22;
|
||||
wand.cant_flee = true;
|
||||
wand.forced = true;
|
||||
|
||||
REQUIRE(out.special_enc.size() >= 1);
|
||||
out.special_enc[0] = spec;
|
||||
|
@@ -19,7 +19,7 @@
|
||||
|
||||
TEST_CASE("Converting legacy town data") {
|
||||
cScenario scen;
|
||||
scen.ter_types.resize(5);
|
||||
scen.ter_types.resize(16);
|
||||
legacy::town_record_type old_town = {0};
|
||||
|
||||
SECTION("With basic data") {
|
||||
|
Reference in New Issue
Block a user