Add test for path serialisation
This commit is contained in:
parent
c08670d641
commit
724d6e3e69
30
test/cereal_specialize_path.cpp
Normal file
30
test/cereal_specialize_path.cpp
Normal 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;
|
||||
}
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user