-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
98 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
#ifndef NTH_IO_SERIALIZE_ROUND_TRIP_H | ||
#define NTH_IO_SERIALIZE_ROUND_TRIP_H | ||
|
||
#include <concepts> | ||
#include <string> | ||
|
||
#include "nth/io/reader/string.h" | ||
#include "nth/io/serialize/deserialize.h" | ||
#include "nth/io/serialize/serialize.h" | ||
#include "nth/io/writer/string.h" | ||
#include "nth/test/test.h" | ||
|
||
NTH_TEST("nth/io/serialize/round-trip", | ||
std::equality_comparable auto const &original) { | ||
std::decay_t<decltype(original)> object; | ||
|
||
{ | ||
std::string content; | ||
|
||
{ | ||
nth::io::string_writer s(content); | ||
NTH_ASSERT(nth::io::serialize(s, original)); | ||
} | ||
|
||
{ | ||
nth::io::string_reader d(content); | ||
NTH_ASSERT(nth::io::deserialize(d, object)); | ||
} | ||
} | ||
|
||
NTH_EXPECT(original == object); | ||
} | ||
|
||
#endif // NTH_IO_SERIALIZE_ROUND_TRIP_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters