blob: 816aa1c1a815981355d6d3ebc56ef289276d0a45 (
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
|
#include <forstio/test/suite.hpp>
#include "../c++/data.hpp"
namespace {
namespace sch {
using namespace saw::schema;
using Int32Array = Array<
Int32
>;
}
SAW_TEST("Data Native/Array Access with Data Native"){
using namespace saw;
data<sch::Int32Array,encode::Native> prim{2u};
prim.at(1u).set(0);
data<schema::UInt64, encode::Native> i{1u};
auto& a = prim.at({i});
a.set(5);
auto b = prim.at({i});
b.set(10);
// Check if it's a reference being manipulated
SAW_EXPECT(a.get() == 5, "'a' has unexpected value.");
SAW_EXPECT(b.get() == 10, "'b' has unexpected value.");
}
}
|