Field de-duplication
add a global cache of Field instances to allow O(0) comparison of types.
This commit is contained in:
@@ -24,6 +24,8 @@
|
||||
#include <pv/noDefaultMethods.h>
|
||||
#include <pv/byteBuffer.h>
|
||||
#include <pv/convert.h>
|
||||
#include <pv/pvUnitTest.h>
|
||||
#include <pv/current_function.h>
|
||||
|
||||
#include <pv/standardField.h>
|
||||
|
||||
@@ -629,6 +631,8 @@ void testStructureId() {
|
||||
|
||||
void serializationFieldTest(FieldConstPtr const & field)
|
||||
{
|
||||
testShow()<<CURRENT_FUNCTION<<"\n"<<field;
|
||||
|
||||
buffer->clear();
|
||||
|
||||
// serialize
|
||||
@@ -639,7 +643,7 @@ void serializationFieldTest(FieldConstPtr const & field)
|
||||
|
||||
FieldConstPtr deserializedField = getFieldCreate()->deserialize(buffer, control);
|
||||
|
||||
// must equal
|
||||
testShow()<<" after "<<(void*)field.get()<<" == "<<(void*)deserializedField.get();
|
||||
testOk1(*field == *deserializedField);
|
||||
}
|
||||
|
||||
|
||||
@@ -324,8 +324,8 @@ void test_extendStructure()
|
||||
<<"amended: "<<amended
|
||||
<<"expected: "<<expected;
|
||||
|
||||
testNotEqual(static_cast<const void*>(amended.get()),
|
||||
static_cast<const void*>(expected.get()));
|
||||
testEqual(static_cast<const void*>(amended.get()),
|
||||
static_cast<const void*>(expected.get()));
|
||||
testEqual(*amended, *expected);
|
||||
|
||||
testThrows(std::runtime_error,
|
||||
|
||||
Reference in New Issue
Block a user