diff --git a/testApp/misc/testSharedVector.cpp b/testApp/misc/testSharedVector.cpp index bc64f44..a1bcd1f 100644 --- a/testApp/misc/testSharedVector.cpp +++ b/testApp/misc/testSharedVector.cpp @@ -204,47 +204,34 @@ static void testConst() testOk1(wr==ror); + int *compare = writable.data(); + + testOk1(writable.unique()); + // can re-target container, but data is R/O - epics::pvData::shared_vector rodata(writable); + epics::pvData::shared_vector rodata(freeze(writable)); epics::pvData::shared_vector::reference wcr = rodata[0]; epics::pvData::shared_vector::const_reference rocr = rodata[0]; testOk1(wcr==rocr); - rodata = writable; - testOk1(rodata.data()==writable.data()); + testOk1(rodata.data()==compare); + writable = thaw(rodata); - // Data is R/W, but container can't be re-targeted - const epics::pvData::shared_vector roref(writable); + testOk1(writable.data()==compare); - // Can't change anything. - const epics::pvData::shared_vector fixed(writable); + rodata = freeze(writable); - testOk1(rodata[1]==100); + testOk1(rodata.data()==compare); - // intentionally modify shared data! - // safe since this thread owns all references. - writable[1]=200; + epics::pvData::shared_vector rodata2(rodata); - testOk1(rodata[1]==200); + testOk1(rodata.data()==rodata2.data()); - epics::pvData::shared_vector::const_iterator a; - epics::pvData::shared_vector::iterator b; - epics::pvData::shared_vector::const_iterator c; + rodata2.make_unique(); - a = writable.begin(); - b = rodata.begin(); - c = rodata.end(); - - testOk1(std::equal(b, c, a)); - - a = writable.cbegin(); - c = rodata.cend(); - - epics::pvData::shared_vector::const_reference x = rodata[1]; - - testOk1(x==200); + testOk1(rodata.data()!=rodata2.data()); } static void testSlice() @@ -359,10 +346,6 @@ static void testVoid() testDiag("Test vecter cast to/from void"); epics::pvData::shared_vector typed(4); - epics::pvData::shared_vector untyped; - epics::pvData::shared_vector constuntyped; - - untyped = epics::pvData::const_shared_vector_cast(constuntyped); epics::pvData::shared_vector untyped2(epics::pvData::static_shared_vector_cast(typed)); @@ -542,7 +525,7 @@ static void testICE() MAIN(testSharedVector) { - testPlan(153); + testPlan(154); testDiag("Tests for shared_vector"); testDiag("sizeof(shared_vector)=%lu",