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') 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 From 2fe32ba19571ff775a55f61eca355a46f269393e Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Thu, 4 Nov 2010 19:48:53 +0000 Subject: FString tests, the new one causes a segfault with the old fstring. --- src/unit/fstring.unit | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'src/unit') diff --git a/src/unit/fstring.unit b/src/unit/fstring.unit index 00b6eed..c6d7414 100644 --- a/src/unit/fstring.unit +++ b/src/unit/fstring.unit @@ -339,4 +339,13 @@ suite FString a = "This is a test."; unitTest( a.replace("i", "ooo") == "Thooos ooos a test." ); } + + test coreDerefBug1 + { + Bu::FString a, b; + a = "bob"; + a.setSize( 0 ); + b = a; + b.getStr(); + } } -- cgit v1.2.3