From 0fac2b6569554cb374537102eaadb8a1aa1c6f9f Mon Sep 17 00:00:00 2001 From: Stefan Kangas Date: Fri, 10 Dec 2010 03:01:38 +0100 Subject: [PATCH] Use CHECK instead of ENSURE in test suite. (Ticket #250) --- tests/backend/test-filehandles.c | 4 ++-- tests/backend/test-filemmap.c | 12 ++++++------ tests/common/test-config.c | 6 +++--- tests/lib/test/cmdlinewrappertest.cpp | 4 ++-- tests/library/test-llist.c | 2 +- tests/library/test-psplay.c | 8 ++++---- tests/library/test-safeclib.c | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) diff --git a/tests/backend/test-filehandles.c b/tests/backend/test-filehandles.c index 351a07e4b..285fb5a2e 100644 --- a/tests/backend/test-filehandles.c +++ b/tests/backend/test-filehandles.c @@ -38,7 +38,7 @@ TEST ("basic") int fd = lumiera_file_handle_acquire (file); /* we now 'own'it and can use it */ - ENSURE (fd > -1); + CHECK (fd > -1); printf ("got filehandle #%d\n", fd); /* put it into aging, can't use anymore */ @@ -67,7 +67,7 @@ TEST ("more") for (int i=0; i<100; ++i) { fds[i] = lumiera_file_handle_acquire (files[i]); - ENSURE (fds[i] > -1); + CHECK (fds[i] > -1); printf ("got filehandle #%d\n", fds[i]); } diff --git a/tests/backend/test-filemmap.c b/tests/backend/test-filemmap.c index c93e2543c..0c64d0382 100644 --- a/tests/backend/test-filemmap.c +++ b/tests/backend/test-filemmap.c @@ -159,7 +159,7 @@ TEST (mmap_simple) /* check that the file got truncated to the desired size */ struct stat st; stat (",tmp-filemmap", &st); - ENSURE (st.st_size == 100); + CHECK (st.st_size == 100); lumiera_backend_destroy (); lumiera_config_destroy (); @@ -179,7 +179,7 @@ TEST (mmap_checkout_twice) LumieraMMap map2 = lumiera_mmapings_mmap_acquire (mmaps, file, 0, 100); - ENSURE (map->address == map2->address); + CHECK (map->address == map2->address); lumiera_mmapings_release_mmap (mmaps, map); @@ -190,7 +190,7 @@ TEST (mmap_checkout_twice) /* check that the file got truncated to the desired size */ struct stat st; stat (",tmp-filemmap", &st); - ENSURE (st.st_size == 100); + CHECK (st.st_size == 100); lumiera_backend_destroy (); lumiera_config_destroy (); @@ -217,7 +217,7 @@ TEST (mmap_checkout_again) /* check that the file got truncated to the desired size */ struct stat st; stat (",tmp-filemmap", &st); - ENSURE (st.st_size == 100); + CHECK (st.st_size == 100); lumiera_backend_destroy (); lumiera_config_destroy (); @@ -242,7 +242,7 @@ TEST (mmap_grow_existing_file) /* check that the file got truncated to the desired size */ struct stat st; stat (",tmp-filemmap", &st); - ENSURE (st.st_size == 100); + CHECK (st.st_size == 100); lumiera_backend_destroy (); lumiera_config_destroy (); @@ -266,7 +266,7 @@ TEST (mmap_readonly_file) /* check that the file got truncated to the desired size */ struct stat st; stat (",tmp-filemmap", &st); - ENSURE (st.st_size == 100); + CHECK (st.st_size == 100); lumiera_backend_destroy (); lumiera_config_destroy (); diff --git a/tests/common/test-config.c b/tests/common/test-config.c index d89f09216..522eb5fee 100644 --- a/tests/common/test-config.c +++ b/tests/common/test-config.c @@ -44,7 +44,7 @@ TEST (configitem_simple) LumieraConfigitem item; item = lumiera_configitem_new (argv[2]); - ENSURE (item); + CHECK (item); printf ("line = '%s'\n", item->line); if (item->key) @@ -71,10 +71,10 @@ TEST (lookup) lumiera_config_lookup_insert (&lookup, item); LumieraConfigitem found = lumiera_config_lookup_item_find (&lookup, "foo.bar"); - ENSURE (found == item); + CHECK (found == item); lumiera_config_lookup_remove (&lookup, found); - ENSURE (!lumiera_config_lookup_item_find (&lookup, "foo.bar")); + CHECK (!lumiera_config_lookup_item_find (&lookup, "foo.bar")); lumiera_config_lookup_destroy (&lookup); lumiera_config_destroy (); diff --git a/tests/lib/test/cmdlinewrappertest.cpp b/tests/lib/test/cmdlinewrappertest.cpp index 00a016d9f..81434839a 100644 --- a/tests/lib/test/cmdlinewrappertest.cpp +++ b/tests/lib/test/cmdlinewrappertest.cpp @@ -71,13 +71,13 @@ namespace test { // consistency checks std::ostringstream output; output << theCmdline; - ENSURE (output.str() == string(theCmdline)); + CHECK (output.str() == string(theCmdline)); i=0; string token; std::istringstream input(theCmdline); while (input >> token) - ENSURE (token == theCmdline[i++]); + CHECK (token == theCmdline[i++]); } /** @test wrapping a (albeit faked) standard commandline diff --git a/tests/library/test-llist.c b/tests/library/test-llist.c index 144b77412..b9ef45a84 100644 --- a/tests/library/test-llist.c +++ b/tests/library/test-llist.c @@ -199,7 +199,7 @@ TEST (relocate) target = source; llist_relocate (&target); - ENSURE (llist_is_head (&target, &something)); + CHECK (llist_is_head (&target, &something)); } diff --git a/tests/library/test-psplay.c b/tests/library/test-psplay.c index 06659679d..54199f9d9 100644 --- a/tests/library/test-psplay.c +++ b/tests/library/test-psplay.c @@ -241,22 +241,22 @@ TEST ("insert_find") //TestItem f = (TestItem) psplay_find (&splay_tree, "baz", 100); TestItem f = (TestItem) psplay_find (&splay_tree, "baz", 100); - ENSURE (f); + CHECK (f); printf ("found %p (%.4s)\n", &f->node, f->key); psplay_dump (&splay_tree, stdout); f = (TestItem) psplay_find (&splay_tree, "test", 100); - ENSURE (f); + CHECK (f); printf ("found %p (%.4s)\n", &f->node, f->key); psplay_dump (&splay_tree, stdout); f = (TestItem) psplay_find (&splay_tree, "test", 100); - ENSURE (f); + CHECK (f); printf ("found %p (%.4s)\n", &f->node, f->key); psplay_dump (&splay_tree, stdout); f = (TestItem) psplay_find (&splay_tree, "foo", 100); - ENSURE (f); + CHECK (f); printf ("found %p (%.4s)\n", &f->node, f->key); psplay_dump (&splay_tree, stdout); diff --git a/tests/library/test-safeclib.c b/tests/library/test-safeclib.c index a14a73c33..ba46b172e 100644 --- a/tests/library/test-safeclib.c +++ b/tests/library/test-safeclib.c @@ -37,7 +37,7 @@ TEST (allocation1024) for (int i = 0; i < 1024; ++i) { data[i] = lumiera_malloc (1024); - ENSURE (data[i]); + CHECK (data[i]); } for (int i = 0; i < 1024; ++i) {