16#include "gtest/gtest.h"
20#include <cereal/archives/json.hpp>
21#include <cereal/archives/binary.hpp>
27 class CerCRange_Test :
public ::testing::Test
42 class CerURange_Test :
public ::testing::Test
48 mMeta = {
"some",
"random",
"words",
"with",
"no",
"meaning" };
57 class CerYRange_Test :
public ::testing::Test
64 mMeta = {
"some",
"random",
"words",
"with",
"no",
"meaning" };
76 std::stringstream mS2;
79 class CerMArray_Test :
public ::testing::Test
86 mMeta = {
"some",
"random",
"words",
"with",
"no",
"meaning" };
90 mData.resize(mR->size());
91 for(
SizeT i = 0;
i != mData.size(); ++
i){
92 mData[
i] =
static_cast<Double>(
i)/
static_cast<Double>(mData.size());
104 std::stringstream mS;
110 cereal::JSONOutputArchive
ar(mS);
115 cereal::JSONInputArchive
ar(mS);
120 auto i1 = r->begin();
121 auto i2 = mR->begin();
123 auto i2e = mR->end();
124 for(; i1 !=
i1e; ++i1, ++i2){
132 cereal::JSONOutputArchive
ar(mS);
137 cereal::JSONInputArchive
ar(mS);
142 auto i1 = r->begin();
143 auto i2 = mR->begin();
145 auto i2e = mR->end();
146 for(; i1 !=
i1e; ++i1, ++i2){
154 cereal::JSONOutputArchive
ar(mS);
155 ar(cereal::make_nvp(
"mR",mR));
159 cereal::JSONInputArchive
ar(mS);
164 auto i1 = r->begin();
165 auto i2 = mR->begin();
167 auto i2e = mR->end();
168 for(; i1 !=
i1e; ++i1, ++i2){
176 cereal::BinaryOutputArchive
ar(mS);
177 ar(cereal::make_nvp(
"mR",mR));
181 cereal::BinaryInputArchive
ar(mS);
186 auto i1 = r->begin();
187 auto i2 = mR->begin();
189 auto i2e = mR->end();
190 for(; i1 !=
i1e; ++i1, ++i2){
198 cereal::JSONOutputArchive
ar(mS);
199 ar(cereal::make_nvp(
"mR",mR));
202 cereal::JSONOutputArchive
ar(mS2);
203 ar(cereal::make_nvp(
"mR",mR));
207 cereal::JSONInputArchive
ar(mS);
212 cereal::JSONInputArchive
ar(mS2);
219 for(
SizeT i = 0;
i != r->dim(); ++
i){
222 auto i1 = r->begin();
223 auto i2 =
r2->begin();
225 auto i2e =
r2->end();
226 for(; i1 !=
i1e; ++i1, ++i2){
233 cer::write<cer::Format::JSON>(mS, mArr);
236 cer::read<cer::Format::JSON>(mS,
arr);
238 auto i1 = mArr.begin();
239 auto i2 =
arr.begin();
240 auto i1e = mArr.end();
243 for(; i1 !=
i1e; ++i1, ++i2){
251 cer::writeFile<cer::Format::JSON>(
"cxzcer.testfile.json", mArr);
253 cer::readFile<cer::Format::JSON>(
"cxzcer.testfile.json",
arr);
255 auto i1 = mArr.begin();
256 auto i2 =
arr.begin();
257 auto i1e = mArr.end();
260 for(; i1 !=
i1e; ++i1, ++i2){
268 cer::writeFile<cer::Format::BINARY>(
"cxzcer.testfile.bin", mArr);
270 cer::readFile<cer::Format::BINARY>(
"cxzcer.testfile.bin",
arr);
272 auto i1 = mArr.begin();
273 auto i2 =
arr.begin();
274 auto i1e = mArr.end();
277 for(; i1 !=
i1e; ++i1, ++i2){
286 ::testing::InitGoogleTest(&
argc,
argv);
int main(int argc, char **argv)
CNORXZ Cereal main header.
RangePtr save_load(Archive &ar, const String &name, RangePtr &r)
Sptr< RangeBase > RangePtr
std::vector< T, Allocator< T > > Vector
Sptr< Range > rangeCast(const RangePtr r)