osb/source/test/serialization_test.cpp

29 lines
557 B
C++
Raw Normal View History

2023-06-20 04:33:09 +00:00
#include "StarDataStreamDevices.hpp"
#include "gtest/gtest.h"
using namespace Star;
template <typename T>
void testMap(T const& map) {
auto byteArray = DataStreamBuffer::serializeMapContainer(map);
auto mapOut = DataStreamBuffer::deserializeMapContainer<T>(byteArray);
EXPECT_EQ(map, mapOut);
}
TEST(DataStreamTest, All) {
Map<int, int> map1 = {
{1, 2}, {3, 4}, {5, 6},
};
Map<String, int> map2 = {
{"asdf", 1}, {"asdf1", 2}, {"omg", 2},
};
Map<String, int> map3 = {};
testMap(map1);
testMap(map2);
testMap(map3);
}