From 0afd9182f7a018baa5bfeb46a33dfcf6c6680fbd Mon Sep 17 00:00:00 2001 From: Krzysztof Kosi??ski Date: Mon, 29 Dec 2008 22:47:57 +0000 Subject: Build a single test executable on Linux to match Windows build system. (bzr r7040) --- src/helper/Makefile_insert | 13 +------------ src/helper/units-test.h | 45 +++++++++++++++++++++------------------------ 2 files changed, 22 insertions(+), 36 deletions(-) (limited to 'src/helper') diff --git a/src/helper/Makefile_insert b/src/helper/Makefile_insert index 1801d0ea1..cabd9b6ad 100644 --- a/src/helper/Makefile_insert +++ b/src/helper/Makefile_insert @@ -62,16 +62,5 @@ helper/sp-marshal.cpp helper/sp-marshal.h: helper/sp-marshal.list # ###################### # ### CxxTest stuff #### # ###################### -helper_testsuites = \ +CXXTEST_TESTSUITES += \ $(srcdir)/helper/units-test.h - -helper_test_helper_SOURCES = \ - helper/test-helper.cpp \ - $(helper_testsuites) - -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.h b/src/helper/units-test.h index 15eab65d2..e54c9d2f9 100644 --- a/src/helper/units-test.h +++ b/src/helper/units-test.h @@ -4,30 +4,6 @@ #include #include - -/* 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); -} - class UnitsTest : public CxxTest::TestSuite { public: @@ -79,6 +55,27 @@ public: { TS_ASSERT(sp_units_table_sane()); } + +private: + /* N.B. Wrongly returns false if both near 0. (Not a problem for current users.) */ + bool approx_equal(double const x, double const y) + { + return fabs(x / y - 1) < 1e-15; + } + + 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); + } + + 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); + } }; /* -- cgit v1.2.3