Skip to content
Browse files

Replacing the aging cppunit test library with the header-only tpunit+…

…+ framework.
  • Loading branch information...
1 parent 086a364 commit 829f726388dd7ea2102f49bb64b75ddcc69a8c2e @bingmann committed Feb 17, 2013
View
2 AUTHORS
@@ -1 +1 @@
-Timo Bingmann <tb a-with-circle idlebox dot net>
+Timo Bingmann <tb a-with-circle panthema dot net>
View
3 Makefile.in
@@ -138,9 +138,6 @@ CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
-CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
-CPPUNIT_CONFIG = @CPPUNIT_CONFIG@
-CPPUNIT_LIBS = @CPPUNIT_LIBS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
View
4 README
@@ -104,8 +104,8 @@ folding the key and data arrays.
--- Test Suite ---
-The B+ tree distribution contains an extensive test suite using
-cppunit. According to gcov 90.9% of the btree.h implementation is covered.
+The B+ tree distribution contains an extensive test suite. According to gcov
+90.9% of the btree.h implementation is covered.
--- STL Incompatibilities ---
View
93 aclocal.m4
@@ -20,99 +20,6 @@ You have another version of autoconf. It may work, but is not guaranteed to.
If you have problems, you may need to regenerate the build system entirely.
To do so, use the procedure documented by the package, typically `autoreconf'.])])
-dnl
-dnl AM_PATH_CPPUNIT(MINIMUM-VERSION, [ACTION-IF-FOUND [, ACTION-IF-NOT-FOUND]])
-dnl
-AC_DEFUN([AM_PATH_CPPUNIT],
-[
-
-AC_ARG_WITH(cppunit-prefix,[ --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)],
- cppunit_config_prefix="$withval", cppunit_config_prefix="")
-AC_ARG_WITH(cppunit-exec-prefix,[ --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)],
- cppunit_config_exec_prefix="$withval", cppunit_config_exec_prefix="")
-
- if test x$cppunit_config_exec_prefix != x ; then
- cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix"
- if test x${CPPUNIT_CONFIG+set} != xset ; then
- CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config
- fi
- fi
- if test x$cppunit_config_prefix != x ; then
- cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix"
- if test x${CPPUNIT_CONFIG+set} != xset ; then
- CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config
- fi
- fi
-
- AC_PATH_PROG(CPPUNIT_CONFIG, cppunit-config, no)
- cppunit_version_min=$1
-
- AC_MSG_CHECKING(for Cppunit - version >= $cppunit_version_min)
- no_cppunit=""
- if test "$CPPUNIT_CONFIG" = "no" ; then
- AC_MSG_RESULT(no)
- no_cppunit=yes
- else
- CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags`
- CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs`
- cppunit_version=`$CPPUNIT_CONFIG --version`
-
- cppunit_major_version=`echo $cppunit_version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
- cppunit_minor_version=`echo $cppunit_version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
- cppunit_micro_version=`echo $cppunit_version | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
-
- cppunit_major_min=`echo $cppunit_version_min | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\1/'`
- if test "x${cppunit_major_min}" = "x" ; then
- cppunit_major_min=0
- fi
-
- cppunit_minor_min=`echo $cppunit_version_min | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\2/'`
- if test "x${cppunit_minor_min}" = "x" ; then
- cppunit_minor_min=0
- fi
-
- cppunit_micro_min=`echo $cppunit_version_min | \
- sed 's/\([[0-9]]*\).\([[0-9]]*\).\([[0-9]]*\)/\3/'`
- if test "x${cppunit_micro_min}" = "x" ; then
- cppunit_micro_min=0
- fi
-
- cppunit_version_proper=`expr \
- $cppunit_major_version \> $cppunit_major_min \| \
- $cppunit_major_version \= $cppunit_major_min \& \
- $cppunit_minor_version \> $cppunit_minor_min \| \
- $cppunit_major_version \= $cppunit_major_min \& \
- $cppunit_minor_version \= $cppunit_minor_min \& \
- $cppunit_micro_version \>= $cppunit_micro_min `
-
- if test "$cppunit_version_proper" = "1" ; then
- AC_MSG_RESULT([$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version])
- else
- AC_MSG_RESULT(no)
- no_cppunit=yes
- fi
- fi
-
- if test "x$no_cppunit" = x ; then
- ifelse([$2], , :, [$2])
- else
- CPPUNIT_CFLAGS=""
- CPPUNIT_LIBS=""
- ifelse([$3], , :, [$3])
- fi
-
- AC_SUBST(CPPUNIT_CFLAGS)
- AC_SUBST(CPPUNIT_LIBS)
-])
-
-
-
-
dnl ---------------------------------------------------------------------------
dnl Author: wxWidgets development team,
dnl Francesco Montorsi,
View
165 configure
@@ -643,11 +643,6 @@ WX_CPPFLAGS
WX_CONFIG_PATH
BUILD_SPEEDTEST_FALSE
BUILD_SPEEDTEST_TRUE
-HAVE_CPPUNIT_FALSE
-HAVE_CPPUNIT_TRUE
-CPPUNIT_LIBS
-CPPUNIT_CFLAGS
-CPPUNIT_CONFIG
GCOV_FALSE
GCOV_TRUE
EGREP
@@ -755,8 +750,6 @@ enable_maintainer_mode
enable_optimize
enable_dependency_tracking
enable_gcov
-with_cppunit_prefix
-with_cppunit_exec_prefix
enable_speedtest
with_wxdir
with_wx_config
@@ -1404,8 +1397,6 @@ Optional Features:
Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --with-cppunit-prefix=PFX Prefix where CppUnit is installed (optional)
- --with-cppunit-exec-prefix=PFX Exec prefix where CppUnit is installed (optional)
--with-wxdir=PATH Use uninstalled version of wxWidgets in PATH
--with-wx-config=CONFIG wx-config script to use (optional)
--with-wx-prefix=PREFIX Prefix where wxWidgets is installed (optional)
@@ -4755,158 +4746,6 @@ if test x"$gcov" = "xtrue"; then
LIBS="$LIBS -lgcov"
fi
-# check whether cppunit is available
-
-
-
-# Check whether --with-cppunit-prefix was given.
-if test "${with_cppunit_prefix+set}" = set; then :
- withval=$with_cppunit_prefix; cppunit_config_prefix="$withval"
-else
- cppunit_config_prefix=""
-fi
-
-
-# Check whether --with-cppunit-exec-prefix was given.
-if test "${with_cppunit_exec_prefix+set}" = set; then :
- withval=$with_cppunit_exec_prefix; cppunit_config_exec_prefix="$withval"
-else
- cppunit_config_exec_prefix=""
-fi
-
-
- if test x$cppunit_config_exec_prefix != x ; then
- cppunit_config_args="$cppunit_config_args --exec-prefix=$cppunit_config_exec_prefix"
- if test x${CPPUNIT_CONFIG+set} != xset ; then
- CPPUNIT_CONFIG=$cppunit_config_exec_prefix/bin/cppunit-config
- fi
- fi
- if test x$cppunit_config_prefix != x ; then
- cppunit_config_args="$cppunit_config_args --prefix=$cppunit_config_prefix"
- if test x${CPPUNIT_CONFIG+set} != xset ; then
- CPPUNIT_CONFIG=$cppunit_config_prefix/bin/cppunit-config
- fi
- fi
-
- # Extract the first word of "cppunit-config", so it can be a program name with args.
-set dummy cppunit-config; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_path_CPPUNIT_CONFIG+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $CPPUNIT_CONFIG in
- [\\/]* | ?:[\\/]*)
- ac_cv_path_CPPUNIT_CONFIG="$CPPUNIT_CONFIG" # Let the user override the test with a path.
- ;;
- *)
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_path_CPPUNIT_CONFIG="$as_dir/$ac_word$ac_exec_ext"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
- test -z "$ac_cv_path_CPPUNIT_CONFIG" && ac_cv_path_CPPUNIT_CONFIG="no"
- ;;
-esac
-fi
-CPPUNIT_CONFIG=$ac_cv_path_CPPUNIT_CONFIG
-if test -n "$CPPUNIT_CONFIG"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPPUNIT_CONFIG" >&5
-$as_echo "$CPPUNIT_CONFIG" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- cppunit_version_min=1.10.0
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for Cppunit - version >= $cppunit_version_min" >&5
-$as_echo_n "checking for Cppunit - version >= $cppunit_version_min... " >&6; }
- no_cppunit=""
- if test "$CPPUNIT_CONFIG" = "no" ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- no_cppunit=yes
- else
- CPPUNIT_CFLAGS=`$CPPUNIT_CONFIG --cflags`
- CPPUNIT_LIBS=`$CPPUNIT_CONFIG --libs`
- cppunit_version=`$CPPUNIT_CONFIG --version`
-
- cppunit_major_version=`echo $cppunit_version | \
- sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
- cppunit_minor_version=`echo $cppunit_version | \
- sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
- cppunit_micro_version=`echo $cppunit_version | \
- sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
-
- cppunit_major_min=`echo $cppunit_version_min | \
- sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\1/'`
- if test "x${cppunit_major_min}" = "x" ; then
- cppunit_major_min=0
- fi
-
- cppunit_minor_min=`echo $cppunit_version_min | \
- sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\2/'`
- if test "x${cppunit_minor_min}" = "x" ; then
- cppunit_minor_min=0
- fi
-
- cppunit_micro_min=`echo $cppunit_version_min | \
- sed 's/\([0-9]*\).\([0-9]*\).\([0-9]*\)/\3/'`
- if test "x${cppunit_micro_min}" = "x" ; then
- cppunit_micro_min=0
- fi
-
- cppunit_version_proper=`expr \
- $cppunit_major_version \> $cppunit_major_min \| \
- $cppunit_major_version \= $cppunit_major_min \& \
- $cppunit_minor_version \> $cppunit_minor_min \| \
- $cppunit_major_version \= $cppunit_major_min \& \
- $cppunit_minor_version \= $cppunit_minor_min \& \
- $cppunit_micro_version \>= $cppunit_micro_min `
-
- if test "$cppunit_version_proper" = "1" ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version" >&5
-$as_echo "$cppunit_major_version.$cppunit_minor_version.$cppunit_micro_version" >&6; }
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- no_cppunit=yes
- fi
- fi
-
- if test "x$no_cppunit" = x ; then
- :
- else
- CPPUNIT_CFLAGS=""
- CPPUNIT_LIBS=""
- :
- fi
-
-
-
-
-
- if test x$CPPUNIT_CONFIG != xno; then
- HAVE_CPPUNIT_TRUE=
- HAVE_CPPUNIT_FALSE='#'
-else
- HAVE_CPPUNIT_TRUE='#'
- HAVE_CPPUNIT_FALSE=
-fi
-
-
# Conditional whether to compile the speedtest binary
# Check whether --enable-speedtest was given.
if test "${enable_speedtest+set}" = set; then :
@@ -5542,10 +5381,6 @@ if test -z "${GCOV_TRUE}" && test -z "${GCOV_FALSE}"; then
as_fn_error $? "conditional \"GCOV\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
fi
-if test -z "${HAVE_CPPUNIT_TRUE}" && test -z "${HAVE_CPPUNIT_FALSE}"; then
- as_fn_error $? "conditional \"HAVE_CPPUNIT\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
-fi
if test -z "${BUILD_SPEEDTEST_TRUE}" && test -z "${BUILD_SPEEDTEST_FALSE}"; then
as_fn_error $? "conditional \"BUILD_SPEEDTEST\" was never defined.
Usually this means the macro was only invoked conditionally." "$LINENO" 5
View
5 configure.ac
@@ -71,11 +71,6 @@ if test x"$gcov" = "xtrue"; then
LIBS="$LIBS -lgcov"
fi
-# check whether cppunit is available
-AM_PATH_CPPUNIT(1.10.0)
-
-AM_CONDITIONAL(HAVE_CPPUNIT, test x$CPPUNIT_CONFIG != xno)
-
# Conditional whether to compile the speedtest binary
AC_ARG_ENABLE(speedtest,
[ --enable-speedtest Build the speedtest (takes lots of RAM) (default: no)],
View
3 include/Makefile.in
@@ -112,9 +112,6 @@ CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
-CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
-CPPUNIT_CONFIG = @CPPUNIT_CONFIG@
-CPPUNIT_LIBS = @CPPUNIT_LIBS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
View
2 include/stx/btree
@@ -5,7 +5,7 @@
/*
* STX B+ Tree Template Classes v0.8.6
- * Copyright (C) 2008-2011 Timo Bingmann
+ * Copyright (C) 2008-2011 Timo Bingmann <tb@panthema.net>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
View
4 include/stx/btree.dox
@@ -135,8 +135,8 @@ folding the key and data arrays.
\section sec6 Test Suite
-The B+ tree distribution contains an extensive test suite using
-cppunit. According to gcov 91.9% of the btree.h implementation is covered.
+The B+ tree distribution contains an extensive test suite. According to gcov
+91.9% of the btree.h implementation is covered.
\section sec7 STL Incompatibilities
View
2 include/stx/btree.h
@@ -5,7 +5,7 @@
/*
* STX B+ Tree Template Classes v0.8.6
- * Copyright (C) 2008-2013 Timo Bingmann
+ * Copyright (C) 2008-2013 Timo Bingmann <tb@panthema.net>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
View
2 include/stx/btree_map
@@ -5,7 +5,7 @@
/*
* STX B+ Tree Template Classes v0.8.6
- * Copyright (C) 2008-2011 Timo Bingmann
+ * Copyright (C) 2008-2011 Timo Bingmann <tb@panthema.net>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
View
2 include/stx/btree_map.h
@@ -5,7 +5,7 @@
/*
* STX B+ Tree Template Classes v0.8.6
- * Copyright (C) 2008-2011 Timo Bingmann
+ * Copyright (C) 2008-2011 Timo Bingmann <tb@panthema.net>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
View
2 include/stx/btree_multimap
@@ -5,7 +5,7 @@
/*
* STX B+ Tree Template Classes v0.8.6
- * Copyright (C) 2008-2011 Timo Bingmann
+ * Copyright (C) 2008-2011 Timo Bingmann <tb@panthema.net>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
View
3 speedtest/Makefile.in
@@ -97,9 +97,6 @@ CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
-CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
-CPPUNIT_CONFIG = @CPPUNIT_CONFIG@
-CPPUNIT_LIBS = @CPPUNIT_LIBS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
View
77 testsuite/BoundTest.cc
@@ -1,8 +1,6 @@
-// $Id$
-
/*
* STX B+ Tree Template Classes v0.8.6
- * Copyright (C) 2008-2011 Timo Bingmann
+ * Copyright (C) 2008-2013 Timo Bingmann <tb@panthema.net>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
@@ -19,21 +17,20 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <cppunit/extensions/HelperMacros.h>
+#include "tpunit.h"
#include <stdlib.h>
#include <stx/btree_multimap.h>
#include <set>
-class BoundTest : public CPPUNIT_NS::TestFixture
+struct BoundTest : public tpunit::TestFixture
{
- CPPUNIT_TEST_SUITE( BoundTest );
- CPPUNIT_TEST(test_3200_10);
- CPPUNIT_TEST(test_320_1000);
- CPPUNIT_TEST_SUITE_END();
-
-protected:
+ BoundTest() : tpunit::TestFixture(
+ TEST(BoundTest::test_3200_10),
+ TEST(BoundTest::test_320_1000)
+ )
+ {}
struct traits_nodebug
{
@@ -59,26 +56,26 @@ class BoundTest : public CPPUNIT_NS::TestFixture
unsigned int k = rand() % modulo;
unsigned int v = 234;
- CPPUNIT_ASSERT( bt.size() == set.size() );
+ ASSERT( bt.size() == set.size() );
bt.insert2(k, v);
set.insert(k);
- CPPUNIT_ASSERT( bt.count(k) == set.count(k) );
+ ASSERT( bt.count(k) == set.count(k) );
- CPPUNIT_ASSERT( bt.size() == set.size() );
+ ASSERT( bt.size() == set.size() );
}
- CPPUNIT_ASSERT( bt.size() == insnum );
+ ASSERT( bt.size() == insnum );
// *** iterate
{
btree_type::iterator bi = bt.begin();
multiset_type::const_iterator si = set.begin();
for(; bi != bt.end() && si != set.end(); ++bi, ++si)
{
- CPPUNIT_ASSERT( *si == bi.key() );
+ ASSERT( *si == bi.key() );
}
- CPPUNIT_ASSERT( bi == bt.end() );
- CPPUNIT_ASSERT( si == set.end() );
+ ASSERT( bi == bt.end() );
+ ASSERT( si == set.end() );
}
// *** existance
@@ -87,7 +84,7 @@ class BoundTest : public CPPUNIT_NS::TestFixture
{
unsigned int k = rand() % modulo;
- CPPUNIT_ASSERT( bt.exists(k) );
+ ASSERT( bt.exists(k) );
}
// *** counting
@@ -96,7 +93,7 @@ class BoundTest : public CPPUNIT_NS::TestFixture
{
unsigned int k = rand() % modulo;
- CPPUNIT_ASSERT( bt.count(k) == set.count(k) );
+ ASSERT( bt.count(k) == set.count(k) );
}
// *** lower_bound
@@ -106,11 +103,11 @@ class BoundTest : public CPPUNIT_NS::TestFixture
btree_type::const_iterator bi = bt.lower_bound(k);
if ( bi == bt.end() )
- CPPUNIT_ASSERT( si == set.end() );
+ ASSERT( si == set.end() );
else if ( si == set.end() )
- CPPUNIT_ASSERT( bi == bt.end() );
+ ASSERT( bi == bt.end() );
else
- CPPUNIT_ASSERT( *si == bi.key() );
+ ASSERT( *si == bi.key() );
}
// *** upper_bound
@@ -120,11 +117,11 @@ class BoundTest : public CPPUNIT_NS::TestFixture
btree_type::const_iterator bi = bt.upper_bound(k);
if ( bi == bt.end() )
- CPPUNIT_ASSERT( si == set.end() );
+ ASSERT( si == set.end() );
else if ( si == set.end() )
- CPPUNIT_ASSERT( bi == bt.end() );
+ ASSERT( bi == bt.end() );
else
- CPPUNIT_ASSERT( *si == bi.key() );
+ ASSERT( *si == bi.key() );
}
// *** equal_range
@@ -134,18 +131,18 @@ class BoundTest : public CPPUNIT_NS::TestFixture
std::pair<btree_type::const_iterator, btree_type::const_iterator> bi = bt.equal_range(k);
if ( bi.first == bt.end() )
- CPPUNIT_ASSERT( si.first == set.end() );
+ ASSERT( si.first == set.end() );
else if ( si.first == set.end() )
- CPPUNIT_ASSERT( bi.first == bt.end() );
+ ASSERT( bi.first == bt.end() );
else
- CPPUNIT_ASSERT( *si.first == bi.first.key() );
+ ASSERT( *si.first == bi.first.key() );
if ( bi.second == bt.end() )
- CPPUNIT_ASSERT( si.second == set.end() );
+ ASSERT( si.second == set.end() );
else if ( si.second == set.end() )
- CPPUNIT_ASSERT( bi.second == bt.end() );
+ ASSERT( bi.second == bt.end() );
else
- CPPUNIT_ASSERT( *si.second == bi.second.key() );
+ ASSERT( *si.second == bi.second.key() );
}
// *** deletion
@@ -156,18 +153,18 @@ class BoundTest : public CPPUNIT_NS::TestFixture
if (set.find(k) != set.end())
{
- CPPUNIT_ASSERT( bt.size() == set.size() );
+ ASSERT( bt.size() == set.size() );
- CPPUNIT_ASSERT( bt.exists(k) );
- CPPUNIT_ASSERT( bt.erase_one(k) );
+ ASSERT( bt.exists(k) );
+ ASSERT( bt.erase_one(k) );
set.erase( set.find(k) );
- CPPUNIT_ASSERT( bt.size() == set.size() );
+ ASSERT( bt.size() == set.size() );
}
}
- CPPUNIT_ASSERT( bt.empty() );
- CPPUNIT_ASSERT( set.empty() );
+ ASSERT( bt.empty() );
+ ASSERT( set.empty() );
}
void test_3200_10()
@@ -179,6 +176,6 @@ class BoundTest : public CPPUNIT_NS::TestFixture
{
test_multi(320, 1000);
}
-};
-CPPUNIT_TEST_SUITE_REGISTRATION( BoundTest );
+} __BoundTest;
+
View
32 testsuite/DumpRestoreTest.cc
@@ -1,8 +1,6 @@
-// $Id$
-
/*
* STX B+ Tree Template Classes v0.8.6
- * Copyright (C) 2008-2011 Timo Bingmann
+ * Copyright (C) 2008-2013 Timo Bingmann <tb@panthema.net>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
@@ -19,7 +17,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <cppunit/extensions/HelperMacros.h>
+#include "tpunit.h"
#include <stdlib.h>
@@ -28,13 +26,12 @@
#include <stx/btree_multiset.h>
-class DumpRestoreTest : public CPPUNIT_NS::TestFixture
+struct DumpRestoreTest : public tpunit::TestFixture
{
- CPPUNIT_TEST_SUITE( DumpRestoreTest );
- CPPUNIT_TEST(test_dump_restore_3200);
- CPPUNIT_TEST_SUITE_END();
-
-protected:
+ DumpRestoreTest() : tpunit::TestFixture(
+ TEST(DumpRestoreTest::test_dump_restore_3200)
+ )
+ {}
struct traits_nodebug
{
@@ -61,7 +58,7 @@ class DumpRestoreTest : public CPPUNIT_NS::TestFixture
bt.insert(rand() % 100);
}
- CPPUNIT_ASSERT(bt.size() == 3200);
+ ASSERT(bt.size() == 3200);
std::ostringstream os;
bt.dump(os);
@@ -71,7 +68,7 @@ class DumpRestoreTest : public CPPUNIT_NS::TestFixture
// Also cannot check the length, because it depends on the rand()
// algorithm in stdlib.
- // CPPUNIT_ASSERT( dumpstr.size() == 47772 );
+ // ASSERT( dumpstr.size() == 47772 );
// cannot check the string with a hash function, because it contains
// memory pointers
@@ -80,14 +77,14 @@ class DumpRestoreTest : public CPPUNIT_NS::TestFixture
btree_type bt2;
std::istringstream iss(dumpstr);
- CPPUNIT_ASSERT( bt2.restore(iss) );
+ ASSERT( bt2.restore(iss) );
- CPPUNIT_ASSERT( bt2.size() == 3200 );
+ ASSERT( bt2.size() == 3200 );
srand(34234235);
for(unsigned int i = 0; i < 3200; i++)
{
- CPPUNIT_ASSERT( bt2.exists(rand() % 100) );
+ ASSERT( bt2.exists(rand() % 100) );
}
}
@@ -99,9 +96,8 @@ class DumpRestoreTest : public CPPUNIT_NS::TestFixture
otherbtree_type bt3;
std::istringstream iss(dumpstr);
- CPPUNIT_ASSERT( !bt3.restore(iss) );
+ ASSERT( !bt3.restore(iss) );
}
}
-};
-CPPUNIT_TEST_SUITE_REGISTRATION( DumpRestoreTest );
+} __DumpRestoreTest;
View
4 testsuite/InstantiationTest.cc
@@ -1,8 +1,6 @@
-// $Id$
-
/*
* STX B+ Tree Template Classes v0.8.6
- * Copyright (C) 2008-2011 Timo Bingmann
+ * Copyright (C) 2008-2013 Timo Bingmann <tb@panthema.net>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
View
322 testsuite/IteratorTest.cc
@@ -1,8 +1,6 @@
-// $Id$
-
/*
* STX B+ Tree Template Classes v0.8.6
- * Copyright (C) 2008-2011 Timo Bingmann
+ * Copyright (C) 2008-2013 Timo Bingmann <tb@panthema.net>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
@@ -19,7 +17,7 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <cppunit/extensions/HelperMacros.h>
+#include "tpunit.h"
#include <stdlib.h>
@@ -30,18 +28,17 @@
#include <stx/btree_map.h>
#include <stx/btree_set.h>
-class IteratorTest : public CPPUNIT_NS::TestFixture
+struct IteratorTest : public tpunit::TestFixture
{
- CPPUNIT_TEST_SUITE( IteratorTest );
- CPPUNIT_TEST(test_iterator1);
- CPPUNIT_TEST(test_iterator2);
- CPPUNIT_TEST(test_iterator3);
- CPPUNIT_TEST(test_iterator4);
- CPPUNIT_TEST(test_iterator5);
- CPPUNIT_TEST(test_erase_iterator1);
- CPPUNIT_TEST_SUITE_END();
-
-protected:
+ IteratorTest() : tpunit::TestFixture(
+ TEST(IteratorTest::test_iterator1),
+ TEST(IteratorTest::test_iterator2),
+ TEST(IteratorTest::test_iterator3),
+ TEST(IteratorTest::test_iterator4),
+ TEST(IteratorTest::test_iterator5),
+ TEST(IteratorTest::test_erase_iterator1)
+ )
+ {}
struct traits_nodebug
{
@@ -65,12 +62,12 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
vector.push_back( rand() % 1000 );
}
- CPPUNIT_ASSERT( vector.size() == 3200 );
+ ASSERT( vector.size() == 3200 );
// test construction and insert(iter, iter) function
btree_type bt(vector.begin(), vector.end());
- CPPUNIT_ASSERT( bt.size() == 3200 );
+ ASSERT( bt.size() == 3200 );
// copy for later use
btree_type bt2 = bt;
@@ -79,12 +76,12 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
srand(34234235);
for(unsigned int i = 0; i < 3200; i++)
{
- CPPUNIT_ASSERT(bt.size() == 3200 - i);
- CPPUNIT_ASSERT( bt.erase_one(rand() % 1000) );
- CPPUNIT_ASSERT(bt.size() == 3200 - i - 1);
+ ASSERT(bt.size() == 3200 - i);
+ ASSERT( bt.erase_one(rand() % 1000) );
+ ASSERT(bt.size() == 3200 - i - 1);
}
- CPPUNIT_ASSERT( bt.empty() );
+ ASSERT( bt.empty() );
// copy btree values back to a vector
@@ -94,7 +91,7 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
// afer sorting the vector, the two must be the same
std::sort(vector.begin(), vector.end());
- CPPUNIT_ASSERT( vector == vector2 );
+ ASSERT( vector == vector2 );
// test reverse iterator
vector2.clear();
@@ -105,13 +102,13 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
btree_type::reverse_iterator ri = bt2.rbegin();
for(unsigned int i = 0; i < vector2.size(); ++i)
{
- CPPUNIT_ASSERT( vector[i] == vector2[i] );
- CPPUNIT_ASSERT( vector[i] == *ri );
+ ASSERT( vector[i] == vector2[i] );
+ ASSERT( vector[i] == *ri );
ri++;
}
- CPPUNIT_ASSERT( ri == bt2.rend() );
+ ASSERT( ri == bt2.rend() );
}
void test_iterator2()
@@ -127,12 +124,12 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
vector.push_back( btree_type::value_type(rand() % 1000, 0) );
}
- CPPUNIT_ASSERT( vector.size() == 3200 );
+ ASSERT( vector.size() == 3200 );
// test construction and insert(iter, iter) function
btree_type bt(vector.begin(), vector.end());
- CPPUNIT_ASSERT( bt.size() == 3200 );
+ ASSERT( bt.size() == 3200 );
// copy for later use
btree_type bt2 = bt;
@@ -141,12 +138,12 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
srand(34234235);
for(unsigned int i = 0; i < 3200; i++)
{
- CPPUNIT_ASSERT(bt.size() == 3200 - i);
- CPPUNIT_ASSERT( bt.erase_one(rand() % 1000) );
- CPPUNIT_ASSERT(bt.size() == 3200 - i - 1);
+ ASSERT(bt.size() == 3200 - i);
+ ASSERT( bt.erase_one(rand() % 1000) );
+ ASSERT(bt.size() == 3200 - i - 1);
}
- CPPUNIT_ASSERT( bt.empty() );
+ ASSERT( bt.empty() );
// copy btree values back to a vector
@@ -156,7 +153,7 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
// afer sorting the vector, the two must be the same
std::sort(vector.begin(), vector.end());
- CPPUNIT_ASSERT( vector == vector2 );
+ ASSERT( vector == vector2 );
// test reverse iterator
vector2.clear();
@@ -167,12 +164,12 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
btree_type::reverse_iterator ri = bt2.rbegin();
for(unsigned int i = 0; i < vector2.size(); ++i, ++ri)
{
- CPPUNIT_ASSERT( vector[i].first == vector2[i].first );
- CPPUNIT_ASSERT( vector[i].first == ri->first );
- CPPUNIT_ASSERT( vector[i].second == ri->second );
+ ASSERT( vector[i].first == vector2[i].first );
+ ASSERT( vector[i].first == ri->first );
+ ASSERT( vector[i].second == ri->second );
}
- CPPUNIT_ASSERT( ri == bt2.rend() );
+ ASSERT( ri == bt2.rend() );
}
void test_iterator3()
@@ -195,13 +192,13 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
for(btree_type::iterator i = map.begin();
i != map.end(); ++i)
{
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
nownum++;
}
- CPPUNIT_ASSERT(nownum == maxnum);
+ ASSERT(nownum == maxnum);
}
{ // test iterator prefix--
@@ -212,16 +209,16 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
{
nownum--;
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
}
nownum--;
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
- CPPUNIT_ASSERT(nownum == 0);
+ ASSERT(nownum == 0);
}
{ // test const_iterator prefix++
@@ -230,13 +227,13 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
for(btree_type::const_iterator i = map.begin();
i != map.end(); ++i)
{
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
nownum++;
}
- CPPUNIT_ASSERT(nownum == maxnum);
+ ASSERT(nownum == maxnum);
}
{ // test const_iterator prefix--
@@ -247,16 +244,16 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
{
nownum--;
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
}
nownum--;
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
- CPPUNIT_ASSERT(nownum == 0);
+ ASSERT(nownum == 0);
}
{ // test reverse_iterator prefix++
@@ -267,11 +264,11 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
{
nownum--;
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
}
- CPPUNIT_ASSERT(nownum == 0);
+ ASSERT(nownum == 0);
}
{ // test reverse_iterator prefix--
@@ -280,18 +277,18 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
btree_type::reverse_iterator i;
for(i = --map.rend(); i != map.rbegin(); --i)
{
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
nownum++;
}
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
nownum++;
- CPPUNIT_ASSERT(nownum == maxnum);
+ ASSERT(nownum == maxnum);
}
{ // test const_reverse_iterator prefix++
@@ -302,11 +299,11 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
{
nownum--;
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
}
- CPPUNIT_ASSERT(nownum == 0);
+ ASSERT(nownum == 0);
}
{ // test const_reverse_iterator prefix--
@@ -315,18 +312,18 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
btree_type::const_reverse_iterator i;
for(i = --map.rend(); i != map.rbegin(); --i)
{
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
nownum++;
}
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
nownum++;
- CPPUNIT_ASSERT(nownum == maxnum);
+ ASSERT(nownum == maxnum);
}
// postfix
@@ -337,13 +334,13 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
for(btree_type::iterator i = map.begin();
i != map.end(); i++)
{
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
nownum++;
}
- CPPUNIT_ASSERT(nownum == maxnum);
+ ASSERT(nownum == maxnum);
}
{ // test iterator postfix--
@@ -354,16 +351,16 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
{
nownum--;
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
}
nownum--;
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
- CPPUNIT_ASSERT(nownum == 0);
+ ASSERT(nownum == 0);
}
{ // test const_iterator postfix++
@@ -372,13 +369,13 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
for(btree_type::const_iterator i = map.begin();
i != map.end(); i++)
{
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
nownum++;
}
- CPPUNIT_ASSERT(nownum == maxnum);
+ ASSERT(nownum == maxnum);
}
{ // test const_iterator postfix--
@@ -389,16 +386,16 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
{
nownum--;
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
}
nownum--;
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
- CPPUNIT_ASSERT(nownum == 0);
+ ASSERT(nownum == 0);
}
{ // test reverse_iterator postfix++
@@ -409,11 +406,11 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
{
nownum--;
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
}
- CPPUNIT_ASSERT(nownum == 0);
+ ASSERT(nownum == 0);
}
{ // test reverse_iterator postfix--
@@ -422,18 +419,18 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
btree_type::reverse_iterator i;
for(i = --map.rend(); i != map.rbegin(); i--)
{
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
nownum++;
}
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
nownum++;
- CPPUNIT_ASSERT(nownum == maxnum);
+ ASSERT(nownum == maxnum);
}
{ // test const_reverse_iterator postfix++
@@ -444,11 +441,11 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
{
nownum--;
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
}
- CPPUNIT_ASSERT(nownum == 0);
+ ASSERT(nownum == 0);
}
{ // test const_reverse_iterator postfix--
@@ -457,18 +454,18 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
btree_type::const_reverse_iterator i;
for(i = --map.rend(); i != map.rbegin(); i--)
{
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
nownum++;
}
- CPPUNIT_ASSERT( nownum == i->first );
- CPPUNIT_ASSERT( nownum * 3 == i->second );
+ ASSERT( nownum == i->first );
+ ASSERT( nownum * 3 == i->second );
nownum++;
- CPPUNIT_ASSERT(nownum == maxnum);
+ ASSERT(nownum == maxnum);
}
}
@@ -492,11 +489,11 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
for(btree_type::iterator i = set.begin();
i != set.end(); ++i)
{
- CPPUNIT_ASSERT( nownum == *i );
+ ASSERT( nownum == *i );
nownum++;
}
- CPPUNIT_ASSERT(nownum == maxnum);
+ ASSERT(nownum == maxnum);
}
{ // test iterator prefix--
@@ -505,12 +502,12 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
btree_type::iterator i;
for(i = --set.end(); i != set.begin(); --i)
{
- CPPUNIT_ASSERT( --nownum == *i );
+ ASSERT( --nownum == *i );
}
- CPPUNIT_ASSERT( --nownum == *i );
+ ASSERT( --nownum == *i );
- CPPUNIT_ASSERT(nownum == 0);
+ ASSERT(nownum == 0);
}
{ // test const_iterator prefix++
@@ -519,10 +516,10 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
for(btree_type::const_iterator i = set.begin();
i != set.end(); ++i)
{
- CPPUNIT_ASSERT( nownum++ == *i );
+ ASSERT( nownum++ == *i );
}
- CPPUNIT_ASSERT(nownum == maxnum);
+ ASSERT(nownum == maxnum);
}
{ // test const_iterator prefix--
@@ -531,12 +528,12 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
btree_type::const_iterator i;
for(i = --set.end(); i != set.begin(); --i)
{
- CPPUNIT_ASSERT( --nownum == *i );
+ ASSERT( --nownum == *i );
}
- CPPUNIT_ASSERT( --nownum == *i );
+ ASSERT( --nownum == *i );
- CPPUNIT_ASSERT(nownum == 0);
+ ASSERT(nownum == 0);
}
{ // test reverse_iterator prefix++
@@ -545,10 +542,10 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
for(btree_type::reverse_iterator i = set.rbegin();
i != set.rend(); ++i)
{
- CPPUNIT_ASSERT( --nownum == *i );
+ ASSERT( --nownum == *i );
}
- CPPUNIT_ASSERT(nownum == 0);
+ ASSERT(nownum == 0);
}
{ // test reverse_iterator prefix--
@@ -557,12 +554,12 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
btree_type::reverse_iterator i;
for(i = --set.rend(); i != set.rbegin(); --i)
{
- CPPUNIT_ASSERT( nownum++ == *i );
+ ASSERT( nownum++ == *i );
}
- CPPUNIT_ASSERT( nownum++ == *i );
+ ASSERT( nownum++ == *i );
- CPPUNIT_ASSERT(nownum == maxnum);
+ ASSERT(nownum == maxnum);
}
{ // test const_reverse_iterator prefix++
@@ -571,10 +568,10 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
for(btree_type::const_reverse_iterator i = set.rbegin();
i != set.rend(); ++i)
{
- CPPUNIT_ASSERT( --nownum == *i );
+ ASSERT( --nownum == *i );
}
- CPPUNIT_ASSERT(nownum == 0);
+ ASSERT(nownum == 0);
}
{ // test const_reverse_iterator prefix--
@@ -583,12 +580,12 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
btree_type::const_reverse_iterator i;
for(i = --set.rend(); i != set.rbegin(); --i)
{
- CPPUNIT_ASSERT( nownum++ == *i );
+ ASSERT( nownum++ == *i );
}
- CPPUNIT_ASSERT( nownum++ == *i );
+ ASSERT( nownum++ == *i );
- CPPUNIT_ASSERT(nownum == maxnum);
+ ASSERT(nownum == maxnum);
}
// postfix
@@ -599,10 +596,10 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
for(btree_type::iterator i = set.begin();
i != set.end(); i++)
{
- CPPUNIT_ASSERT( nownum++ == *i );
+ ASSERT( nownum++ == *i );
}
- CPPUNIT_ASSERT(nownum == maxnum);
+ ASSERT(nownum == maxnum);
}
{ // test iterator postfix--
@@ -612,12 +609,12 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
for(i = --set.end(); i != set.begin(); i--)
{
- CPPUNIT_ASSERT( --nownum == *i );
+ ASSERT( --nownum == *i );
}
- CPPUNIT_ASSERT( --nownum == *i );
+ ASSERT( --nownum == *i );
- CPPUNIT_ASSERT(nownum == 0);
+ ASSERT(nownum == 0);
}
{ // test const_iterator postfix++
@@ -626,10 +623,10 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
for(btree_type::const_iterator i = set.begin();
i != set.end(); i++)
{
- CPPUNIT_ASSERT( nownum++ == *i );
+ ASSERT( nownum++ == *i );
}
- CPPUNIT_ASSERT(nownum == maxnum);
+ ASSERT(nownum == maxnum);
}
{ // test const_iterator postfix--
@@ -638,12 +635,12 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
btree_type::const_iterator i;
for(i = --set.end(); i != set.begin(); i--)
{
- CPPUNIT_ASSERT( --nownum == *i );
+ ASSERT( --nownum == *i );
}
- CPPUNIT_ASSERT( --nownum == *i );
+ ASSERT( --nownum == *i );
- CPPUNIT_ASSERT(nownum == 0);
+ ASSERT(nownum == 0);
}
{ // test reverse_iterator postfix++
@@ -652,10 +649,10 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
for(btree_type::reverse_iterator i = set.rbegin();
i != set.rend(); i++)
{
- CPPUNIT_ASSERT( --nownum == *i );
+ ASSERT( --nownum == *i );
}
- CPPUNIT_ASSERT(nownum == 0);
+ ASSERT(nownum == 0);
}
{ // test reverse_iterator postfix--
@@ -664,12 +661,12 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
btree_type::reverse_iterator i;
for(i = --set.rend(); i != set.rbegin(); i--)
{
- CPPUNIT_ASSERT( nownum++ == *i );
+ ASSERT( nownum++ == *i );
}
- CPPUNIT_ASSERT( nownum++ == *i );
+ ASSERT( nownum++ == *i );
- CPPUNIT_ASSERT(nownum == maxnum);
+ ASSERT(nownum == maxnum);
}
{ // test const_reverse_iterator postfix++
@@ -678,10 +675,10 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
for(btree_type::const_reverse_iterator i = set.rbegin();
i != set.rend(); i++)
{
- CPPUNIT_ASSERT( --nownum == *i );
+ ASSERT( --nownum == *i );
}
- CPPUNIT_ASSERT(nownum == 0);
+ ASSERT(nownum == 0);
}
{ // test const_reverse_iterator postfix--
@@ -690,12 +687,12 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
btree_type::const_reverse_iterator i;
for(i = --set.rend(); i != set.rbegin(); i--)
{
- CPPUNIT_ASSERT( nownum++ == *i );
+ ASSERT( nownum++ == *i );
}
- CPPUNIT_ASSERT( nownum++ == *i );
+ ASSERT( nownum++ == *i );
- CPPUNIT_ASSERT(nownum == maxnum);
+ ASSERT(nownum == maxnum);
}
}
@@ -718,79 +715,79 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
it = set.begin();
it--;
- CPPUNIT_ASSERT( it == set.begin() );
+ ASSERT( it == set.begin() );
it = set.begin();
--it;
- CPPUNIT_ASSERT( it == set.begin() );
+ ASSERT( it == set.begin() );
it = set.end();
it++;
- CPPUNIT_ASSERT( it == set.end() );
+ ASSERT( it == set.end() );
it = set.end();
++it;
- CPPUNIT_ASSERT( it == set.end() );
+ ASSERT( it == set.end() );
}
{
btree_type::const_iterator it;
it = set.begin();
it--;
- CPPUNIT_ASSERT( it == set.begin() );
+ ASSERT( it == set.begin() );
it = set.begin();
--it;
- CPPUNIT_ASSERT( it == set.begin() );
+ ASSERT( it == set.begin() );
it = set.end();
it++;
- CPPUNIT_ASSERT( it == set.end() );
+ ASSERT( it == set.end() );
it = set.end();
++it;
- CPPUNIT_ASSERT( it == set.end() );
+ ASSERT( it == set.end() );
}
{
btree_type::reverse_iterator it;
it = set.rbegin();
it--;
- CPPUNIT_ASSERT( it == set.rbegin() );
+ ASSERT( it == set.rbegin() );
it = set.rbegin();
--it;
- CPPUNIT_ASSERT( it == set.rbegin() );
+ ASSERT( it == set.rbegin() );
it = set.rend();
it++;
- CPPUNIT_ASSERT( it == set.rend() );
+ ASSERT( it == set.rend() );
it = set.rend();
++it;
- CPPUNIT_ASSERT( it == set.rend() );
+ ASSERT( it == set.rend() );
}
{
btree_type::const_reverse_iterator it;
it = set.rbegin();
it--;
- CPPUNIT_ASSERT( it == set.rbegin() );
+ ASSERT( it == set.rbegin() );
it = set.rbegin();
--it;
- CPPUNIT_ASSERT( it == set.rbegin() );
+ ASSERT( it == set.rbegin() );
it = set.rend();
it++;
- CPPUNIT_ASSERT( it == set.rend() );
+ ASSERT( it == set.rend() );
it = set.rend();
++it;
- CPPUNIT_ASSERT( it == set.rend() );
+ ASSERT( it == set.rend() );
}
}
@@ -812,7 +809,7 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
}
}
- CPPUNIT_ASSERT( map.size() == size1 * size2 );
+ ASSERT( map.size() == size1 * size2 );
// erase in reverse order. that should be the worst case for
// erase_iter()
@@ -827,17 +824,16 @@ class IteratorTest : public CPPUNIT_NS::TestFixture
while (it != map.end() && it.key() == i && it.data() != j)
++it;
- CPPUNIT_ASSERT( it.key() == i );
- CPPUNIT_ASSERT( it.data() == j );
+ ASSERT( it.key() == i );
+ ASSERT( it.data() == j );
unsigned int mapsize = map.size();
map.erase(it);
- CPPUNIT_ASSERT( map.size() == mapsize - 1 );
+ ASSERT( map.size() == mapsize - 1 );
}
}
- CPPUNIT_ASSERT( map.size() == 0 );
+ ASSERT( map.size() == 0 );
}
-};
-CPPUNIT_TEST_SUITE_REGISTRATION( IteratorTest );
+} __IteratorTest;
View
98 testsuite/LargeTest.cc
@@ -1,8 +1,6 @@
-// $Id$
-
/*
* STX B+ Tree Template Classes v0.8.6
- * Copyright (C) 2008-2011 Timo Bingmann
+ * Copyright (C) 2008-2013 Timo Bingmann <tb@panthema.net>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
@@ -19,28 +17,27 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <cppunit/extensions/HelperMacros.h>
+#include "tpunit.h"
#include <stdlib.h>
#include <time.h>
#include <stx/btree_multiset.h>
#include <set>
-class LargeTest : public CPPUNIT_NS::TestFixture
+struct LargeTest : public tpunit::TestFixture
{
- CPPUNIT_TEST_SUITE( LargeTest );
- CPPUNIT_TEST(test_320_mod_1000);
- CPPUNIT_TEST(test_320_mod_10000);
- CPPUNIT_TEST(test_3200_mod_10);
- CPPUNIT_TEST(test_3200_mod_100);
- CPPUNIT_TEST(test_3200_mod_1000);
- CPPUNIT_TEST(test_3200_mod_10000);
- CPPUNIT_TEST(test_32000_mod_10000);
- CPPUNIT_TEST(test_sequence);
- CPPUNIT_TEST_SUITE_END();
-
-protected:
+ LargeTest() : tpunit::TestFixture(
+ TEST(LargeTest::test_320_mod_1000),
+ TEST(LargeTest::test_320_mod_10000),
+ TEST(LargeTest::test_3200_mod_10),
+ TEST(LargeTest::test_3200_mod_100),
+ TEST(LargeTest::test_3200_mod_1000),
+ TEST(LargeTest::test_3200_mod_10000),
+ TEST(LargeTest::test_32000_mod_10000),
+ TEST(LargeTest::test_sequence)
+ )
+ {}
struct traits_nodebug
{
@@ -67,33 +64,33 @@ class LargeTest : public CPPUNIT_NS::TestFixture
{
unsigned int k = rand() % modulo;
- CPPUNIT_ASSERT( bt.size() == set.size() );
+ ASSERT( bt.size() == set.size() );
bt.insert(k);
set.insert(k);
- CPPUNIT_ASSERT( bt.count(k) == set.count(k) );
+ ASSERT( bt.count(k) == set.count(k) );
- CPPUNIT_ASSERT( bt.size() == set.size() );
+ ASSERT( bt.size() == set.size() );
}
- CPPUNIT_ASSERT( bt.size() == insnum );
+ ASSERT( bt.size() == insnum );
// *** iterate
btree_type::iterator bi = bt.begin();
multiset_type::const_iterator si = set.begin();
for(; bi != bt.end() && si != set.end(); ++bi, ++si)
{
- CPPUNIT_ASSERT( *si == bi.key() );
+ ASSERT( *si == bi.key() );
}
- CPPUNIT_ASSERT( bi == bt.end() );
- CPPUNIT_ASSERT( si == set.end() );
+ ASSERT( bi == bt.end() );
+ ASSERT( si == set.end() );
// *** existance
srand(34234235);
for(unsigned int i = 0; i < insnum; i++)
{
unsigned int k = rand() % modulo;
- CPPUNIT_ASSERT( bt.exists(k) );
+ ASSERT( bt.exists(k) );
}
// *** counting
@@ -102,7 +99,7 @@ class LargeTest : public CPPUNIT_NS::TestFixture
{
unsigned int k = rand() % modulo;
- CPPUNIT_ASSERT( bt.count(k) == set.count(k) );
+ ASSERT( bt.count(k) == set.count(k) );
}
// *** deletion
@@ -113,19 +110,19 @@ class LargeTest : public CPPUNIT_NS::TestFixture
if (set.find(k) != set.end())
{
- CPPUNIT_ASSERT( bt.size() == set.size() );
+ ASSERT( bt.size() == set.size() );
- CPPUNIT_ASSERT( bt.exists(k) );
- CPPUNIT_ASSERT( bt.erase_one(k) );
+ ASSERT( bt.exists(k) );
+ ASSERT( bt.erase_one(k) );
set.erase( set.find(k) );
- CPPUNIT_ASSERT( bt.size() == set.size() );
- CPPUNIT_ASSERT( std::equal(bt.begin(), bt.end(), set.begin()) );
+ ASSERT( bt.size() == set.size() );
+ ASSERT( std::equal(bt.begin(), bt.end(), set.begin()) );
}
}
- CPPUNIT_ASSERT( bt.empty() );
- CPPUNIT_ASSERT( set.empty() );
+ ASSERT( bt.empty() );
+ ASSERT( set.empty() );
}
void test_320_mod_1000()
@@ -181,33 +178,33 @@ class LargeTest : public CPPUNIT_NS::TestFixture
{
unsigned int k = i;
- CPPUNIT_ASSERT( bt.size() == set.size() );
+ ASSERT( bt.size() == set.size() );
bt.insert(k);
set.insert(k);
- CPPUNIT_ASSERT( bt.count(k) == set.count(k) );
+ ASSERT( bt.count(k) == set.count(k) );
- CPPUNIT_ASSERT( bt.size() == set.size() );
+ ASSERT( bt.size() == set.size() );
}
- CPPUNIT_ASSERT( bt.size() == insnum );
+ ASSERT( bt.size() == insnum );
// *** iterate
btree_type::iterator bi = bt.begin();
multiset_type::const_iterator si = set.begin();
for(; bi != bt.end() && si != set.end(); ++bi, ++si)
{
- CPPUNIT_ASSERT( *si == bi.key() );
+ ASSERT( *si == bi.key() );
}
- CPPUNIT_ASSERT( bi == bt.end() );
- CPPUNIT_ASSERT( si == set.end() );
+ ASSERT( bi == bt.end() );
+ ASSERT( si == set.end() );
// *** existance
srand(34234235);
for(unsigned int i = 0; i < insnum; i++)
{
unsigned int k = i;
- CPPUNIT_ASSERT( bt.exists(k) );
+ ASSERT( bt.exists(k) );
}
// *** counting
@@ -216,7 +213,7 @@ class LargeTest : public CPPUNIT_NS::TestFixture
{
unsigned int k = i;
- CPPUNIT_ASSERT( bt.count(k) == set.count(k) );
+ ASSERT( bt.count(k) == set.count(k) );
}
// *** deletion
@@ -227,21 +224,20 @@ class LargeTest : public CPPUNIT_NS::TestFixture
if (set.find(k) != set.end())
{
- CPPUNIT_ASSERT( bt.size() == set.size() );
+ ASSERT( bt.size() == set.size() );
- CPPUNIT_ASSERT( bt.exists(k) );
- CPPUNIT_ASSERT( bt.erase_one(k) );
+ ASSERT( bt.exists(k) );
+ ASSERT( bt.erase_one(k) );
set.erase( set.find(k) );
- CPPUNIT_ASSERT( bt.size() == set.size() );
- CPPUNIT_ASSERT( std::equal(bt.begin(), bt.end(), set.begin()) );
+ ASSERT( bt.size() == set.size() );
+ ASSERT( std::equal(bt.begin(), bt.end(), set.begin()) );
}
}
- CPPUNIT_ASSERT( bt.empty() );
- CPPUNIT_ASSERT( set.empty() );
+ ASSERT( bt.empty() );
+ ASSERT( set.empty() );
}
-};
+} __LargeTest;
-CPPUNIT_TEST_SUITE_REGISTRATION( LargeTest );
View
14 testsuite/Makefile.am
@@ -1,21 +1,11 @@
# B+ Tree Test Cases
-# $Id$
noinst_PROGRAMS = testsuite
TESTS = testsuite
-if HAVE_CPPUNIT
-
-testsuite_SOURCES = TestRunner.cc
+testsuite_SOURCES = tpunit.cc tpunit.h
testsuite_SOURCES += InstantiationTest.cc SimpleTest.cc LargeTest.cc BoundTest.cc IteratorTest.cc StructureTest.cc DumpRestoreTest.cc RelationTest.cc
-else
-
-testsuite_SOURCES = TestTrue.cc
-
-endif
-
-AM_CXXFLAGS = -W -Wall -Wold-style-cast -Wshadow -DBTREE_DEBUG -I$(top_srcdir)/include @CPPUNIT_CFLAGS@
-LDADD = @CPPUNIT_LIBS@
+AM_CXXFLAGS = -W -Wall -Wold-style-cast -Wshadow -DBTREE_DEBUG -I$(top_srcdir)/include
View
42 testsuite/Makefile.in
@@ -16,7 +16,6 @@
@SET_MAKE@
# B+ Tree Test Cases
-# $Id$
VPATH = @srcdir@
am__make_dryrun = \
@@ -66,21 +65,12 @@ mkinstalldirs = $(install_sh) -d
CONFIG_CLEAN_FILES =
CONFIG_CLEAN_VPATH_FILES =
PROGRAMS = $(noinst_PROGRAMS)
-am__testsuite_SOURCES_DIST = TestTrue.cc TestRunner.cc \
- InstantiationTest.cc SimpleTest.cc LargeTest.cc BoundTest.cc \
- IteratorTest.cc StructureTest.cc DumpRestoreTest.cc \
- RelationTest.cc
-@HAVE_CPPUNIT_FALSE@am_testsuite_OBJECTS = TestTrue.$(OBJEXT)
-@HAVE_CPPUNIT_TRUE@am_testsuite_OBJECTS = TestRunner.$(OBJEXT) \
-@HAVE_CPPUNIT_TRUE@ InstantiationTest.$(OBJEXT) \
-@HAVE_CPPUNIT_TRUE@ SimpleTest.$(OBJEXT) LargeTest.$(OBJEXT) \
-@HAVE_CPPUNIT_TRUE@ BoundTest.$(OBJEXT) IteratorTest.$(OBJEXT) \
-@HAVE_CPPUNIT_TRUE@ StructureTest.$(OBJEXT) \
-@HAVE_CPPUNIT_TRUE@ DumpRestoreTest.$(OBJEXT) \
-@HAVE_CPPUNIT_TRUE@ RelationTest.$(OBJEXT)
+am_testsuite_OBJECTS = tpunit.$(OBJEXT) InstantiationTest.$(OBJEXT) \
+ SimpleTest.$(OBJEXT) LargeTest.$(OBJEXT) BoundTest.$(OBJEXT) \
+ IteratorTest.$(OBJEXT) StructureTest.$(OBJEXT) \
+ DumpRestoreTest.$(OBJEXT) RelationTest.$(OBJEXT)
testsuite_OBJECTS = $(am_testsuite_OBJECTS)
testsuite_LDADD = $(LDADD)
-testsuite_DEPENDENCIES =
DEFAULT_INCLUDES = -I.@am__isrc@
depcomp = $(SHELL) $(top_srcdir)/scripts/depcomp
am__depfiles_maybe = depfiles
@@ -90,8 +80,12 @@ CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
CXXLD = $(CXX)
CXXLINK = $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) $(LDFLAGS) \
-o $@
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(testsuite_SOURCES)
-DIST_SOURCES = $(am__testsuite_SOURCES_DIST)
+DIST_SOURCES = $(testsuite_SOURCES)
am__can_run_installinfo = \
case $$AM_UPDATE_INFO_DIR in \
n|no|NO) false;; \
@@ -112,9 +106,6 @@ CC = @CC@
CCDEPMODE = @CCDEPMODE@
CFLAGS = @CFLAGS@
CPPFLAGS = @CPPFLAGS@
-CPPUNIT_CFLAGS = @CPPUNIT_CFLAGS@
-CPPUNIT_CONFIG = @CPPUNIT_CONFIG@
-CPPUNIT_LIBS = @CPPUNIT_LIBS@
CXX = @CXX@
CXXCPP = @CXXCPP@
CXXDEPMODE = @CXXDEPMODE@
@@ -218,14 +209,10 @@ target_alias = @target_alias@
top_build_prefix = @top_build_prefix@
top_builddir = @top_builddir@
top_srcdir = @top_srcdir@
-@HAVE_CPPUNIT_FALSE@testsuite_SOURCES = TestTrue.cc
-@HAVE_CPPUNIT_TRUE@testsuite_SOURCES = TestRunner.cc \
-@HAVE_CPPUNIT_TRUE@ InstantiationTest.cc SimpleTest.cc \
-@HAVE_CPPUNIT_TRUE@ LargeTest.cc BoundTest.cc IteratorTest.cc \
-@HAVE_CPPUNIT_TRUE@ StructureTest.cc DumpRestoreTest.cc \
-@HAVE_CPPUNIT_TRUE@ RelationTest.cc
-AM_CXXFLAGS = -W -Wall -Wold-style-cast -Wshadow -DBTREE_DEBUG -I$(top_srcdir)/include @CPPUNIT_CFLAGS@
-LDADD = @CPPUNIT_LIBS@
+testsuite_SOURCES = tpunit.cc tpunit.h InstantiationTest.cc \
+ SimpleTest.cc LargeTest.cc BoundTest.cc IteratorTest.cc \
+ StructureTest.cc DumpRestoreTest.cc RelationTest.cc
+AM_CXXFLAGS = -W -Wall -Wold-style-cast -Wshadow -DBTREE_DEBUG -I$(top_srcdir)/include
all: all-am
.SUFFIXES:
@@ -281,8 +268,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/RelationTest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/SimpleTest.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/StructureTest.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestRunner.Po@am__quote@
-@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/TestTrue.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/tpunit.Po@am__quote@
.cc.o:
@am__fastdepCXX_TRUE@ $(CXXCOMPILE) -MT $@ -MD -MP -MF $(DEPDIR)/$*.Tpo -c -o $@ $<
View
38 testsuite/RelationTest.cc
@@ -1,8 +1,6 @@
-// $Id$
-
/*
* STX B+ Tree Template Classes v0.8.6
- * Copyright (C) 2008-2011 Timo Bingmann
+ * Copyright (C) 2008-2013 Timo Bingmann <tb@panthema.net>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
@@ -19,19 +17,18 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <cppunit/extensions/HelperMacros.h>
+#include "tpunit.h"
#include <stdlib.h>
#include <stx/btree_multiset.h>
-class RelationTest : public CPPUNIT_NS::TestFixture
+struct RelationTest : public tpunit::TestFixture
{
- CPPUNIT_TEST_SUITE( RelationTest );
- CPPUNIT_TEST(test_relations);
- CPPUNIT_TEST_SUITE_END();
-
-protected:
+ RelationTest() : tpunit::TestFixture(
+ TEST(RelationTest::test_relations)
+ )
+ {}
struct traits_nodebug
{
@@ -58,33 +55,32 @@ class RelationTest : public CPPUNIT_NS::TestFixture
bt2.insert(key);
}
- CPPUNIT_ASSERT( bt1 == bt2 );
+ ASSERT( bt1 == bt2 );
bt1.insert(499);
bt2.insert(500);
- CPPUNIT_ASSERT( bt1 != bt2 );
- CPPUNIT_ASSERT( bt1 < bt2 );
- CPPUNIT_ASSERT( !(bt1 > bt2) );
+ ASSERT( bt1 != bt2 );
+ ASSERT( bt1 < bt2 );
+ ASSERT( !(bt1 > bt2) );
bt1.insert(500);
bt2.insert(499);
- CPPUNIT_ASSERT( bt1 == bt2 );
- CPPUNIT_ASSERT( bt1 <= bt2 );
+ ASSERT( bt1 == bt2 );
+ ASSERT( bt1 <= bt2 );
// test assignment operator
btree_type bt3;
bt3 = bt1;
- CPPUNIT_ASSERT( bt1 == bt3 );
- CPPUNIT_ASSERT( bt1 >= bt3 );
+ ASSERT( bt1 == bt3 );
+ ASSERT( bt1 >= bt3 );
// test copy constructor
btree_type bt4 = bt3;
- CPPUNIT_ASSERT( bt1 == bt4 );
+ ASSERT( bt1 == bt4 );
}
-};
-CPPUNIT_TEST_SUITE_REGISTRATION( RelationTest );
+} __RelationTest;
View
92 testsuite/SimpleTest.cc
@@ -1,8 +1,6 @@
-// $Id$
-
/*
* STX B+ Tree Template Classes v0.8.6
- * Copyright (C) 2008-2011 Timo Bingmann
+ * Copyright (C) 2008-2013 Timo Bingmann <tb@panthema.net>
*
* This library is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by the
@@ -19,27 +17,26 @@
* Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <cppunit/extensions/HelperMacros.h>
+#include "tpunit.h"
#include <stdlib.h>
#include <stx/btree_multiset.h>
#include <stx/btree_multimap.h>
#include <stx/btree_map.h>
-class SimpleTest : public CPPUNIT_NS::TestFixture
+struct SimpleTest : public tpunit::TestFixture
{
- CPPUNIT_TEST_SUITE( SimpleTest );
- CPPUNIT_TEST(test_empty);
- CPPUNIT_TEST(test_set_insert_erase_320);
- CPPUNIT_TEST(test_set_insert_erase_320_descending);
- CPPUNIT_TEST(test_map_insert_erase_320);
- CPPUNIT_TEST(test_map_insert_erase_320_descending);
- CPPUNIT_TEST(test2_map_insert_erase_strings);
- CPPUNIT_TEST(test_set_100000_uint64);
- CPPUNIT_TEST_SUITE_END();
-
-protected:
+ SimpleTest() : tpunit::TestFixture(
+ TEST(SimpleTest::test_empty),
+ TEST(SimpleTest::test_set_insert_erase_320),
+ TEST(SimpleTest::test_set_insert_erase_320_descending),
+ TEST(SimpleTest::test_map_insert_erase_320),
+ TEST(SimpleTest::test_map_insert_erase_320_descending),
+ TEST(SimpleTest::test2_map_insert_erase_strings),
+ TEST(SimpleTest::test_set_100000_uint64)
+ )
+ {}
struct traits_nodebug
{
@@ -58,9 +55,9 @@ class SimpleTest : public CPPUNIT_NS::TestFixture
btree_type bt, bt2;
bt.verify();
- CPPUNIT_ASSERT( bt.erase(42) == false );
+ ASSERT( bt.erase(42) == false );
- CPPUNIT_ASSERT( bt == bt2 );
+ ASSERT( bt == bt2 );
}
void test_set_insert_erase_320()
@@ -74,20 +71,20 @@ class SimpleTest : public CPPUNIT_NS::TestFixture
srand(34234235);
for(unsigned int i = 0; i < 320; i++)
{
- CPPUNIT_ASSERT(bt.size() == i);
+ ASSERT(bt.size() == i);
bt.insert(rand() % 100);
- CPPUNIT_ASSERT(bt.size() == i + 1);
+ ASSERT(bt.size() == i + 1);
}
srand(34234235);
for(unsigned int i = 0; i < 320; i++)
{
- CPPUNIT_ASSERT(bt.size() == 320 - i);
- CPPUNIT_ASSERT( bt.erase_one(rand() % 100) );
- CPPUNIT_ASSERT(bt.size() == 320 - i - 1);
+ ASSERT(bt.size() == 320 - i);