summaryrefslogtreecommitdiff
path: root/modules/codec/tests/forst.cpp
blob: 96c4dd0c8eec54deae59e70acc3e8ad481bb53d7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
#include <forstio/test/suite.hpp>
#include "../c++/data.hpp"
#include "../c++/forst.hpp"

#include <iostream>

namespace {
namespace schema {
using namespace saw::schema;

using TestStruct = Struct<
	Member<String, "string">,
	Member<UInt64, "number">,
	Member<Int8, "signed">
>;

using TestArray = Array<
	TestStruct
>;

SAW_TEST("Codec Forst Info"){
	using namespace saw;

	{
		uint64_t depth = impl::forst_codec_info<schema::UInt64>::layers;
		SAW_EXPECT(depth == 0, "Layer info is wrong");
	}
	{
		uint64_t depth = impl::forst_codec_info<TestStruct>::layers;
		SAW_EXPECT(depth == 1, "Layer info is wrong");
	}
	{
		uint64_t depth = impl::forst_codec_info<TestArray>::layers;
		SAW_EXPECT(depth == 2, "Layer info is wrong");
	}
}
}
}