diff options
| author | Jon A. Cruz <jon@joncruz.org> | 2006-05-01 08:11:44 +0000 |
|---|---|---|
| committer | joncruz <joncruz@users.sourceforge.net> | 2006-05-01 08:11:44 +0000 |
| commit | 27193e990445befdf0b370db957120e413c4ec9f (patch) | |
| tree | d85de14b9f58e20ad820d522462e0eacc4f59d24 /src/round-test.cpp | |
| parent | fix 1479197 (diff) | |
| download | inkscape-27193e990445befdf0b370db957120e413c4ec9f.tar.gz inkscape-27193e990445befdf0b370db957120e413c4ec9f.zip | |
Moved four more tests to CxxTest
(bzr r650)
Diffstat (limited to 'src/round-test.cpp')
| -rw-r--r-- | src/round-test.cpp | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/src/round-test.cpp b/src/round-test.cpp deleted file mode 100644 index efb4b3e83..000000000 --- a/src/round-test.cpp +++ /dev/null @@ -1,91 +0,0 @@ -#include <cassert> -#include <functional> -#include <glib/gmacros.h> - -#include <utest/test-1ary-cases.h> -#include <utest/utest.h> -#include <round.h> - -static Case1<double, double> const nonneg_round_cases[] = { - { 5.0, 5.0 }, - { 0.0, 0.0 }, - { 5.4, 5.0 }, - { 5.6, 6.0 }, - { 1e-7, 0.0 }, - { 1e7 + .49, 1e7 }, - { 1e7 + .51, 1e7 + 1 }, - { 1e12 + .49, 1e12 }, - { 1e12 + .51, 1e12 + 1 }, - { 1e40, 1e40 } -}; - -static Case1<double, double> nonpos_round_cases[G_N_ELEMENTS(nonneg_round_cases)]; - -static void fill_nonpos_round_cases() -{ - assert(G_N_ELEMENTS(nonneg_round_cases) == G_N_ELEMENTS(nonpos_round_cases)); - for(unsigned i = 0; i < G_N_ELEMENTS(nonpos_round_cases); ++i) { - nonpos_round_cases[i].f_arg0 = -nonneg_round_cases[i].f_arg0; - nonpos_round_cases[i].valid_arg0 = -nonneg_round_cases[i].valid_arg0; - } -} - -static bool -test_round() -{ - utest_start("round"); - test_1ary_cases<double, double, double, std::equal_to<double> > - ("non-neg round", - Inkscape::round, - G_N_ELEMENTS(nonneg_round_cases), nonneg_round_cases); - - fill_nonpos_round_cases(); - - test_1ary_cases<double, double, double, std::equal_to<double> > - ("non-pos round", - Inkscape::round, - G_N_ELEMENTS(nonpos_round_cases), nonpos_round_cases); - -#if 0 - for(unsigned i = 0; i < G_N_ELEMENTS(round_cases); ++i) { - RoundCase const &c = round_cases[i]; - double const got = Inkscape::round(c.unrounded); - UTEST_ASSERT( got == c.exp_rounded ); - - double const neg_got = Inkscape::round(-c.unrounded); - UTEST_ASSERT( neg_got = -c.exp_rounded ); - } -#endif - return utest_end(); -} - -#if 0 -/* Deliberately down here just to ensure that correct behaviour of Inkscape::round doesn't depend - on #including decimal-round.h. (decimal-round.h already #includes round.h, so there's no point - checking the other way around.) */ -#include <decimal-round.h> - -static void -test_decimal_round() -{ -} -#endif - -int main() -{ - int const ret = ( test_round() - ? 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 : |
