diff options
author | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2009-10-29 08:11:22 +0000 |
---|---|---|
committer | arseny.kapoulkine <arseny.kapoulkine@99668b35-9821-0410-8761-19e4c4f06640> | 2009-10-29 08:11:22 +0000 |
commit | 1fdd096c8011446935396baf447bfed9331f3ff3 (patch) | |
tree | b003f83cd04fd2b17cc94c1f2b790da79ef7f241 /tests/test_memory.cpp | |
parent | 6210c21984e9319b04ba84cc9937e92519770295 (diff) |
tests: Tests can work without exceptions now
git-svn-id: http://pugixml.googlecode.com/svn/trunk@194 99668b35-9821-0410-8761-19e4c4f06640
Diffstat (limited to 'tests/test_memory.cpp')
-rw-r--r-- | tests/test_memory.cpp | 41 |
1 files changed, 15 insertions, 26 deletions
diff --git a/tests/test_memory.cpp b/tests/test_memory.cpp index 8f2d41b..8706ed2 100644 --- a/tests/test_memory.cpp +++ b/tests/test_memory.cpp @@ -29,38 +29,27 @@ TEST(custom_memory_management) // replace functions
set_memory_management_functions(allocate, deallocate);
- try
{
- {
- // parse document
- xml_document doc;
- CHECK(doc.load("<node/>"));
+ // parse document
+ xml_document doc;
+ CHECK(doc.load("<node/>"));
- CHECK(allocate_count == 1);
- CHECK(deallocate_count == 0);
- CHECK_STRING(buffer, "<node\0>");
+ CHECK(allocate_count == 1);
+ CHECK(deallocate_count == 0);
+ CHECK_STRING(buffer, "<node\0>");
- // modify document
- doc.child("node").set_name("foobars");
-
- CHECK(allocate_count == 2);
- CHECK(deallocate_count == 0);
- CHECK_STRING(buffer, "foobars");
- }
+ // modify document
+ doc.child("node").set_name("foobars");
CHECK(allocate_count == 2);
- CHECK(deallocate_count == 2);
+ CHECK(deallocate_count == 0);
CHECK_STRING(buffer, "foobars");
-
- // restore old functions
- set_memory_management_functions(old_allocate, old_deallocate);
}
- catch (const char* error)
- {
- // restore old functions
- set_memory_management_functions(old_allocate, old_deallocate);
- // rethrow
- throw error;
- }
+ CHECK(allocate_count == 2);
+ CHECK(deallocate_count == 2);
+ CHECK_STRING(buffer, "foobars");
+
+ // restore old functions
+ set_memory_management_functions(old_allocate, old_deallocate);
}
|