From 867dae89929a11a421ec21af71d494ad0ecc1963 Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 14 Oct 2010 23:26:25 +0000 Subject: SharedCore has more features now, which is cool, including a test to see if another object of the parent type has the same core, and another to clone the parent object. That one is pretty cool, it means you can now get a real copy when you want to, great for multi-threaded stuff. Also, two more classes are now SharedCore: Hash and Heap! --- src/unit/hash.unit | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/unit/hash.unit') diff --git a/src/unit/hash.unit b/src/unit/hash.unit index e3d7e42..124b074 100644 --- a/src/unit/hash.unit +++ b/src/unit/hash.unit @@ -84,4 +84,17 @@ suite Hash printf(" - \"%s\" = %d\n", i.getKey().getStr(), i.getValue() ); } */ } + + test copy + { + StrIntHash h; + h.insert("hello", 55 ); + h.insert("goodbye", -1812 ); + + StrIntHash h2 = h; + unitTest( h2.isCoreShared( h ) ); + + StrIntHash h3 = h.clone(); + unitTest( !h3.isCoreShared( h ) ); + } } -- cgit v1.2.3