20aa8d563a
Summary: Add missing fields in RequestVote RPC Unnest Raft RPC requests and responses Make RPC request and reply serializable Refactor Raft network interface Implement RPC retrying with backoff period Add cerealization functions for optional Add RPC network interface for raft Add some comments and documentation Add manual test for RPC network interface Remove raft reactor experiments Reviewers: mislav.bradac, buda Reviewed By: mislav.bradac Subscribers: pullbot, mculinovic Differential Revision: https://phabricator.memgraph.io/D1066
30 lines
501 B
C++
30 lines
501 B
C++
#include <sstream>
|
|
|
|
#include "cereal/archives/json.hpp"
|
|
#include "gtest/gtest.h"
|
|
|
|
#include "utils/cereal_optional.hpp"
|
|
|
|
using std::experimental::optional;
|
|
|
|
TEST(CerealOptionalTest, SerializeAndDeserialize) {
|
|
std::stringstream ss;
|
|
|
|
optional<int> x1 = {};
|
|
optional<int> x2 = 42;
|
|
optional<int> y1, y2;
|
|
|
|
{
|
|
cereal::JSONOutputArchive oarchive(ss);
|
|
oarchive(x1, x2);
|
|
}
|
|
|
|
{
|
|
cereal::JSONInputArchive iarchive(ss);
|
|
iarchive(y1, y2);
|
|
}
|
|
|
|
EXPECT_EQ(x1, y1);
|
|
EXPECT_EQ(x2, y2);
|
|
}
|