Code

Simplify "make check" makefile rules and remove most of the obsolete
authortweenk <tweenk@users.sourceforge.net>
Tue, 9 Dec 2008 00:06:13 +0000 (00:06 +0000)
committertweenk <tweenk@users.sourceforge.net>
Tue, 9 Dec 2008 00:06:13 +0000 (00:06 +0000)
utest-based tests.

23 files changed:
src/Makefile.am
src/Makefile_insert
src/cxxtest-template.tpl [new file with mode: 0644]
src/display/Makefile_insert
src/helper/Makefile_insert
src/helper/units-test.cpp [deleted file]
src/libnr/Makefile_insert
src/libnr/in-svg-plane-test.cpp [deleted file]
src/libnr/nr-matrix-test.cpp [deleted file]
src/libnr/nr-point-fns-test.cpp [deleted file]
src/libnr/nr-rotate-fns-test.cpp [deleted file]
src/libnr/nr-rotate-test.cpp [deleted file]
src/libnr/nr-scale-test.cpp [deleted file]
src/libnr/nr-translate-test.cpp [deleted file]
src/libnr/nr-types-test.cpp [deleted file]
src/selfname.tpl [deleted file]
src/svg/Makefile_insert
src/svg/svg-path.cpp
src/util/Makefile_insert
src/util/list-container-test.cpp [deleted file]
src/xml/Makefile_insert
src/xml/quote-test.cpp [deleted file]
src/xml/repr-action-test.cpp [deleted file]

index 49fad32268df03944a819150f64fe542a20b1423..7272c78883f0223511f4e9caf9c104e7bf3a6ffa 100644 (file)
@@ -30,6 +30,10 @@ INCLUDES =   \
        -I$(top_srcdir)/cxxtest \
        $(WIN32_CFLAGS)
 
+CXXTEST_TEMPLATE = $(srcdir)/cxxtest-template.tpl
+CXXTESTGENFLAGS = --root --have-eh --template=$(CXXTEST_TEMPLATE)
+CXXTESTGEN = $(top_srcdir)/cxxtest/cxxtestgen.pl $(CXXTESTGENFLAGS)
+
 # Include all partial makefiles from subdirectories
 include Makefile_insert
 include application/Makefile_insert
@@ -199,73 +203,26 @@ EXTRA_PROGRAMS =  \
 ### TESTING STUFF (make check) ###
 ##################################
 
-# List of all tests to be run. Should contain one per directory.
-# Automake 1.10 appends EXEEXT automatically, so this should be changed
-# when we move to Automake 1.10.
-TESTS =        \
-       test-src$(EXEEXT)       \
-       style-test$(EXEEXT)     \
-       display/bezier-utils-test$(EXEEXT)      \
-       display/test-display$(EXEEXT)   \
-       helper/units-test$(EXEEXT)      \
-       helper/test-helper$(EXEEXT)     \
-       libnr/in-svg-plane-test$(EXEEXT)        \
-       libnr/nr-matrix-test$(EXEEXT)   \
-       libnr/nr-point-fns-test$(EXEEXT)        \
-       libnr/nr-rotate-test$(EXEEXT)   \
-       libnr/nr-rotate-fns-test$(EXEEXT)       \
-       libnr/nr-scale-test$(EXEEXT)    \
-       libnr/nr-translate-test$(EXEEXT)        \
-       libnr/nr-types-test$(EXEEXT)    \
-       libnr/test-nr$(EXEEXT)  \
-       svg/test-svg$(EXEEXT)   \
-       util/list-container-test$(EXEEXT)       \
-       util/test-util$(EXEEXT) \
-       xml/test-xml$(EXEEXT)   \
-       xml/quote-test$(EXEEXT) \
-       xml/repr-action-test$(EXEEXT)
-
-# streamtest is unfinished and can't handle the relocations done during
-# "make distcheck".  Not needed for the 0.41 release.
-#      io/streamtest$(EXEEXT)
+# List of all programs that should be built before testing. Note that this is
+# different from TESTS, because some tests can be scripts that don't
+# need to be built. There should be one test program per directory.
 # automake adds $(EXEEXT) to check_PROGRAMS items but not to TESTS items:
 # TESTS items can be scripts etc.
-
-# List of all programs that should be built before testing. Note that this is
-# not necessarily equal to TESTS, because some tests can be scripts that don't
-# need to be built.
 check_PROGRAMS =       \
        test-src        \
        style-test      \
-       display/bezier-utils-test       \
        display/test-display    \
-       helper/units-test       \
        helper/test-helper      \
-       libnr/in-svg-plane-test \
-       libnr/nr-matrix-test    \
-       libnr/nr-point-fns-test \
-       libnr/nr-rotate-test    \
-       libnr/nr-rotate-fns-test        \
-       libnr/nr-scale-test     \
-       libnr/nr-translate-test \
-       libnr/nr-types-test     \
        libnr/test-nr   \
        svg/test-svg    \
-       util/list-container-test        \
        util/test-util  \
-       xml/test-xml    \
-       xml/quote-test  \
-       xml/repr-action-test
+       xml/test-xml
 #      io/streamtest
+# streamtest is unfinished and can't handle the relocations done during
+# "make distcheck".
 
-# Additional libraries needed by the tests - to be removed later.
-check_LIBRARIES =      \
-       display/libtest-display.a       \
-       helper/libtest-helper.a \
-       libnr/libtest-nr.a      \
-       svg/libtest-svg.a       \
-       util/libtest-util.a     \
-       xml/libtest-xml.a
+# List of all tests to be run.
+TESTS = $(check_PROGRAMS)
 
 # ################################################
 #
index ac410086266115aa58f7f676216973de4b047f17..3fc319c9255c879144562352887d35f04f21da6c 100644 (file)
@@ -393,39 +393,40 @@ inkscape_LDFLAGS = --export-dynamic $(kdeldflags)
 inkview_SOURCES = inkview.cpp $(win32_sources)
 inkview_LDADD = $(all_libs)
 
+# old utest-based test - convert to cxxtest and remove
 style_test_SOURCES = style-test.cpp
 style_test_LDADD = $(all_libs)
 
 inkscape_version.h: ../configure.ac
        echo '#define INKSCAPE_VERSION "$(VERSION)"' > inkscape_version.h
 
-test_src_includes =                            \
-               $(srcdir)/MultiPrinter.h        \
-               $(srcdir)/TRPIFormatter.h       \
-               $(srcdir)/PylogFormatter.h      \
-               $(srcdir)/attributes-test.h     \
-               $(srcdir)/color-profile-test.h  \
-               $(srcdir)/dir-util-test.h       \
-               $(srcdir)/extract-uri-test.h    \
-               $(srcdir)/mod360-test.h         \
-               $(srcdir)/round-test.h          \
-               $(srcdir)/preferences-test.h    \
-               $(srcdir)/sp-gradient-test.h    \
-               $(srcdir)/sp-style-elem-test.h  \
-               $(srcdir)/style-test.h          \
-               $(srcdir)/test-helpers.h        \
-               $(srcdir)/verbs-test.h
-
-test-src.cpp: \
-               $(test_src_includes)
-               $(top_srcdir)/cxxtest/cxxtestgen.pl --have-eh --template=$(srcdir)/selfname.tpl -root -o test-src.cpp   \
-               $(test_src_includes)
+# ######################
+# ### CxxTest stuff ####
+# ######################
+inkscape_testsuites =                  \
+       $(srcdir)/MultiPrinter.h        \
+       $(srcdir)/TRPIFormatter.h       \
+       $(srcdir)/PylogFormatter.h      \
+       $(srcdir)/attributes-test.h     \
+       $(srcdir)/color-profile-test.h  \
+       $(srcdir)/dir-util-test.h       \
+       $(srcdir)/extract-uri-test.h    \
+       $(srcdir)/mod360-test.h         \
+       $(srcdir)/round-test.h          \
+       $(srcdir)/preferences-test.h    \
+       $(srcdir)/sp-gradient-test.h    \
+       $(srcdir)/sp-style-elem-test.h  \
+       $(srcdir)/style-test.h          \
+       $(srcdir)/test-helpers.h        \
+       $(srcdir)/verbs-test.h
 
 test_src_SOURCES =             \
        test-src.cpp            \
-       $(test_src_includes)
-
+       $(inkscape_testsuites)
 
 test_src_LDADD =       \
        $(all_libs)     \
        io/libio.a
+
+test-src.cpp: $(inkscape_testsuites) Makefile_insert $(CXXTEST_TEMPLATE)
+       $(CXXTESTGEN) -o test-src.cpp $(inkscape_testsuites)
diff --git a/src/cxxtest-template.tpl b/src/cxxtest-template.tpl
new file mode 100644 (file)
index 0000000..df20beb
--- /dev/null
@@ -0,0 +1,13 @@
+// -*- C++ -*-
+//
+
+#include "MultiPrinter.h"
+
+int main( int argc, char *argv[] )
+{
+    (void)argc;
+    return CxxTest::MultiPrinter( argv[0] ).run();
+}
+
+// The CxxTest "world"
+<CxxTest world>
index 5994e19bd5e136ec8a75ef99e7bf56d33fbae96a..e6877ccfb61dc20fa9b2de946ce7fc20da45b1bb 100644 (file)
@@ -128,24 +128,13 @@ display_libspdisplay_a_SOURCES = \
        display/nr-light.cpp                    \
        display/nr-light-types.h
 
-display_bezier_utils_test_SOURCES = display/bezier-utils-test.cpp
-display_bezier_utils_test_LDADD = libnr/libnr.a -lglib-2.0 2geom/lib2geom.a
-
-# Copy/paste from libnr
-display/test-display-main.cpp: display/test-display.cpp
-       $(top_srcdir)/cxxtest/cxxtestgen.pl --template=$(srcdir)/selfname.tpl -root -o display/test-display-main.cpp $(display_test_display_includes)
-
-display/test-display.cpp: $(display_test_display_includes)
-       $(top_srcdir)/cxxtest/cxxtestgen.pl --have-eh -part -o display/test-display.cpp $(display_test_display_includes)
-
-display_test_display_includes = \
+# ######################
+# ### CxxTest stuff ####
+# ######################
+ddislay_testsuites = \
        $(srcdir)/display/bezier-utils-test.h \
        $(srcdir)/display/curve-test.h
 
-display_libtest_display_a_SOURCES = \
-       display/test-display.cpp \
-       $(display_test_display_includes)
-
 display_test_display_SOURCES = \
        display/test-display-main.cpp \
        $(display_test_display_includes)
@@ -156,3 +145,5 @@ display_test_display_LDADD = \
        $(inkscape_private_libs) \
        $(INKSCAPE_LIBS)
 
+display/test-display.cpp: $(dislay_testsuites) display/Makefile_insert $(CXXTEST_TEMPLATE)
+       $(CXXTESTGEN) -o display/test-display.cpp $(dislay_testsuites)
index bf8128110b98bf088f6ea10eaa336b5e6f34c3c5..73cc3d5eeb4dca8e5620c640f84e78e055bbcf1d 100644 (file)
@@ -40,7 +40,7 @@ helper_libspchelp_a_SOURCES = \
        helper/stock-items.cpp  \
        helper/stock-items.h    
 
-# cmp exits with status 0 when there are no differences. if executes the commands
+# cmp exits with status 0 when there are no differences. "if" executes the commands
 # after "then" when the exit status of the if command is 0 (this is crazy).
 helper/sp-marshal.h: helper/sp-marshal.list
        glib-genmarshal --prefix=sp_marshal --header $(srcdir)/helper/sp-marshal.list > helper/tmp.sp-marshal.h
@@ -58,29 +58,19 @@ helper/sp-marshal.cpp: helper/sp-marshal.list helper/sp-marshal.h
 
 helper/sp-marshal.cpp helper/sp-marshal.h: helper/sp-marshal.list
 
-helper_units_test_SOURCES = helper/units-test.cpp
-helper_units_test_LDADD = helper/libspchelp.a -lglib-2.0
-
-# Copy/paste from libnr
-helper/test-helper-main.cpp: helper/test-helper.cpp
-       $(top_srcdir)/cxxtest/cxxtestgen.pl --template=$(srcdir)/selfname.tpl -root -o helper/test-helper-main.cpp $(helper_test_helper_includes)
-
-helper/test-helper.cpp: $(helper_test_helper_includes)
-       $(top_srcdir)/cxxtest/cxxtestgen.pl --have-eh -part -o helper/test-helper.cpp $(helper_test_helper_includes)
-
-helper_test_helper_includes = \
+# ######################
+# ### CxxTest stuff ####
+# ######################
+helper_testsuites = \
        $(srcdir)/helper/units-test.h
 
-helper_libtest_helper_a_SOURCES = \
-       helper/test-helper.cpp \
-       $(helper_test_helper_includes)
-
 helper_test_helper_SOURCES = \
-       helper/test-helper-main.cpp \
-       $(helper_test_helper_includes)
+       helper/test-helper.cpp \
+       $(helper_testsuites)
 
-helper_test_helper_LDADD = \
-       helper/libspchelp.a \
-       helper/libtest-helper.a \
+helper_test_helper_LDADD =     \
+       helper/libspchelp.a     \
        -lglib-2.0
 
+helper/test-helper.cpp: $(helper_testsuites) helper/Makefile_insert $(CXXTEST_TEMPLATE)
+       $(CXXTESTGEN) -o xml/test-xml.cpp $(helper_testsuites)
diff --git a/src/helper/units-test.cpp b/src/helper/units-test.cpp
deleted file mode 100644 (file)
index a400ca0..0000000
+++ /dev/null
@@ -1,115 +0,0 @@
-#ifdef HAVE_CONFIG_H
-# include <config.h>
-#endif
-#include <math.h>
-
-#include <glibmm/i18n.h>
-#include <helper/units.h>
-#include <utest/utest.h>
-
-
-/* N.B. Wrongly returns false if both near 0.  (Not a problem for current users.) */
-static bool
-approx_equal(double const x, double const y)
-{
-    return fabs(x / y - 1) < 1e-15;
-}
-
-static double
-sp_units_get_points(double const x, SPUnit const &unit)
-{
-    SPUnit const &pt_unit = sp_unit_get_by_id(SP_UNIT_PT);
-    double const px = sp_units_get_pixels(x, unit);
-    return sp_pixels_get_units(px, pt_unit);
-}
-
-static double
-sp_points_get_units(double const pts, SPUnit const &unit)
-{
-    SPUnit const &pt_unit = sp_unit_get_by_id(SP_UNIT_PT);
-    double const px = sp_units_get_pixels(pts, pt_unit);
-    return sp_pixels_get_units(px, unit);
-}
-
-static bool
-test_conversions()
-{
-    utest_start("sp_units_get_pixels, sp_pixels_get_units");
-
-    struct Case { double x; char const *abbr; double pts; } const tests[] = {
-        { 1.0, "pt", 1.0 },
-        { 5.0, "pt", 5.0 },
-        { 1.0, "in", 72.0 },
-        { 2.0, "in", 144.0 },
-        { 254., "mm", 720.0 },
-        { 254., "cm", 7200. },
-        { 254., "m", 720000. },
-        { 1.5, "mm", (15 * 72. / 254) }
-    };
-    for (unsigned i = 0; i < G_N_ELEMENTS(tests); ++i) {
-        char name[80];
-        Case const &c = tests[i];
-        SPUnit const &unit = *sp_unit_get_by_abbreviation(N_(c.abbr));
-
-        double const calc_pts = sp_units_get_points(c.x, unit);
-        snprintf(name, sizeof(name), "%.1f %s -> %.1f pt", c.x, c.abbr, c.pts);
-        UTEST_TEST(name) {
-            UTEST_ASSERT(approx_equal(calc_pts, c.pts));
-        }
-
-        double const calc_x = sp_points_get_units(c.pts, unit);
-        snprintf(name, sizeof(name), "%.1f pt -> %.1f %s", c.pts, c.x, c.abbr);
-        UTEST_TEST(name) {
-            UTEST_ASSERT(approx_equal(calc_x, c.x));
-        }
-
-        double tmp = c.x;
-        bool const converted_to_pts = sp_convert_distance(&tmp, &unit, SP_PS_UNIT);
-        snprintf(name, sizeof(name), "convert %.1f %s -> %.1f pt", c.x, c.abbr, c.pts);
-        UTEST_TEST(name) {
-            UTEST_ASSERT(converted_to_pts);
-            UTEST_ASSERT(approx_equal(tmp, c.pts));
-        }
-
-        tmp = c.pts;
-        bool const converted_from_pts = sp_convert_distance(&tmp, SP_PS_UNIT, &unit);
-        snprintf(name, sizeof(name), "convert %.1f pt -> %.1f %s", c.pts, c.x, c.abbr);
-        UTEST_TEST(name) {
-            UTEST_ASSERT(converted_from_pts);
-            UTEST_ASSERT(approx_equal(tmp, c.x));
-        }
-    }
-    return utest_end();
-}
-
-static bool
-test_unit_table()
-{
-    utest_start("unit table");
-    UTEST_TEST("sp_units_table_sane") {
-        UTEST_ASSERT(sp_units_table_sane());
-    }
-    return utest_end();
-}
-
-int
-main(int /*argc*/, char */*argv*/[])
-{
-    int const ret = ( ( test_conversions()
-                        && test_unit_table() )
-                      ? EXIT_SUCCESS
-                      : EXIT_FAILURE );
-    return ret;
-}
-
-
-/*
-  Local Variables:
-  mode:c++
-  c-file-style:"stroustrup"
-  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
-  indent-tabs-mode:nil
-  fill-column:99
-  End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
index 21cce1ea26d0ea388eeb786c0bfe24df635310e8..f77475e6cec3bd25b0dcd2c2c7a4da8acd9c1a85 100644 (file)
@@ -93,6 +93,7 @@ libnr_libnr_a_SOURCES =       \
        libnr/nr-values.h       \
        $(libnr_mmx_sources)
 
+# Ancient performance test (?)
 libnr_testnr_SOURCES = \
        libnr/testnr.cpp
 
@@ -100,63 +101,29 @@ libnr_testnr_LDADD =      \
        libnr/libnr.a   \
        -lglib-2.0
 
-
-libnr/test-nr-main.cpp: libnr/test-nr.cpp
-       $(top_srcdir)/cxxtest/cxxtestgen.pl --template=$(srcdir)/selfname.tpl -root -o libnr/test-nr-main.cpp $(libnr_test_nr_includes)
-
-libnr/test-nr.cpp: $(libnr_test_nr_includes)
-       $(top_srcdir)/cxxtest/cxxtestgen.pl --have-eh -part -o libnr/test-nr.cpp $(libnr_test_nr_includes)
-
-libnr_test_nr_includes = \
+# ######################
+# ### CxxTest stuff ####
+# ######################
+libnr_testsuites = \
+       $(srcdir)/libnr/in-svg-plane-test.h     \
        $(srcdir)/libnr/nr-compose-test.h       \
-       $(srcdir)/libnr/nr-types-test.h \
-       $(srcdir)/libnr/nr-translate-test.h     \
-       $(srcdir)/libnr/nr-rotate-test.h        \
-       $(srcdir)/libnr/nr-scale-test.h \
+       $(srcdir)/libnr/nr-matrix-test.h        \
        $(srcdir)/libnr/nr-point-fns-test.h     \
+       $(srcdir)/libnr/nr-rotate-test.h        \
        $(srcdir)/libnr/nr-rotate-fns-test.h    \
-       $(srcdir)/libnr/in-svg-plane-test.h     \
-       $(srcdir)/libnr/nr-matrix-test.h
-
-libnr_libtest_nr_a_SOURCES =   \
-       libnr/test-nr.cpp \
-       libnr/nr-compose-reference.cpp \
-       libnr/nr-compose-reference.h \
-       $(libnr_test_nr_includes)
+       $(srcdir)/libnr/nr-scale-test.h         \
+       $(srcdir)/libnr/nr-translate-test.h     \
+       $(srcdir)/libnr/nr-types-test.h
 
 libnr_test_nr_SOURCES =        \
-       libnr/test-nr-main.cpp \
-       $(libnr_test_nr_includes)
+       libnr/test-nr.cpp \
+       $(libnr_testsuites)
 
-libnr_test_nr_LDADD =          \
-       libnr/libnr.a           \
-       libnr/libtest-nr.a      \
-       2geom/lib2geom.a        \
+libnr_test_nr_LDADD =                  \
+       libnr/libnr.a                   \
+       libnr/nr-compose-reference.o    \
+       2geom/lib2geom.a                \
        -lglib-2.0
 
-#      -L/usr/X11R6/lib
-#      -lX11
-
-libnr_in_svg_plane_test_SOURCES = libnr/in-svg-plane-test.cpp
-libnr_in_svg_plane_test_LDADD = libnr/libnr.a 2geom/lib2geom.a -lglib-2.0
-
-libnr_nr_types_test_SOURCES = libnr/nr-types-test.cpp
-libnr_nr_types_test_LDADD = libnr/libnr.a -lglib-2.0
-
-libnr_nr_point_fns_test_SOURCES = libnr/nr-point-fns-test.cpp
-libnr_nr_point_fns_test_LDADD = libnr/libnr.a -lglib-2.0
-
-libnr_nr_matrix_test_SOURCES = libnr/nr-matrix-test.cpp
-libnr_nr_matrix_test_LDADD = libnr/libnr.a -lglib-2.0
-
-libnr_nr_rotate_test_SOURCES = libnr/nr-rotate-test.cpp
-libnr_nr_rotate_test_LDADD = libnr/libnr.a -lglib-2.0
-
-libnr_nr_rotate_fns_test_SOURCES = libnr/nr-rotate-fns-test.cpp
-libnr_nr_rotate_fns_test_LDADD = libnr/libnr.a -lglib-2.0
-
-libnr_nr_scale_test_SOURCES = libnr/nr-scale-test.cpp
-libnr_nr_scale_test_LDADD = libnr/libnr.a -lglib-2.0
-
-libnr_nr_translate_test_SOURCES = libnr/nr-translate-test.cpp
-libnr_nr_translate_test_LDADD = libnr/libnr.a -lglib-2.0
+libnr/test-nr.cpp: $(libnr_testsuites) libnr/Makefile_insert $(CXXTEST_TEMPLATE)
+       $(CXXTESTGEN) -o libnr/test-nr.cpp $(libnr_testsuites)
diff --git a/src/libnr/in-svg-plane-test.cpp b/src/libnr/in-svg-plane-test.cpp
deleted file mode 100644 (file)
index 112dfae..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-#include <glib/gmacros.h>
-#include <cmath>
-
-#include "libnr/in-svg-plane.h"
-#include "utest/utest.h"
-#include "2geom/isnan.h"
-
-int main(int /*argc*/, char */*argv*/[])
-{
-    utest_start("in-svg-plane.h");
-
-    NR::Point const p3n4(3.0, -4.0);
-    NR::Point const p0(0.0, 0.0);
-    double const small = pow(2.0, -1070);
-    double const inf = 1e400;
-    double const nan = inf - inf;
-
-    NR::Point const small_left(-small, 0.0);
-    NR::Point const small_n3_4(-3.0 * small, 4.0 * small);
-    NR::Point const part_nan(3., nan);
-
-    assert(IS_NAN(nan));
-    assert(!IS_NAN(small));
-
-    UTEST_TEST("in_svg_plane") {
-        UTEST_ASSERT(in_svg_plane(p3n4));
-        UTEST_ASSERT(in_svg_plane(p0));
-        UTEST_ASSERT(in_svg_plane(small_left));
-        UTEST_ASSERT(in_svg_plane(small_n3_4));
-        UTEST_ASSERT(nan != nan);
-        UTEST_ASSERT(!in_svg_plane(NR::Point(nan, 3.)));
-        UTEST_ASSERT(!in_svg_plane(NR::Point(inf, nan)));
-        UTEST_ASSERT(!in_svg_plane(NR::Point(0., -inf)));
-        double const xs[] = {inf, -inf, nan, 1., -2., small, -small};
-        for (unsigned i = 0; i < G_N_ELEMENTS(xs); ++i) {
-            for (unsigned j = 0; j < G_N_ELEMENTS(xs); ++j) {
-                UTEST_ASSERT( in_svg_plane(NR::Point(xs[i], xs[j]))
-                              == (fabs(xs[i]) < inf &&
-                                  fabs(xs[j]) < inf   ) );
-            }
-        }
-    }
-
-    return ( utest_end()
-             ? EXIT_SUCCESS
-             : EXIT_FAILURE );
-}
-
-/*
-  Local Variables:
-  mode:c++
-  c-file-style:"stroustrup"
-  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
-  indent-tabs-mode:nil
-  fill-column:99
-  End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/libnr/nr-matrix-test.cpp b/src/libnr/nr-matrix-test.cpp
deleted file mode 100644 (file)
index 610ebb7..0000000
+++ /dev/null
@@ -1,171 +0,0 @@
-#include <utest/utest.h>
-#include <libnr/nr-matrix.h>
-#include <libnr/nr-matrix-fns.h>
-#include <libnr/nr-matrix-ops.h>
-#include <libnr/nr-matrix-rotate-ops.h>
-#include <libnr/nr-matrix-scale-ops.h>
-#include <libnr/nr-point-matrix-ops.h>
-#include <libnr/nr-rotate.h>
-#include <libnr/nr-rotate-ops.h>
-#include <libnr/nr-scale-ops.h>
-#include <libnr/nr-scale-translate-ops.h>
-#include <libnr/nr-translate.h>
-#include <libnr/nr-translate-ops.h>
-#include <libnr/nr-translate-scale-ops.h>
-using NR::Matrix;
-using NR::X;
-using NR::Y;
-
-inline bool point_equalp(NR::Point const &a, NR::Point const &b)
-{
-    return ( NR_DF_TEST_CLOSE(a[X], b[X], 1e-5) &&
-             NR_DF_TEST_CLOSE(a[Y], b[Y], 1e-5)   );
-}
-
-int main(int /*argc*/, char */*argv*/[])
-{
-    int rc = EXIT_SUCCESS;
-
-    Matrix const m_id(NR::identity());
-    NR::rotate const r_id(NR::Point(1, 0));
-    NR::translate const t_id(0, 0);
-
-    utest_start("Matrix");
-
-    Matrix const c16(1.0, 2.0,
-                     3.0, 4.0,
-                     5.0, 6.0);
-    UTEST_TEST("basic constructors, operator=") {
-        Matrix const c16_copy(c16);
-        Matrix c16_eq(m_id);
-        c16_eq = c16;
-        for(unsigned i = 0; i < 6; ++i) {
-            UTEST_ASSERT( c16[i] == 1.0 + i );
-            UTEST_ASSERT( c16[i] == c16_copy[i] );
-            UTEST_ASSERT( c16[i] == c16_eq[i] );
-            UTEST_ASSERT( m_id[i] == double( i == 0 || i == 3 ) );
-        }
-    }
-
-    UTEST_TEST("scale constructor") {
-        NR::scale const s(2.0, 3.0);
-        NR::Matrix const ms(s);
-        NR::Point const p(5.0, 7.0);
-        UTEST_ASSERT( p * s == NR::Point(10.0, 21.0) );
-        UTEST_ASSERT( p * ms == NR::Point(10.0, 21.0) );
-    }
-
-    NR::rotate const r86(NR::Point(.8, .6));
-    NR::Matrix const mr86(r86);
-    UTEST_TEST("rotate constructor") {
-        NR::Point const p0(1.0, 0.0);
-        NR::Point const p90(0.0, 1.0);
-        UTEST_ASSERT( p0 * r86 == NR::Point(.8, .6) );
-        UTEST_ASSERT( p0 * mr86 == NR::Point(.8, .6) );
-        UTEST_ASSERT( p90 * r86 == NR::Point(-.6, .8) );
-        UTEST_ASSERT( p90 * mr86 == NR::Point(-.6, .8) );
-        UTEST_ASSERT(matrix_equalp(Matrix( r86 * r86 ),
-                                   mr86 * mr86,
-                                   1e-14));
-    }
-
-    NR::translate const t23(2.0, 3.0);
-    UTEST_TEST("translate constructor") {
-        NR::Matrix const mt23(t23);
-        NR::Point const b(-2.0, 3.0);
-        UTEST_ASSERT( b * t23 == b * mt23 );
-    }
-
-    NR::scale const s_id(1.0, 1.0);
-    UTEST_TEST("test_identity") {
-        UTEST_ASSERT(m_id.test_identity());
-        UTEST_ASSERT(Matrix(t_id).test_identity());
-        UTEST_ASSERT(!(Matrix(NR::translate(-2, 3)).test_identity()));
-        UTEST_ASSERT(Matrix(r_id).test_identity());
-        NR::rotate const rot180(NR::Point(-1, 0));
-        UTEST_ASSERT(!(Matrix(rot180).test_identity()));
-        UTEST_ASSERT(Matrix(s_id).test_identity());
-        UTEST_ASSERT(!(Matrix(NR::scale(1.0, 0.0)).test_identity()));
-        UTEST_ASSERT(!(Matrix(NR::scale(0.0, 1.0)).test_identity()));
-        UTEST_ASSERT(!(Matrix(NR::scale(1.0, -1.0)).test_identity()));
-        UTEST_ASSERT(!(Matrix(NR::scale(-1.0, -1.0)).test_identity()));
-    }
-
-    UTEST_TEST("inverse") {
-        UTEST_ASSERT( m_id.inverse() == m_id );
-        UTEST_ASSERT( Matrix(t23).inverse() == Matrix(NR::translate(-2.0, -3.0)) );
-        NR::scale const s2(-4.0, 2.0);
-        NR::scale const sp5(-.25, .5);
-        UTEST_ASSERT( Matrix(s2).inverse() == Matrix(sp5) );
-        UTEST_ASSERT( Matrix(sp5).inverse() == Matrix(s2) );
-    }
-
-    UTEST_TEST("elliptic quadratic form") {
-        NR::Matrix const aff(1.0, 1.0,
-                             0.0, 1.0,
-                             5.0, 6.0);
-        NR::Matrix const invaff = aff.inverse();
-        UTEST_ASSERT( invaff[1] == -1.0 );
-
-        NR::Matrix const ef(elliptic_quadratic_form(invaff));
-        NR::Matrix const exp_ef(2, -1,
-                                -1, 1,
-                                0, 0);
-        UTEST_ASSERT( ef == exp_ef );
-    }
-
-    UTEST_TEST("Matrix * rotate") {
-        NR::Matrix const ma(2.0, -1.0,
-                            4.0, 4.0,
-                            -0.5, 2.0);
-        NR::Matrix const a_r86( ma * r86 );
-        NR::Matrix const ma1( a_r86 * r86.inverse() );
-        UTEST_ASSERT(matrix_equalp(ma1, ma, 1e-12));
-        NR::Matrix const exp_a_r86( 2*.8 + -1*-.6,  2*.6 + -1*.8,
-                                    4*.8 + 4*-.6,   4*.6 + 4*.8,
-                                    -.5*.8 + 2*-.6, -.5*.6 + 2*.8 );
-        UTEST_ASSERT(matrix_equalp(a_r86, exp_a_r86, 1e-12));
-    }
-
-    UTEST_TEST("translate*scale, scale*translate") {
-        NR::translate const t2n4(2, -4);
-        NR::scale const sn2_8(-2, 8);
-        NR::Matrix const exp_ts(-2, 0,
-                                0,  8,
-                                -4, -32);
-        NR::Matrix const exp_st(-2, 0,
-                                0,  8,
-                                2, -4);
-        UTEST_ASSERT( exp_ts == t2n4 * sn2_8 );
-        UTEST_ASSERT( exp_st == sn2_8 * t2n4 );
-    }
-
-    UTEST_TEST("Matrix * scale") {
-        NR::Matrix const ma(2.0, -1.0,
-                            4.0, 4.0,
-                            -0.5, 2.0);
-        NR::scale const sn2_8(-2, 8);
-        NR::Matrix const exp_as(-4, -8,
-                                -8, 32,
-                                1,  16);
-        UTEST_ASSERT( ma * sn2_8 == exp_as );
-    }
-
-    if (!utest_end()) {
-        rc = EXIT_FAILURE;
-    }
-
-    return rc;
-}
-
-
-/*
-  Local Variables:
-  mode:c++
-  c-file-style:"stroustrup"
-  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
-  indent-tabs-mode:nil
-  fill-column:99
-  End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/libnr/nr-point-fns-test.cpp b/src/libnr/nr-point-fns-test.cpp
deleted file mode 100644 (file)
index 0ceb19a..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-#include <cassert>
-#include <cmath>
-#include <glib/gmacros.h>
-#include <stdlib.h>
-
-#include "utest/utest.h"
-#include "libnr/nr-point-fns.h"
-#include "2geom/isnan.h"
-
-using NR::Point;
-
-int main(int /*argc*/, char */*argv*/[])
-{
-    utest_start("nr-point-fns");
-
-    Point const p3n4(3.0, -4.0);
-    Point const p0(0.0, 0.0);
-    double const small = pow(2.0, -1070);
-    double const inf = 1e400;
-    double const nan = inf - inf;
-
-    Point const small_left(-small, 0.0);
-    Point const small_n3_4(-3.0 * small, 4.0 * small);
-    Point const part_nan(3., nan);
-    Point const inf_left(-inf, 5.0);
-
-    assert(IS_NAN(nan));
-    assert(!IS_NAN(small));
-
-    UTEST_TEST("L1") {
-        UTEST_ASSERT( NR::L1(p0) == 0.0 );
-        UTEST_ASSERT( NR::L1(p3n4) == 7.0 );
-        UTEST_ASSERT( NR::L1(small_left) == small );
-        UTEST_ASSERT( NR::L1(inf_left) == inf );
-        UTEST_ASSERT( NR::L1(small_n3_4) == 7.0 * small );
-        UTEST_ASSERT(IS_NAN(NR::L1(part_nan)));
-    }
-
-    UTEST_TEST("L2") {
-        UTEST_ASSERT( NR::L2(p0) == 0.0 );
-        UTEST_ASSERT( NR::L2(p3n4) == 5.0 );
-        UTEST_ASSERT( NR::L2(small_left) == small );
-        UTEST_ASSERT( NR::L2(inf_left) == inf );
-        UTEST_ASSERT( NR::L2(small_n3_4) == 5.0 * small );
-        UTEST_ASSERT(IS_NAN(NR::L2(part_nan)));
-    }
-
-    UTEST_TEST("LInfty") {
-        UTEST_ASSERT( NR::LInfty(p0) == 0.0 );
-        UTEST_ASSERT( NR::LInfty(p3n4) == 4.0 );
-        UTEST_ASSERT( NR::LInfty(small_left) == small );
-        UTEST_ASSERT( NR::LInfty(inf_left) == inf );
-        UTEST_ASSERT( NR::LInfty(small_n3_4) == 4.0 * small );
-        UTEST_ASSERT(IS_NAN(NR::LInfty(part_nan)));
-    }
-
-    UTEST_TEST("is_zero") {
-        UTEST_ASSERT(NR::is_zero(p0));
-        UTEST_ASSERT(!NR::is_zero(p3n4));
-        UTEST_ASSERT(!NR::is_zero(small_left));
-        UTEST_ASSERT(!NR::is_zero(inf_left));
-        UTEST_ASSERT(!NR::is_zero(small_n3_4));
-        UTEST_ASSERT(!NR::is_zero(part_nan));
-    }
-
-    UTEST_TEST("atan2") {
-        UTEST_ASSERT( NR::atan2(p3n4) == atan2(-4.0, 3.0) );
-        UTEST_ASSERT( NR::atan2(small_left) == atan2(0.0, -1.0) );
-        UTEST_ASSERT( NR::atan2(small_n3_4) == atan2(4.0, -3.0) );
-    }
-
-    UTEST_TEST("unit_vector") {
-        UTEST_ASSERT( NR::unit_vector(p3n4) == Point(.6, -0.8) );
-        UTEST_ASSERT( NR::unit_vector(small_left) == Point(-1.0, 0.0) );
-        UTEST_ASSERT( NR::unit_vector(small_n3_4) == Point(-.6, 0.8) );
-    }
-
-    UTEST_TEST("is_unit_vector") {
-        UTEST_ASSERT(!NR::is_unit_vector(p3n4));
-        UTEST_ASSERT(!NR::is_unit_vector(small_left));
-        UTEST_ASSERT(!NR::is_unit_vector(small_n3_4));
-        UTEST_ASSERT(!NR::is_unit_vector(part_nan));
-        UTEST_ASSERT(!NR::is_unit_vector(inf_left));
-        UTEST_ASSERT(!NR::is_unit_vector(Point(.5, 0.5)));
-        UTEST_ASSERT(NR::is_unit_vector(Point(.6, -0.8)));
-        UTEST_ASSERT(NR::is_unit_vector(Point(-.6, 0.8)));
-        UTEST_ASSERT(NR::is_unit_vector(Point(-1.0, 0.0)));
-        UTEST_ASSERT(NR::is_unit_vector(Point(1.0, 0.0)));
-        UTEST_ASSERT(NR::is_unit_vector(Point(0.0, -1.0)));
-        UTEST_ASSERT(NR::is_unit_vector(Point(0.0, 1.0)));
-    }
-
-    return ( utest_end()
-             ? EXIT_SUCCESS
-             : EXIT_FAILURE );
-}
-
-/*
-  Local Variables:
-  mode:c++
-  c-file-style:"stroustrup"
-  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
-  indent-tabs-mode:nil
-  fill-column:99
-  End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/libnr/nr-rotate-fns-test.cpp b/src/libnr/nr-rotate-fns-test.cpp
deleted file mode 100644 (file)
index fb7df7e..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#include <cmath>
-#include <glib/gmacros.h>
-
-#include <libnr/nr-rotate-fns.h>
-#include <utest/utest.h>
-
-int main(int /*argc*/, char */*argv*/[])
-{
-    utest_start("rotate-fns");
-
-    UTEST_TEST("rotate_degrees") {
-        double const d[] = {
-            0, 90, 180, 270, 360, 45, 45.01, 44.99, 134, 135, 136, 314, 315, 317, 359, 361
-        };
-        for (unsigned i = 0; i < G_N_ELEMENTS(d); ++i) {
-            double const degrees = d[i];
-            NR::rotate const rot(rotate_degrees(degrees));
-            NR::rotate const rot_approx( M_PI * ( degrees / 180. ) );
-            UTEST_ASSERT(rotate_equalp(rot, rot_approx, 1e-12));
-
-            NR::rotate const rot_inv(rotate_degrees(-degrees));
-            NR::rotate const rot_compl(rotate_degrees(360 - degrees));
-            UTEST_ASSERT(rotate_equalp(rot_inv, rot_compl, 1e-12));
-
-            UTEST_ASSERT(!rotate_equalp(rot, rotate_degrees(degrees + 1), 1e-5));
-        }
-    }
-
-    return ( utest_end()
-             ? EXIT_SUCCESS
-             : EXIT_FAILURE );
-}
-
-/*
-  Local Variables:
-  mode:c++
-  c-file-style:"stroustrup"
-  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
-  indent-tabs-mode:nil
-  fill-column:99
-  End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4 :
diff --git a/src/libnr/nr-rotate-test.cpp b/src/libnr/nr-rotate-test.cpp
deleted file mode 100644 (file)
index b445625..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-#include <cmath>
-#include <utest/utest.h>
-#include <libnr/nr-matrix.h>
-#include <libnr/nr-matrix-fns.h>        /* identity, matrix_equalp */
-#include <libnr/nr-matrix-ops.h>
-#include <libnr/nr-point-fns.h>
-#include <libnr/nr-point-matrix-ops.h>
-#include <libnr/nr-rotate.h>
-#include <libnr/nr-rotate-fns.h>
-#include <libnr/nr-rotate-ops.h>
-using NR::X;
-using NR::Y;
-
-int main(int /*argc*/, char */*argv*/[])
-{
-    utest_start("rotate");
-
-    NR::Matrix const m_id(NR::identity());
-    NR::rotate const r_id(0.0);
-    NR::rotate const rot234(.234);
-    UTEST_TEST("constructors, comparisons") {
-        UTEST_ASSERT( r_id == r_id );
-        UTEST_ASSERT( rot234 == rot234 );
-        UTEST_ASSERT( rot234 != r_id );
-        UTEST_ASSERT( r_id == NR::rotate(NR::Point(1.0, 0.0)) );
-        UTEST_ASSERT( NR::Matrix(r_id) == m_id );
-        UTEST_ASSERT( NR::Matrix(r_id).test_identity() );
-
-        UTEST_ASSERT(rotate_equalp(rot234, NR::rotate(NR::Point(cos(.234), sin(.234))), 1e-12));
-    }
-
-    UTEST_TEST("operator=") {
-        NR::rotate rot234_eq(r_id);
-        rot234_eq = rot234;
-        UTEST_ASSERT( rot234 == rot234_eq );
-        UTEST_ASSERT( rot234_eq != r_id );
-    }
-
-    UTEST_TEST("inverse") {
-        UTEST_ASSERT( r_id.inverse() == r_id );
-        UTEST_ASSERT( rot234.inverse() == NR::rotate(-.234) );
-    }
-
-    NR::Point const b(-2.0, 3.0);
-    NR::rotate const rot180(NR::Point(-1.0, 0.0));
-    UTEST_TEST("operator*(Point, rotate)") {
-        UTEST_ASSERT( b * r_id == b );
-        UTEST_ASSERT( b * rot180 == -b );
-        UTEST_ASSERT( b * rot234 == b * NR::Matrix(rot234) );
-        UTEST_ASSERT(point_equalp(b * NR::rotate(M_PI / 2),
-                                  NR::rot90(b),
-                                  1e-14));
-        UTEST_ASSERT( b * rotate_degrees(90.) == NR::rot90(b) );
-    }
-
-    UTEST_TEST("operator*(rotate, rotate)") {
-        UTEST_ASSERT( r_id * r_id == r_id );
-        UTEST_ASSERT( rot180 * rot180 == r_id );
-        UTEST_ASSERT( rot234 * r_id == rot234 );
-        UTEST_ASSERT( r_id * rot234 == rot234 );
-        UTEST_ASSERT(rotate_equalp(rot234 * rot234.inverse(), r_id, 1e-14));
-        UTEST_ASSERT(rotate_equalp(rot234.inverse() * rot234, r_id, 1e-14));
-        UTEST_ASSERT(rotate_equalp(( NR::rotate(0.25) * NR::rotate(.5) ),
-                                   NR::rotate(.75),
-                                   1e-10));
-    }
-
-    UTEST_TEST("operator/(rotate, rotate)") {
-        UTEST_ASSERT( rot234 / r_id == rot234 );
-        UTEST_ASSERT( rot234 / rot180 == rot234 * rot180 );
-        UTEST_ASSERT(rotate_equalp(rot234 / rot234, r_id, 1e-14));
-        UTEST_ASSERT(rotate_equalp(r_id / rot234, rot234.inverse(), 1e-14));
-    }
-
-    return ( utest_end()
-             ? EXIT_SUCCESS
-             : EXIT_FAILURE );
-}
-
-/*
-  Local Variables:
-  mode:c++
-  c-file-style:"stroustrup"
-  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
-  indent-tabs-mode:nil
-  fill-column:99
-  End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/libnr/nr-scale-test.cpp b/src/libnr/nr-scale-test.cpp
deleted file mode 100644 (file)
index 6bc7991..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-#include <utest/utest.h>
-#include <libnr/nr-scale.h>
-#include <libnr/nr-scale-ops.h>
-using NR::X;
-using NR::Y;
-
-int main(int /*argc*/, char */*argv*/[])
-{
-    utest_start("NR::scale");
-
-    NR::scale const sa(1.5, 2.0);
-    UTEST_TEST("x,y constructor and operator[] const") {
-        UTEST_ASSERT(sa[X] == 1.5);
-        UTEST_ASSERT(sa[Y] == 2.0);
-        UTEST_ASSERT(sa[0u] == 1.5);
-        UTEST_ASSERT(sa[1u] == 2.0);
-    }
-
-    NR::Point const b(-2.0, 3.0);
-    NR::scale const sb(b);
-
-    UTEST_TEST("copy constructor, operator==, operator!=") {
-        NR::scale const sa_copy(sa);
-        UTEST_ASSERT( sa == sa_copy );
-        UTEST_ASSERT(!( sa != sa_copy ));
-        UTEST_ASSERT( sa != sb );
-    }
-
-    UTEST_TEST("operator=") {
-        NR::scale sa_eq(sb);
-        sa_eq = sa;
-        UTEST_ASSERT( sa == sa_eq );
-    }
-
-    UTEST_TEST("point constructor") {
-        UTEST_ASSERT(sb[X] == b[X]);
-        UTEST_ASSERT(sb[Y] == b[Y]);
-    }
-
-    UTEST_TEST("operator*(Point, scale)") {
-        NR::Point const ab( b * sa );
-        UTEST_ASSERT( ab == NR::Point(-3.0, 6.0) );
-    }
-
-    UTEST_TEST("operator*(scale, scale)") {
-        NR::scale const sab( sa * sb );
-        UTEST_ASSERT( sab == NR::scale(-3.0, 6.0) );
-    }
-
-    UTEST_TEST("operator/(scale, scale)") {
-        NR::scale const sa_b( sa / sb );
-        NR::scale const exp_sa_b(-0.75, 2./3.);
-        UTEST_ASSERT( sa_b[0] == exp_sa_b[0] );
-        UTEST_ASSERT( fabs( sa_b[1] - exp_sa_b[1] ) < 1e-10 );
-    }
-
-    return ( utest_end()
-             ? EXIT_SUCCESS
-             : EXIT_FAILURE );
-}
-
-/*
-  Local Variables:
-  mode:c++
-  c-file-style:"stroustrup"
-  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
-  indent-tabs-mode:nil
-  fill-column:99
-  End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/libnr/nr-translate-test.cpp b/src/libnr/nr-translate-test.cpp
deleted file mode 100644 (file)
index 7896315..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-#include <utest/utest.h>
-#include <libnr/nr-point-ops.h>
-#include <libnr/nr-matrix.h>
-#include <libnr/nr-matrix-fns.h>
-#include <libnr/nr-matrix-ops.h>
-#include <libnr/nr-point-matrix-ops.h>
-#include <libnr/nr-translate.h>
-#include <libnr/nr-translate-ops.h>
-using NR::X;
-using NR::Y;
-
-
-int main(int /*argc*/, char */*argv*/[])
-{
-    utest_start("translate");
-
-    NR::Point const b(-2.0, 3.0);
-    NR::translate const tb(b);
-    NR::translate const tc(-3.0, -2.0);
-    UTEST_TEST("constructors, operator[]") {
-        UTEST_ASSERT( tc[X] == -3.0 && tc[Y] == -2.0 );
-        UTEST_ASSERT( tb[0] == b[X] && tb[1] == b[Y] );
-    }
-
-    UTEST_TEST("operator=") {
-        NR::translate tb_eq(tc);
-        tb_eq = tb;
-        UTEST_ASSERT( tb == tb_eq );
-        UTEST_ASSERT( tb_eq != tc );
-    }
-
-    NR::translate const tbc( tb * tc );
-    UTEST_TEST("operator*(translate, translate)") {
-        UTEST_ASSERT( tbc.offset == NR::Point(-5.0, 1.0) );
-        UTEST_ASSERT( tbc.offset == ( tc * tb ).offset );
-        UTEST_ASSERT( NR::Matrix(tbc) == NR::Matrix(tb) * NR::Matrix(tc) );
-    }
-
-    UTEST_TEST("operator*(Point, translate)") {
-        UTEST_ASSERT( tbc.offset == b * tc );
-        UTEST_ASSERT( b * tc == b * NR::Matrix(tc) );
-    }
-
-    NR::translate const t_id(0.0, 0.0);
-    NR::Matrix const m_id(NR::identity());
-    UTEST_TEST("identity") {
-        UTEST_ASSERT( b * t_id == b );
-        UTEST_ASSERT( NR::Matrix(t_id) == m_id );
-    }
-
-    return ( utest_end()
-             ? EXIT_SUCCESS
-             : EXIT_FAILURE );
-}
-
-/*
-  Local Variables:
-  mode:c++
-  c-file-style:"stroustrup"
-  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
-  indent-tabs-mode:nil
-  fill-column:99
-  End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/libnr/nr-types-test.cpp b/src/libnr/nr-types-test.cpp
deleted file mode 100644 (file)
index 153ca79..0000000
+++ /dev/null
@@ -1,105 +0,0 @@
-#include "../utest/utest.h"
-#include <libnr/nr-types.h>
-#include <libnr/nr-point-fns.h>
-#include <cmath>
-using NR::Point;
-using NR::X;
-using NR::Y;
-
-
-int main(int /*argc*/, char */*argv*/[]) {
-       utest_start("Basic NR::Point operations");
-
-       UTEST_TEST("X,Y values") {
-               UTEST_ASSERT(X == 0);
-               UTEST_ASSERT(Y == 1);
-       }
-
-       NR::Point const a(1.5, 2.0);
-       UTEST_TEST("x,y constructor and operator[] const") {
-               UTEST_ASSERT(a[X] == 1.5);
-               UTEST_ASSERT(a[Y] == 2.0);
-       }
-
-       NR::Point const b(-2.0, 3.0);
-
-       UTEST_TEST("copy constructor") {
-               NR::Point a_copy(a);
-               UTEST_ASSERT(a == a_copy);
-               UTEST_ASSERT(!(a != a_copy));
-       }
-
-       UTEST_TEST("non-const operator[]") {
-               NR::Point a_copy(a);
-               a_copy[X] = -2.0;
-               UTEST_ASSERT(a_copy != a);
-               UTEST_ASSERT(a_copy != b);
-               a_copy[Y] = 3.0;
-               UTEST_ASSERT(a_copy == b);
-       }
-
-       NR::Point const ab(-0.5, 5.0);
-       UTEST_TEST("binary +, -") {
-               UTEST_ASSERT(a != b);
-               UTEST_ASSERT(a + b == ab);
-               UTEST_ASSERT(ab - a == b);
-               UTEST_ASSERT(ab - b == a);
-               UTEST_ASSERT(ab + a != b);
-       }
-
-       UTEST_TEST("unary-") {
-               UTEST_ASSERT(-a == Point(-a[X], -a[Y]));
-       }
-
-       UTEST_TEST("scale, divide") {
-               UTEST_ASSERT(-a == -1.0 * a);
-               UTEST_ASSERT(a + a + a == 3.0 * a);
-               UTEST_ASSERT(a / .5 == 2.0 * a);
-       }
-
-       UTEST_TEST("dot") {
-               UTEST_ASSERT( dot(a, b) == ( a[X] * b[X]  +
-                                            a[Y] * b[Y] ) );
-               UTEST_ASSERT( dot(a, NR::rot90(a)) == 0.0 );
-               UTEST_ASSERT( dot(-a, NR::rot90(a)) == 0.0 );
-       }
-
-       double const small = pow(2.0, -1070);
-
-       Point const small_left(-small, 0.0);
-       Point const smallish_3_neg4(3.0 * small, -4.0 * small);
-
-       UTEST_TEST("L1, L2, LInfty norms") {
-               UTEST_ASSERT(L1(small_left) == small);
-               UTEST_ASSERT(L2(small_left) == small);
-               UTEST_ASSERT(LInfty(small_left) == small);
-
-               UTEST_ASSERT(L1(smallish_3_neg4) == 7.0 * small);
-               UTEST_ASSERT(L2(smallish_3_neg4) == 5.0 * small);
-               UTEST_ASSERT(LInfty(smallish_3_neg4) == 4.0 * small);
-       }
-
-       UTEST_TEST("operator+=") {
-               Point x(a);
-               x += b;
-               UTEST_ASSERT(x == ab);
-       }
-
-       UTEST_TEST("operator/=") {
-               Point x(a);
-               x /= .5;
-               UTEST_ASSERT(x == a + a);
-       }
-
-       UTEST_TEST("normalize") {
-               Point x(small_left);
-               x.normalize();
-               UTEST_ASSERT(x == Point(-1.0, 0.0));
-
-               x = smallish_3_neg4;
-               x.normalize();
-               UTEST_ASSERT(x == Point(0.6, -0.8));
-       }
-
-       return utest_end() ? 0 : 1;
-}
diff --git a/src/selfname.tpl b/src/selfname.tpl
deleted file mode 100644 (file)
index df20beb..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-// -*- C++ -*-
-//
-
-#include "MultiPrinter.h"
-
-int main( int argc, char *argv[] )
-{
-    (void)argc;
-    return CxxTest::MultiPrinter( argv[0] ).run();
-}
-
-// The CxxTest "world"
-<CxxTest world>
index 3219f171e1efac7cd09134b9cae6d0336be32e6b..eae713d23a82c792eb77a0001989868df989f62d 100644 (file)
@@ -33,16 +33,10 @@ svg_libspsvg_a_SOURCES =    \
        svg/svg-path.cpp        \
        svg/svg.h
 
-
-# This CxxTest stuff is adapted blindly from libnr/Makefile_insert.
-# It would be nice to reduce the amount of boilerplate / copy&paste here.
-svg/test-svg-main.cpp: svg/test-svg.cpp
-       $(top_srcdir)/cxxtest/cxxtestgen.pl --template=$(srcdir)/selfname.tpl -root -o svg/test-svg-main.cpp $(svg_test_svg_includes)
-
-svg/test-svg.cpp: $(svg_test_svg_includes) svg/Makefile_insert
-       $(top_srcdir)/cxxtest/cxxtestgen.pl --have-eh -part -o svg/test-svg.cpp $(svg_test_svg_includes)
-
-svg_test_svg_includes = \
+# ######################
+# ### CxxTest stuff ####
+# ######################
+svg_testsuites = \
        $(srcdir)/svg/css-ostringstream-test.h  \
        $(srcdir)/svg/stringstream-test.h       \
        $(srcdir)/svg/svg-affine-test.h         \
@@ -50,13 +44,9 @@ svg_test_svg_includes = \
        $(srcdir)/svg/svg-length-test.h         \
        $(srcdir)/svg/svg-path-geom-test.h
 
-svg_libtest_svg_a_SOURCES = \
-       svg/test-svg.cpp        \
-       $(svg_test_svg_includes)
-
 svg_test_svg_SOURCES =         \
-       svg/test-svg-main.cpp   \
-       $(svg_test_svg_includes)
+       svg/test-svg.cpp        \
+       $(svg_testsuites)
 
 svg_test_svg_LDADD =           \
        svg/libspsvg.a          \
@@ -66,3 +56,5 @@ svg_test_svg_LDADD =          \
        libnr/libnr.a           \
        $(INKSCAPE_LIBS)
 
+svg/test-svg.cpp: $(svg_testsuites) svg/Makefile_insert $(CXXTEST_TEMPLATE)
+       $(CXXTESTGEN) -o svg/test-svg.cpp $(svg_testsuites)
index 88e340bd487c2c4528222afb556c1e7b6dc66715..bbf1589b43b3baec0f1105932c81deb8d1d86938 100644 (file)
@@ -69,7 +69,8 @@ Geom::PathVector sp_svg_read_pathv(char const * str)
     }
     catch (Geom::SVGPathParseError e) {
         generator.finish();
-        g_warning("Malformed SVG path, truncated path up to where error was found.\n Input path=\"%s\"\n Parsed path=\"%s\"", str, sp_svg_write_path(pathv));
+        // This warning is extremely annoying when testing
+        //g_warning("Malformed SVG path, truncated path up to where error was found.\n Input path=\"%s\"\n Parsed path=\"%s\"", str, sp_svg_write_path(pathv));
     }
 
     return pathv;
index e4a89d046212c8070c0773bd190aac6d20d6e85e..c3ac0be0bafe4d8ebf60d84b5e7d696eef87b694 100644 (file)
@@ -24,28 +24,21 @@ util_libinkutil_a_SOURCES = \
        util/units.cpp \
        util/units.h
 
-util_list_container_test_SOURCES = util/list-container-test.cpp
-util_list_container_test_LDADD = gc.o $(INKSCAPE_LIBS)
+# ######################
+# ### CxxTest stuff ####
+# ######################
 
-# Copy/paste from libnr
-util/test-util-main.cpp: util/test-util.cpp
-       $(top_srcdir)/cxxtest/cxxtestgen.pl --template=$(srcdir)/selfname.tpl -root -o util/test-util-main.cpp $(util_test_util_includes)
-
-util/test-util.cpp: $(util_test_util_includes)
-       $(top_srcdir)/cxxtest/cxxtestgen.pl --have-eh -part -o util/test-util.cpp $(util_test_util_includes)
-
-util_test_util_includes = \
+util_testsuites = \
        $(srcdir)/util/list-container-test.h
 
-util_libtest_util_a_SOURCES = \
-       util/test-util.cpp \
-       $(util_test_util_includes)
-
 util_test_util_SOURCES = \
-       util/test-util-main.cpp \
-       $(util_test_util_includes)
+       util/test-util.cpp \
+       $(util_testsuites)
 
 util_test_util_LDADD = \
-       util/libtest-util.a \
-       gc.o $(INKSCAPE_LIBS)
+       util/libtest-util.a     \
+       gc.o                    \
+       $(INKSCAPE_LIBS)
 
+util/test-util.cpp: $(util_testsuites) util/Makefile_insert $(CXXTEST_TEMPLATE)
+       $(CXXTESTGEN) -o util/test-util.cpp $(util_testsuites)
diff --git a/src/util/list-container-test.cpp b/src/util/list-container-test.cpp
deleted file mode 100644 (file)
index 45db65e..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-#include <stdarg.h>
-#include "../utest/utest.h"
-#include "util/list-container.h"
-
-using Inkscape::Util::ListContainer;
-
-#define ARRAY_RANGE(array) (array), (array)+sizeof((array))/sizeof((array)[0])
-
-static bool check_values(ListContainer<int> const &c, unsigned n_values, ...) {
-       bool ret = true;
-       va_list args;
-       va_start(args, n_values);
-       ListContainer<int>::const_iterator iter(c.begin());
-       while ( n_values && iter != c.end() ) {
-               int const value = va_arg(args, int);
-               if ( value != *iter ) {
-                       ret = false;
-               }
-               if ( n_values == 1 && &c.back() != &*iter ) {
-                       ret = false;
-               }
-               n_values--;
-               ++iter;
-       }
-       va_end(args);
-       return ret && n_values == 0 && iter == c.end();
-}
-
-int main(int /*argc*/, char */*argv*/[]) {
-       Inkscape::GC::init();
-       utest_start("List Container");
-       UTEST_TEST("range constructor") {
-               int const values[]={1,2,3,4};
-               int const * const values_end=values+4;
-               ListContainer<int> container(values, values_end);
-
-               ListContainer<int>::iterator container_iter=container.begin();
-               int const * values_iter=values;
-
-               while ( values_iter != values_end && container_iter != container.end() ) {
-                       UTEST_ASSERT(*values_iter == *container_iter);
-                       ++values_iter;
-                       ++container_iter;
-               }
-
-               UTEST_ASSERT(values_iter == values_end);
-               UTEST_ASSERT(container_iter == container.end());
-       }
-       UTEST_TEST("equality tests") {
-               int const a[] = { 1, 2, 3, 4 };
-               int const b[] = { 1, 2, 3, 4 };
-               int const c[] = { 1, 2, 3 };
-               int const d[] = { 1, 2, 3, 5 };
-               ListContainer<int> c_a(ARRAY_RANGE(a));
-               ListContainer<int> c_b(ARRAY_RANGE(b));
-               ListContainer<int> c_c(ARRAY_RANGE(c));
-               ListContainer<int> c_d(ARRAY_RANGE(d));
-
-               UTEST_ASSERT(c_a == c_b);
-               UTEST_ASSERT(!( c_a != c_b ));
-               UTEST_ASSERT(!( c_a == c_c ));
-               UTEST_ASSERT(c_a != c_c);
-               UTEST_ASSERT(!( c_a == c_d ));
-               UTEST_ASSERT(c_a != c_d);
-       }
-       UTEST_TEST("lessthan tests") {
-               int const a[] = { 1, 2, 3, 4 };
-               int const b[] = { 1, 2, 2, 4 };
-               int const c[] = { 1, 2, 4, 4 };
-               int const d[] = { 1, 2, 3 };
-               ListContainer<int> c_a(ARRAY_RANGE(a));
-               ListContainer<int> c_b(ARRAY_RANGE(b));
-               ListContainer<int> c_c(ARRAY_RANGE(c));
-               ListContainer<int> c_d(ARRAY_RANGE(d));
-               UTEST_ASSERT(c_a >= c_b);
-               UTEST_ASSERT(!( c_a < c_b ));
-               UTEST_ASSERT(!( c_a >= c_c ));
-               UTEST_ASSERT(c_a < c_c);
-               UTEST_ASSERT(!( c_a < c_d ));
-               UTEST_ASSERT(c_a >= c_d);
-               UTEST_ASSERT(c_d < c_a);
-       }
-       UTEST_TEST("assignment operator") {
-               int const a[] = { 1, 2, 3, 4 };
-               ListContainer<int> c_a(ARRAY_RANGE(a));
-               ListContainer<int> c_c;
-               UTEST_ASSERT(c_a != c_c);
-               c_c = c_a;
-               UTEST_ASSERT(c_a == c_c);
-               c_c = c_a;
-               UTEST_ASSERT(c_a == c_c);
-       }               
-       UTEST_TEST("fill constructor") {
-               ListContainer<int> filled((std::size_t)3, 2);
-               UTEST_ASSERT(check_values(filled, 3, 2, 2, 2));
-       }
-       UTEST_TEST("container size") {
-               ListContainer<int> empty;
-               UTEST_ASSERT(empty.empty());
-               UTEST_ASSERT(empty.size() == 0);
-               int const a[] = { 1, 2, 3 };
-               ListContainer<int> c_a(ARRAY_RANGE(a));
-               UTEST_ASSERT(!c_a.empty());
-               UTEST_ASSERT(c_a.size() == 3);
-
-               UTEST_ASSERT(empty.max_size() > 0);
-       }
-       UTEST_TEST("appending") {
-               ListContainer<int> c;
-               c.push_back(1);
-               UTEST_ASSERT(check_values(c, 1, 1));
-               c.push_back(2);
-               UTEST_ASSERT(check_values(c, 2, 1, 2));
-               c.push_back(3);
-               UTEST_ASSERT(check_values(c, 3, 1, 2, 3));
-       }
-       UTEST_TEST("bulk appending") {
-               int const a[] = { 1, 2, 3, 4 };
-               int const b[] = { 5, 6, 7 };
-               ListContainer<int> c_a(ARRAY_RANGE(a));
-               ListContainer<int> c_b(ARRAY_RANGE(b));
-               c_a.insert(c_a.end(), c_b.begin(), c_b.end());
-               UTEST_ASSERT(check_values(c_a, 7, 1, 2, 3, 4, 5, 6, 7));
-       }
-       UTEST_TEST("prepending") {
-               ListContainer<int> c;
-               c.push_front(1);
-               UTEST_ASSERT(check_values(c, 1, 1));
-               c.push_front(2);
-               UTEST_ASSERT(check_values(c, 2, 2, 1));
-               c.push_front(3);
-               UTEST_ASSERT(check_values(c, 3, 3, 2, 1));
-       }
-       UTEST_TEST("single-value insertion") {
-               ListContainer<int> c;
-
-               c.insert(c.begin(), 1);
-               UTEST_ASSERT(check_values(c, 1, 1));
-
-               c.insert(c.end(), 2);
-               UTEST_ASSERT(check_values(c, 2, 1, 2));
-
-               c.insert(c.begin(), 3);
-               UTEST_ASSERT(check_values(c, 3, 3, 1, 2));
-
-               ListContainer<int>::iterator pos=c.begin();
-               ++pos;
-               c.insert(pos, 4);
-               UTEST_ASSERT(check_values(c, 4, 3, 4, 1, 2));
-       }
-       UTEST_TEST("single-value erasure") {
-               int const values[] = { 1, 2, 3, 4 };
-               ListContainer<int> c(ARRAY_RANGE(values));
-
-               c.erase(c.begin());
-               UTEST_ASSERT(check_values(c, 3, 2, 3, 4));
-
-               ListContainer<int>::iterator pos=c.begin();
-               ++pos;
-               c.erase(pos);
-               UTEST_ASSERT(check_values(c, 2, 2, 4));
-
-               pos=c.begin();
-               ++pos;
-               c.erase(pos);
-               UTEST_ASSERT(check_values(c, 1, 2));
-
-               c.erase(c.begin());
-               UTEST_ASSERT(check_values(c, 0));
-       }
-       UTEST_TEST("pop_front") {
-               int const full_ary[] = { 1, 2, 3 };
-               ListContainer<int> t(ARRAY_RANGE(full_ary));
-               UTEST_ASSERT(check_values(t, 3,  1, 2, 3));
-               UTEST_ASSERT(t.back() == 3);
-               t.pop_front();
-               UTEST_ASSERT(check_values(t, 2,  2, 3));
-               UTEST_ASSERT(t.back() == 3);
-               t.push_back(23);
-               UTEST_ASSERT(check_values(t, 3,  2, 3, 23));
-               UTEST_ASSERT(t.back() == 23);
-               t.pop_front();
-               UTEST_ASSERT(check_values(t, 2,  3, 23));
-               UTEST_ASSERT(t.back() == 23);
-               t.pop_front();
-               UTEST_ASSERT(check_values(t, 1,  23));
-               UTEST_ASSERT(t.back() == 23);
-               t.pop_front();
-               UTEST_ASSERT(check_values(t, 0));
-               t.push_back(42);
-               UTEST_ASSERT(check_values(t, 1,  42));
-               UTEST_ASSERT(t.back() == 42);
-       }               
-       UTEST_TEST("erase_after") {
-               int const full_ary[] = { 1, 2, 3, 4 };
-               int const exp_ary[] = { 1, 3, 4 };
-               ListContainer<int> full_list(ARRAY_RANGE(full_ary));
-               ListContainer<int> exp_list(ARRAY_RANGE(exp_ary));
-               UTEST_ASSERT(full_list != exp_list);
-               full_list.erase_after(full_list.begin());
-               UTEST_ASSERT(full_list == exp_list);
-       }               
-       return utest_end() ? 0 : 1;
-}
index 5810052dee1fd02f249fe4fe23d219f42513d864..9ca81b23145572689fc5447e68759e7db5815e54 100644 (file)
@@ -53,45 +53,26 @@ xml_libspxml_a_SOURCES =    \
        xml/invalid-operation-exception.h \
        xml/xml-forward.h
 
-xml/test-xml-main.cpp: xml/test-xml.cpp $(xml_test_xml_includes)
-       $(top_srcdir)/cxxtest/cxxtestgen.pl --template=$(srcdir)/selfname.tpl -root -o xml/test-xml-main.cpp $(xml_test_xml_includes)
-
-xml/test-xml.cpp: $(xml_test_xml_includes)
-       $(top_srcdir)/cxxtest/cxxtestgen.pl --have-eh -part -o xml/test-xml.cpp $(xml_test_xml_includes)
-
-xml_test_xml_includes = \
+# ######################
+# ### CxxTest stuff ####
+# ######################
+xml_testsuites = \
        $(srcdir)/xml/repr-action-test.h        \
        $(srcdir)/xml/quote-test.h
 
-xml_libtest_xml_a_SOURCES =    \
-       xml/test-xml.cpp \
-       $(xml_test_xml_includes)
-
 xml_test_xml_SOURCES = \
-       xml/test-xml-main.cpp \
-       $(xml_test_xml_includes)
+       xml/test-xml.cpp \
+       $(xml_testsuites)
 
 xml_test_xml_LDADD =   \
-       xml/libtest-xml.a       \
        xml/libspxml.a          \
        util/libinkutil.a       \
        svg/libspsvg.a          \
+       helper/libspchelp.a     \
        test-stubs.o            \
        libinkpost.a            \
        debug/libinkdebug.a     \
        $(INKSCAPE_LIBS)
 
-
-xml_repr_action_test_SOURCES = \
-       xml/repr-action-test.cpp
-xml_repr_action_test_LDADD = \
-       xml/libspxml.a  \
-       svg/libspsvg.a  \
-       libtest-stubs.a \
-       util/libinkutil.a       \
-       libinkpost.a    \
-       debug/libinkdebug.a     \
-       $(INKSCAPE_LIBS)
-
-xml_quote_test_SOURCES = xml/quote-test.cpp
-xml_quote_test_LDADD = $(INKSCAPE_LIBS)
+xml/test-xml.cpp: $(xml_testsuites) xml/Makefile_insert $(CXXTEST_TEMPLATE)
+       $(CXXTESTGEN) -o xml/test-xml.cpp $(xml_testsuites)
diff --git a/src/xml/quote-test.cpp b/src/xml/quote-test.cpp
deleted file mode 100644 (file)
index 197ca53..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Initial author: Peter Moulder.
-   Hereby released into the Public Domain. */
-
-#include <cstring>
-#include <functional>
-
-#include "utest/test-1ary-cases.h"
-
-/* mental disclaims all responsibility for this evil idea for testing
-   static functions.  The main disadvantages are that we retain any
-   #define's and `using' directives of the included file. */
-#include "quote.cpp"
-
-struct streq_free2 {
-    bool operator()(char const *exp, char *got)
-    {
-        bool const ret = (strcmp(exp, got) == 0);
-        g_free(got);
-        return ret;
-    }
-};
-
-static bool
-test_xml_quoted_strlen()
-{
-    utest_start("xml_quoted_strlen");
-    struct Case1<char const *, size_t> cases[] = {
-        {"", 0},
-        {"x", 1},
-        {"Foo", 3},
-        {"\"", 6},
-        {"&", 5},
-        {"<", 4},
-        {">", 4},
-        {"a\"b", 8},
-        {"a\"b<c>d;!@#$%^*(\\)?", 30}
-    };
-    test_1ary_cases<size_t, char const *, size_t, std::equal_to<size_t> >("xml_quoted_strlen",
-                                                                          xml_quoted_strlen,
-                                                                          G_N_ELEMENTS(cases),
-                                                                          cases);
-    return utest_end();
-}
-
-static bool
-test_xml_quote_strdup()
-{
-    utest_start("xml_quote_strdup");
-    struct Case1<char const *, char const *> cases[] = {
-        {"", ""},
-        {"x", "x"},
-        {"Foo", "Foo"},
-        {"\"", "&quot;"},
-        {"&", "&amp;"},
-        {"<", "&lt;"},
-        {">", "&gt;"},
-        {"a\"b<c>d;!@#$%^*(\\)?", "a&quot;b&lt;c&gt;d;!@#$%^*(\\)?"}
-    };
-    test_1ary_cases<char *, char const *, char const *, streq_free2>("xml_quote_strdup",
-                                                                     xml_quote_strdup,
-                                                                     G_N_ELEMENTS(cases),
-                                                                     cases);
-    return utest_end();
-}
-
-int main() {
-    bool const succ = (test_xml_quoted_strlen()
-                       && test_xml_quote_strdup());
-    return ( succ
-             ? EXIT_SUCCESS
-             : EXIT_FAILURE );
-}
-
-
-/*
-  Local Variables:
-  mode:c++
-  c-file-style:"stroustrup"
-  c-file-offsets:((innamespace . 0)(inline-open . 0)(case-label . +))
-  indent-tabs-mode:nil
-  fill-column:99
-  End:
-*/
-// vim: filetype=cpp:expandtab:shiftwidth=4:tabstop=8:softtabstop=4:encoding=utf-8:textwidth=99 :
diff --git a/src/xml/repr-action-test.cpp b/src/xml/repr-action-test.cpp
deleted file mode 100644 (file)
index d36ff41..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#include <cstdlib>
-#include <glib.h>
-#include "../utest/utest.h"
-
-#include "repr.h"
-#include "event-fns.h"
-
-int main(int /*argc*/, char */*argv*/[]) {
-       Inkscape::XML::Document *document;
-       Inkscape::XML::Node *a, *b, *c, *root;
-
-       Inkscape::GC::init();
-
-       document = sp_repr_document_new("test");
-       root = document->root();
-
-       utest_start("XML Transactions");
-
-       a = document->createElement("a");
-       b = document->createElement("b");
-       c = document->createElement("c");
-
-       UTEST_TEST("rollback of node addition") {
-               sp_repr_begin_transaction(document);
-               UTEST_ASSERT(sp_repr_parent(a) == NULL);
-
-               root->appendChild(a);
-               UTEST_ASSERT(sp_repr_parent(a) == root);
-
-               sp_repr_rollback(document);
-               UTEST_ASSERT(sp_repr_parent(a) == NULL);
-       }
-
-       UTEST_TEST("rollback of node removal") {
-               root->appendChild(a);
-
-               sp_repr_begin_transaction(document);
-               UTEST_ASSERT(sp_repr_parent(a) == root);
-
-               sp_repr_unparent(a);
-               UTEST_ASSERT(sp_repr_parent(a) == NULL);
-
-               sp_repr_rollback(document);
-               UTEST_ASSERT(sp_repr_parent(a) == root);
-       }
-
-       sp_repr_unparent(a);
-
-       UTEST_TEST("rollback of node reordering") {
-               root->appendChild(a);
-               root->appendChild(b);
-               root->appendChild(c);
-
-               sp_repr_begin_transaction(document);
-               UTEST_ASSERT(sp_repr_next(a) == b);
-               UTEST_ASSERT(sp_repr_next(b) == c);
-               UTEST_ASSERT(sp_repr_next(c) == NULL);
-
-               root->changeOrder(b, c);
-               UTEST_ASSERT(sp_repr_next(a) == c);
-               UTEST_ASSERT(sp_repr_next(b) == NULL);
-               UTEST_ASSERT(sp_repr_next(c) == b);
-
-               sp_repr_rollback(document);
-               UTEST_ASSERT(sp_repr_next(a) == b);
-               UTEST_ASSERT(sp_repr_next(b) == c);
-               UTEST_ASSERT(sp_repr_next(c) == NULL);
-       }
-
-       sp_repr_unparent(a);
-       sp_repr_unparent(b);
-       sp_repr_unparent(c);
-
-       /* lots more tests needed ... */
-
-       return utest_end() ? 0 : 1;
-}