From 4a4bfa2ccf179e15a5b8e98f398c16f693ddd3e5 Mon Sep 17 00:00:00 2001 From: Claudius 'keldu' Holeksa Date: Sat, 7 Sep 2024 19:25:12 +0200 Subject: Fixing raw data encoding. Prep for C layer --- modules/codec/tests/data_raw.cpp | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) (limited to 'modules/codec/tests') diff --git a/modules/codec/tests/data_raw.cpp b/modules/codec/tests/data_raw.cpp index 99d55a8..11e2c5e 100644 --- a/modules/codec/tests/data_raw.cpp +++ b/modules/codec/tests/data_raw.cpp @@ -4,7 +4,33 @@ namespace { namespace sch { using namespace saw::schema; + +using Int32Array = Array< + Int32 +>; } +SAW_TEST("Data NativeRaw/Array of Primitives"){ + using namespace saw; + + data prim{4u}; + prim.at(1u).set(0); + + auto a = prim.at(1u); + + a.set(5); + + auto b = prim.at(1u); + // Check if it's a reference being manipulated + SAW_EXPECT(a.get() == 5, "'a' has unexpected value."); + SAW_EXPECT(b.get() == 5, "'b' has unexpected value."); + + auto c = prim.at(1u); + c.set(10); + + SAW_EXPECT(a.get() == 10, "'a' has unexpected value."); + SAW_EXPECT(b.get() == 10, "'b' has unexpected value."); + SAW_EXPECT(c.get() == 10, "'c' has unexpected value."); +} } -- cgit v1.2.3