Skip to content

Commit

Permalink
fix: add .gitattributes, set test files as binary where appropriate
Browse files Browse the repository at this point in the history
  • Loading branch information
craftablescience committed Jun 6, 2024
1 parent 69f36aa commit e47aee3
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 5 deletions.
30 changes: 30 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion test/Helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

std::vector<std::byte> 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<std::byte> out(size);
file.read(reinterpret_cast<char*>(out.data()), static_cast<std::streamsize>(size));
Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions test/vicepp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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());
Expand Down

0 comments on commit e47aee3

Please sign in to comment.