From a10e381cfaffa7d3181d5c120be21e08d4ad2025 Mon Sep 17 00:00:00 2001 From: Ichthyostega Date: Fri, 22 Apr 2011 03:29:12 +0200 Subject: [PATCH] fix error in test logic need to adjust the checksum on copy :) --- tests/40components.tests | 5 +++ tests/lib/polymorphic-value-test.cpp | 58 ++++++++++++++++++++++++---- 2 files changed, 55 insertions(+), 8 deletions(-) diff --git a/tests/40components.tests b/tests/40components.tests index 7b3bdd31d..51b9c54bc 100644 --- a/tests/40components.tests +++ b/tests/40components.tests @@ -505,6 +505,11 @@ out: can_IterForEach : Yes END +TEST "Polymorphic value objects" PolymorphicValue_test < >(); + CHECK (prevSum+111 == _checkSum); // We got one primary ctor call + CHECK (prevCnt+1 <= _created); // Note: usually, the compiler optimises + CHECK (prevCnt+2 >= _created); // and skips the spurious copy-operation + CHECK (sizeof(PolyVal) > sizeof(Imp<111>)); + Interface& embedded = val; + CHECK (isSameObject(embedded,val)); + CHECK (INSTANCEOF(Imp<111>, &embedded)); + } + + void verifyOverrunProtection() {