mirror of
https://github.com/OpenMW/openmw.git
synced 2025-03-03 16:39:41 +00:00
Generate test cases for all ESM3 format versions since MaxStringRefIdFormatVersion
This commit is contained in:
parent
90ed24f4c9
commit
d6c8c54dc5
2 changed files with 35 additions and 25 deletions
|
@ -71,11 +71,16 @@ namespace ESM
|
|||
{
|
||||
using namespace ::testing;
|
||||
|
||||
constexpr std::array formats = {
|
||||
MaxLimitedSizeStringsFormatVersion,
|
||||
MaxStringRefIdFormatVersion,
|
||||
CurrentSaveGameFormatVersion,
|
||||
};
|
||||
std::vector<ESM::FormatVersion> getFormats()
|
||||
{
|
||||
std::vector<ESM::FormatVersion> result({
|
||||
MaxLimitedSizeStringsFormatVersion,
|
||||
MaxStringRefIdFormatVersion,
|
||||
});
|
||||
for (ESM::FormatVersion v = result.back() + 1; v <= ESM::CurrentSaveGameFormatVersion; ++v)
|
||||
result.push_back(v);
|
||||
return result;
|
||||
}
|
||||
|
||||
constexpr std::uint32_t fakeRecordId = fourCC("FAKE");
|
||||
|
||||
|
@ -327,6 +332,6 @@ namespace ESM
|
|||
EXPECT_EQ(result.mKeys, record.mKeys);
|
||||
}
|
||||
|
||||
INSTANTIATE_TEST_SUITE_P(FormatVersions, Esm3SaveLoadRecordTest, ValuesIn(formats));
|
||||
INSTANTIATE_TEST_SUITE_P(FormatVersions, Esm3SaveLoadRecordTest, ValuesIn(getFormats()));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -269,22 +269,27 @@ std::unique_ptr<std::istream> getEsmFile(T record, bool deleted, ESM::FormatVers
|
|||
|
||||
namespace
|
||||
{
|
||||
constexpr std::array formats = {
|
||||
ESM::DefaultFormatVersion,
|
||||
ESM::CurrentContentFormatVersion,
|
||||
ESM::MaxOldWeatherFormatVersion,
|
||||
ESM::MaxOldDeathAnimationFormatVersion,
|
||||
ESM::MaxOldForOfWarFormatVersion,
|
||||
ESM::MaxWerewolfDeprecatedDataFormatVersion,
|
||||
ESM::MaxOldTimeLeftFormatVersion,
|
||||
ESM::MaxIntFallbackFormatVersion,
|
||||
ESM::MaxClearModifiersFormatVersion,
|
||||
ESM::MaxOldAiPackageFormatVersion,
|
||||
ESM::MaxOldSkillsAndAttributesFormatVersion,
|
||||
ESM::MaxOldCreatureStatsFormatVersion,
|
||||
ESM::MaxStringRefIdFormatVersion,
|
||||
ESM::CurrentSaveGameFormatVersion,
|
||||
};
|
||||
std::vector<ESM::FormatVersion> getFormats()
|
||||
{
|
||||
std::vector<ESM::FormatVersion> result({
|
||||
ESM::DefaultFormatVersion,
|
||||
ESM::CurrentContentFormatVersion,
|
||||
ESM::MaxOldWeatherFormatVersion,
|
||||
ESM::MaxOldDeathAnimationFormatVersion,
|
||||
ESM::MaxOldForOfWarFormatVersion,
|
||||
ESM::MaxWerewolfDeprecatedDataFormatVersion,
|
||||
ESM::MaxOldTimeLeftFormatVersion,
|
||||
ESM::MaxIntFallbackFormatVersion,
|
||||
ESM::MaxClearModifiersFormatVersion,
|
||||
ESM::MaxOldAiPackageFormatVersion,
|
||||
ESM::MaxOldSkillsAndAttributesFormatVersion,
|
||||
ESM::MaxOldCreatureStatsFormatVersion,
|
||||
ESM::MaxStringRefIdFormatVersion,
|
||||
});
|
||||
for (ESM::FormatVersion v = result.back() + 1; v <= ESM::CurrentSaveGameFormatVersion; ++v)
|
||||
result.push_back(v);
|
||||
return result;
|
||||
}
|
||||
|
||||
template <class T, class = std::void_t<>>
|
||||
struct HasBlankFunction : std::false_type
|
||||
|
@ -305,7 +310,7 @@ TYPED_TEST_P(StoreTest, delete_test)
|
|||
{
|
||||
using RecordType = TypeParam;
|
||||
|
||||
for (const ESM::FormatVersion formatVersion : formats)
|
||||
for (const ESM::FormatVersion formatVersion : getFormats())
|
||||
{
|
||||
SCOPED_TRACE("FormatVersion: " + std::to_string(formatVersion));
|
||||
const ESM::RefId recordId = ESM::RefId::stringRefId("foobar");
|
||||
|
@ -383,7 +388,7 @@ TYPED_TEST_P(StoreTest, overwrite_test)
|
|||
{
|
||||
using RecordType = TypeParam;
|
||||
|
||||
for (const ESM::FormatVersion formatVersion : formats)
|
||||
for (const ESM::FormatVersion formatVersion : getFormats())
|
||||
{
|
||||
SCOPED_TRACE("FormatVersion: " + std::to_string(formatVersion));
|
||||
|
||||
|
@ -442,7 +447,7 @@ namespace
|
|||
else
|
||||
refId = ESM::StringRefId("foobar");
|
||||
|
||||
for (const ESM::FormatVersion formatVersion : formats)
|
||||
for (const ESM::FormatVersion formatVersion : getFormats())
|
||||
{
|
||||
SCOPED_TRACE("FormatVersion: " + std::to_string(formatVersion));
|
||||
|
||||
|
|
Loading…
Reference in a new issue