From 0e972ecc71b6bab50cb263c2684eca1cd07db532 Mon Sep 17 00:00:00 2001 From: Michael Davidsaver Date: Thu, 16 Jul 2020 19:11:50 -0700 Subject: [PATCH] more testshared --- test/testshared.cpp | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/test/testshared.cpp b/test/testshared.cpp index 16c873e..b73c3d0 100644 --- a/test/testshared.cpp +++ b/test/testshared.cpp @@ -8,6 +8,7 @@ #include #include +#include #include #include @@ -136,6 +137,30 @@ void testComplex() testEq(*X[0], 4u); } +void testValue() +{ + testDiag("%s", __func__); + + auto top = TypeDef(TypeCode::UInt32).create(); + + shared_array A(allocArray(ArrayType::Value, 2u).castTo()); + + A[0] = top.cloneEmpty(); + A[0] = 1u; + A[1] = top.cloneEmpty(); + A[1] = 2u; + + auto varr(A.castTo()); + testEq(varr.size(), 2u); + testEq(varr.original_type(), ArrayType::Value); + + auto B(varr.castTo()); + + testEq(B.size(), 2u); + testEq(B.at(0).as(), 1u); + testEq(B.at(1).as(), 2u); +} + void testCast() { testDiag("%s", __func__); @@ -242,7 +267,7 @@ void testConvert() MAIN(testshared) { - testPlan(110); + testPlan(115); testSetup(); testEmpty(); testEmpty(); @@ -255,6 +280,7 @@ MAIN(testshared) testFreeze(); testFreezeError(); testComplex(); + testValue(); testCast(); testFromVector(); testElemAlloc();