-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make sure flatbuf::read compiles (but doesn't run yet)
- Loading branch information
1 parent
4e4b9ee
commit d97999e
Showing
5 changed files
with
28 additions
and
30 deletions.
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
#ifndef WRITE_AND_READ_ | ||
#define WRITE_AND_READ_ | ||
|
||
#include <gtest/gtest.h> | ||
|
||
#include <iostream> | ||
#include <rfl/flatbuf.hpp> | ||
#include <string> | ||
|
||
template <class... Ps> | ||
void write_and_read(const auto& _struct) { | ||
using T = std::remove_cvref_t<decltype(_struct)>; | ||
const auto serialized1 = rfl::flatbuf::write<Ps...>(_struct); | ||
const auto res = rfl::flatbuf::read<T, Ps...>(serialized1); | ||
EXPECT_TRUE(res && true) << "Test failed on read. Error: " | ||
<< res.error().value().what(); | ||
const auto serialized2 = rfl::flatbuf::write<Ps...>(res.value()); | ||
EXPECT_EQ(serialized1, serialized2); | ||
} | ||
#endif |