From b139d148182be100c25d5b04baa9611ebd4abd87 Mon Sep 17 00:00:00 2001 From: Ciaran McCreesh Date: Sun, 20 Mar 2011 19:21:20 +0000 Subject: gtest more --- paludis/util/files.m4 | 2 +- paludis/util/hashes_TEST.cc | 40 ++++++++++++++++------------------------ 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/paludis/util/files.m4 b/paludis/util/files.m4 index 502419084..9f87c3552 100644 --- a/paludis/util/files.m4 +++ b/paludis/util/files.m4 @@ -42,7 +42,7 @@ add(`fs_error', `hh', `cc') add(`fs_path', `hh', `cc', `fwd', `se', `test', `testscript') add(`fs_stat', `hh', `cc', `fwd', `test', `testscript') add(`graph', `hh', `cc', `fwd', `impl', `test') -add(`hashes', `hh', `cc', `test') +add(`hashes', `hh', `cc', `gtest') add(`iterator_funcs', `hh', `test') add(`indirect_iterator', `hh', `fwd', `impl', `gtest') add(`is_file_with_extension', `hh', `cc', `se', `gtest', `testscript') diff --git a/paludis/util/hashes_TEST.cc b/paludis/util/hashes_TEST.cc index 46ada4e8f..2cf3ea561 100644 --- a/paludis/util/hashes_TEST.cc +++ b/paludis/util/hashes_TEST.cc @@ -18,34 +18,26 @@ */ #include -#include -#include + #include -using namespace test; +#include + using namespace paludis; -namespace test_cases +TEST(Hashes, Tuple) { - struct HashTupleTest : TestCase - { - HashTupleTest() : TestCase("hash tuple") { } - - void run() - { - std::set hashes; - - for (int x(1) ; x < 20 ; ++x) - TEST_CHECK(hashes.insert(Hash >()(std::make_tuple(x))).second); - - for (int x(1) ; x < 20 ; ++x) - for (int y(1) ; y < 20 ; ++y) - TEST_CHECK(hashes.insert(Hash >()(std::make_tuple(x, y))).second); - - for (int x(1) ; x < 20 ; ++x) - for (int y(1) ; y < 20 ; ++y) - TEST_CHECK(hashes.insert(Hash >()(std::make_tuple(x, y, 42))).second); - } - } test_hash_tuple; + std::set hashes; + + for (int x(1) ; x < 20 ; ++x) + ASSERT_TRUE(hashes.insert(Hash >()(std::make_tuple(x))).second); + + for (int x(1) ; x < 20 ; ++x) + for (int y(1) ; y < 20 ; ++y) + ASSERT_TRUE(hashes.insert(Hash >()(std::make_tuple(x, y))).second); + + for (int x(1) ; x < 20 ; ++x) + for (int y(1) ; y < 20 ; ++y) + ASSERT_TRUE(hashes.insert(Hash >()(std::make_tuple(x, y, 42))).second); } -- cgit v1.2.3