1
0
mirror of synced 2024-11-14 10:37:40 +01:00

Add test for path serialisation

This commit is contained in:
Stepland 2020-03-03 01:19:22 +01:00
parent c08670d641
commit 724d6e3e69
2 changed files with 32 additions and 1 deletions

View File

@ -0,0 +1,30 @@
#include <cassert>
#include <fstream>
#include <string>
#include <cereal/archives/json.hpp>
#include <cereal/types/string.hpp>
#include <ghc/filesystem.hpp>
#include "../src/Toolkit/ExtraCerealTypes/GHCFilesystemPath.hpp"
int main(int argc, char const *argv[]) {
ghc::filesystem::path ref{"hihi/haha/hoho.jpg"};
{
std::ofstream file;
file.open("cereal_test_specialize_path.json", std::ofstream::trunc | std::ofstream::out);
cereal::JSONOutputArchive archive{file};
archive(ref);
}
ghc::filesystem::path test;
{
std::ifstream file;
file.open("cereal_test_specialize_path.json", std::ifstream::in);
cereal::JSONInputArchive archive{file};
archive(test);
}
assert((ref == test));
//std::remove("cereal_test_specialize_path.json");
return 0;
}

View File

@ -1,6 +1,7 @@
test_files = [
'cereal_specialize_enums.cpp',
'cereal_unordered_map.cpp'
'cereal_unordered_map.cpp',
'cereal_specialize_path.cpp'
]
foreach test_file : test_files