X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=ETL%2Ftrunk%2Ftest%2Fhandle.cpp;h=7d2ca11ad5a3de251ac5ae88ae2d920c8c034010;hb=9459638ad6797b8139f1e9f0715c96076dbf0890;hp=77be9f5a7f75774989788c24583c97f07da00c20;hpb=cee5940bae97612105db8b7e1ffcf513f9d9150c;p=synfig.git diff --git a/ETL/trunk/test/handle.cpp b/ETL/trunk/test/handle.cpp index 77be9f5..7d2ca11 100644 --- a/ETL/trunk/test/handle.cpp +++ b/ETL/trunk/test/handle.cpp @@ -1,7 +1,7 @@ /*! ======================================================================== ** Extended Template and Library Test Suite ** Handle Template Class Test -** $Id: handle.cpp,v 1.1.1.1 2005/01/04 01:31:48 darco Exp $ +** $Id$ ** ** Copyright (c) 2002 Robert B. Quattlebaum Jr. ** @@ -101,7 +101,7 @@ int handle_basic_test() if(my_test_obj::instance_count!=0) { printf("FAILED!\n"); - printf(__FILE__":%d: on create/distroy, instance count=%d, should be zero.\n",__LINE__,my_test_obj::instance_count); + printf(__FILE__":%d: on create/destroy, instance count=%d, should be zero.\n",__LINE__,my_test_obj::instance_count); return 1; } @@ -114,7 +114,7 @@ int handle_basic_test() if(my_test_obj::instance_count!=0) { printf("FAILED!\n"); - printf(__FILE__":%d: on create/distroy, instance count=%d, should be zero.\n",__LINE__,my_test_obj::instance_count); + printf(__FILE__":%d: on create/destroy, instance count=%d, should be zero.\n",__LINE__,my_test_obj::instance_count); return 1; } @@ -167,6 +167,17 @@ int handle_general_use_test(void) return 1; } + { + obj_handle a(new my_test_obj(27)), b(new my_test_obj(42)); + a.swap(b); + if (a->my_id != 42 || b->my_id != 27) + { + printf("FAILED!\n"); + printf(__FILE__":%d: On swap (27,42) gave (%d,%d), should be (42,27).\n",__LINE__,a->my_id,b->my_id); + return 1; + } + } + my_other_list.clear(); if(my_test_obj::instance_count) { @@ -430,10 +441,21 @@ int loose_handle_test(void) } } - if(my_test_obj::instance_count!=1) + { + etl::loose_handle a(new my_test_obj(27)), b(new my_test_obj(42)); + a.swap(b); + if (a->my_id != 42 || b->my_id != 27) + { + printf("FAILED!\n"); + printf(__FILE__":%d: on loose_handle swap (27,42) gave (%d,%d), should be (42,27).\n",__LINE__,a->my_id,b->my_id); + return 1; + } + } + + if(my_test_obj::instance_count!=3) { printf("FAILED!\n"); - printf(__FILE__":%d: on create/destroy, instance count=%d, should be 1.\n",__LINE__,my_test_obj::instance_count); + printf(__FILE__":%d: on create/destroy, instance count=%d, should be 3.\n",__LINE__,my_test_obj::instance_count); return 1; }