From e47aee389b720f0ce89099d170333dd9b949516c Mon Sep 17 00:00:00 2001 From: craftablescience Date: Thu, 6 Jun 2024 19:03:13 -0400 Subject: [PATCH] fix: add .gitattributes, set test files as binary where appropriate --- .gitattributes | 30 ++++++++++++++++++ test/Helpers.cpp | 2 +- .../{weapon_pistol.txt => weapon_pistol.dec} | 0 .../{weapon_pistol.ctx => weapon_pistol.enc} | Bin test/vicepp.cpp | 8 ++--- 5 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 .gitattributes rename test/res/vicepp/{weapon_pistol.txt => weapon_pistol.dec} (100%) rename test/res/vicepp/{weapon_pistol.ctx => weapon_pistol.enc} (100%) diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 000000000..9a41934dc --- /dev/null +++ b/.gitattributes @@ -0,0 +1,30 @@ +# Sources +*.c text diff=cpp +*.cpp text diff=cpp +*.h text diff=cpp +*.hpp text diff=cpp + +# Markdown +*.md linguist-detectable + +# Compressonator +*.a binary +*.lib binary + +# dmxpp +*.dmx binary + +# mdlpp +*.mdl binary +*.vtx binary +*.vvd binary +*.ani binary +*.phy binary +*.vta binary + +# vicepp +*.dec binary +*.enc binary + +# vtfpp +*.vtf binary diff --git a/test/Helpers.cpp b/test/Helpers.cpp index 72c4cb90d..2436bd429 100644 --- a/test/Helpers.cpp +++ b/test/Helpers.cpp @@ -5,7 +5,7 @@ std::vector readFile(const std::string& path) { std::ifstream file(path, std::ios::binary); - file >> std::skipws; + file.unsetf(std::ios::skipws); auto size = std::filesystem::file_size(path); std::vector out(size); file.read(reinterpret_cast(out.data()), static_cast(size)); diff --git a/test/res/vicepp/weapon_pistol.txt b/test/res/vicepp/weapon_pistol.dec similarity index 100% rename from test/res/vicepp/weapon_pistol.txt rename to test/res/vicepp/weapon_pistol.dec diff --git a/test/res/vicepp/weapon_pistol.ctx b/test/res/vicepp/weapon_pistol.enc similarity index 100% rename from test/res/vicepp/weapon_pistol.ctx rename to test/res/vicepp/weapon_pistol.enc diff --git a/test/vicepp.cpp b/test/vicepp.cpp index 695baab2f..d201457f5 100644 --- a/test/vicepp.cpp +++ b/test/vicepp.cpp @@ -7,8 +7,8 @@ using namespace vicepp; TEST(vicepp, decrypt) { - auto encrypted = ::readFile(ASSET_ROOT "vicepp/weapon_pistol.ctx"); - auto decrypted = ::readFile(ASSET_ROOT "vicepp/weapon_pistol.txt"); + auto encrypted = ::readFile(ASSET_ROOT "vicepp/weapon_pistol.enc"); + auto decrypted = ::readFile(ASSET_ROOT "vicepp/weapon_pistol.dec"); auto test = decrypt(encrypted, KnownCodes::HL2DM); ASSERT_EQ(test.size(), decrypted.size()); @@ -19,8 +19,8 @@ TEST(vicepp, decrypt) { } TEST(vicepp, encrypt) { - auto encrypted = ::readFile(ASSET_ROOT "vicepp/weapon_pistol.ctx"); - auto decrypted = ::readFile(ASSET_ROOT "vicepp/weapon_pistol.txt"); + auto encrypted = ::readFile(ASSET_ROOT "vicepp/weapon_pistol.enc"); + auto decrypted = ::readFile(ASSET_ROOT "vicepp/weapon_pistol.dec"); auto test = encrypt(decrypted, KnownCodes::HL2DM); ASSERT_EQ(test.size(), encrypted.size());