summaryrefslogtreecommitdiff
path: root/modules/codec/tests/data.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'modules/codec/tests/data.cpp')
-rw-r--r--modules/codec/tests/data.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/modules/codec/tests/data.cpp b/modules/codec/tests/data.cpp
new file mode 100644
index 0000000..816aa1c
--- /dev/null
+++ b/modules/codec/tests/data.cpp
@@ -0,0 +1,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.");
+}
+
+}