[cppunit] 16/38: Import Debian changes 1.12.0-2
Rene Engelhard
rene at moszumanska.debian.org
Sun May 14 10:57:35 UTC 2017
This is an automated email from the git hooks/post-receive script.
rene pushed a commit to branch experimental
in repository cppunit.
commit a1b5c42b9df74d5c899cb4ab52ceb67cb519fb55
Author: Steve M. Robbins <smr at debian.org>
Date: Fri Nov 10 22:50:17 2006 -0600
Import Debian changes 1.12.0-2
cppunit (1.12.0-2) unstable; urgency=low
* src/cppunit/TestAssert.cpp:
* examples/cppunittest/TestAssertTest.cpp: Fix CPPUNIT_ASSERT_DOUBLES_EQUAL() to work
properly with NaN values (debian/patch04.assert-doubles-equal). Closes: #396865.
* debian/rules:
* debian/examples: Add all example code to libcppunit-doc. Closes: #379968.
---
debian/changelog | 11 +++++
debian/examples/Makefile.am | 83 ---------------------------------
debian/examples/README | 9 ++--
debian/examples/configure.ac | 12 ++++-
debian/examples/setup.sh | 19 ++++++++
debian/patch04.assert-doubles-equal | 48 +++++++++++++++++++
debian/rules | 6 +--
examples/cppunittest/TestAssertTest.cpp | 11 +++++
src/cppunit/TestAssert.cpp | 8 +++-
9 files changed, 111 insertions(+), 96 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index 2f0d02c..934b6c3 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,14 @@
+cppunit (1.12.0-2) unstable; urgency=low
+
+ * src/cppunit/TestAssert.cpp:
+ * examples/cppunittest/TestAssertTest.cpp: Fix CPPUNIT_ASSERT_DOUBLES_EQUAL() to work
+ properly with NaN values (debian/patch04.assert-doubles-equal). Closes: #396865.
+
+ * debian/rules:
+ * debian/examples: Add all example code to libcppunit-doc. Closes: #379968.
+
+ -- Steve M. Robbins <smr at debian.org> Fri, 10 Nov 2006 22:50:17 -0600
+
cppunit (1.12.0-1) unstable; urgency=low
* New upstream version. Closes: #376122.
diff --git a/debian/examples/Makefile.am b/debian/examples/Makefile.am
deleted file mode 100644
index f5b227c..0000000
--- a/debian/examples/Makefile.am
+++ /dev/null
@@ -1,83 +0,0 @@
-INCLUDES = $(CPPUNIT_CFLAGS)
-LDADD = $(CPPUNIT_LIBS)
-
-if HAVE_CPPUNIT
-TESTS = hierarchy cppunittestmain
-check_PROGRAMS = $(TESTS)
-endif
-
-hierarchy_SOURCES= BoardGame.cpp \
- Chess.cpp \
- main.cpp \
- BoardGame.h \
- Chess.h \
- BoardGameTest.h \
- ChessTest.h
-
-cppunittestmain_SOURCES = \
- BaseTestCase.cpp \
- BaseTestCase.h \
- CoreSuite.h \
- CppUnitTestMain.cpp \
- CppUnitTestSuite.cpp \
- ExceptionTest.cpp \
- ExceptionTest.h \
- ExceptionTestCaseDecoratorTest.h \
- ExceptionTestCaseDecoratorTest.cpp \
- ExtensionSuite.h \
- FailureException.h \
- HelperMacrosTest.cpp \
- HelperMacrosTest.h \
- HelperSuite.h \
- MessageTest.h \
- MessageTest.cpp \
- MockFunctor.h \
- MockProtector.h \
- MockTestCase.h \
- MockTestCase.cpp \
- MockTestListener.cpp \
- MockTestListener.h \
- OrthodoxTest.cpp \
- OrthodoxTest.h \
- OutputSuite.h \
- RepeatedTestTest.cpp \
- RepeatedTestTest.h \
- StringToolsTest.h \
- StringToolsTest.cpp \
- SubclassedTestCase.cpp \
- SubclassedTestCase.h \
- SynchronizedTestResult.h \
- TestAssertTest.cpp \
- TestAssertTest.h \
- TestCallerTest.cpp \
- TestCallerTest.h \
- TestCaseTest.cpp \
- TestCaseTest.h \
- TestDecoratorTest.cpp \
- TestDecoratorTest.h \
- TestFailureTest.cpp \
- TestFailureTest.h \
- TestPathTest.h \
- TestPathTest.cpp \
- TestResultCollectorTest.cpp \
- TestResultCollectorTest.h \
- TestResultTest.cpp \
- TestResultTest.h \
- TestSetUpTest.cpp \
- TestSetUpTest.h \
- TestSuiteTest.cpp \
- TestSuiteTest.h \
- TestTest.cpp \
- TestTest.h \
- ToolsSuite.h \
- TrackedTestCase.cpp \
- TrackedTestCase.h \
- UnitTestToolSuite.h \
- XmlElementTest.h \
- XmlElementTest.cpp \
- XmlOutputterTest.h \
- XmlOutputterTest.cpp \
- XmlUniformiser.h \
- XmlUniformiser.cpp \
- XmlUniformiserTest.h \
- XmlUniformiserTest.cpp
diff --git a/debian/examples/README b/debian/examples/README
index 24dc063..2a4feef 100644
--- a/debian/examples/README
+++ b/debian/examples/README
@@ -1,4 +1,4 @@
-This directory contains two examples of using CppUnit.
+This directory contains some examples of using CppUnit.
The test "hierarchy" is a small example, demonstrating
CPPUNIT_TEST_SUITE / CPPUNIT_TEST / CPPUNIT_TEST_SUITE_END family of
@@ -10,12 +10,9 @@ As you might expect, it is rather large.
You should be able to build these examples using the following
-sequence of commands. Be sure to unzip any gzipped source files
-first.
+sequence of commands.
- aclocal
- automake --add-missing --foreign
- autoconf
+ sh setup.sh
./configure
make check
diff --git a/debian/examples/configure.ac b/debian/examples/configure.ac
index c6a2b0d..e44e105 100644
--- a/debian/examples/configure.ac
+++ b/debian/examples/configure.ac
@@ -1,8 +1,8 @@
AC_INIT(cppunit-test-example,1.0)
-#AM_INIT_AUTOMAKE(cppunit-test-example,1.0)
AM_INIT_AUTOMAKE
AC_PROG_CXX
+AC_PROG_LIBTOOL
# Locate CppUnit (minimum version 1.8.0) for testing.
AM_PATH_CPPUNIT(1.8.0)
@@ -11,6 +11,14 @@ AM_PATH_CPPUNIT(1.8.0)
# build cppunit-using test programs.
AM_CONDITIONAL(HAVE_CPPUNIT, test "$CPPUNIT_LIBS")
-AC_CONFIG_FILES(Makefile)
+AC_CONFIG_FILES([
+Makefile
+ClockerPlugIn/Makefile
+DumperPlugIn/Makefile
+cppunittest/Makefile
+hierarchy/Makefile
+money/Makefile
+simple/Makefile
+])
AC_OUTPUT
diff --git a/debian/examples/setup.sh b/debian/examples/setup.sh
new file mode 100644
index 0000000..b0346aa
--- /dev/null
+++ b/debian/examples/setup.sh
@@ -0,0 +1,19 @@
+#! /bin/sh
+
+set -e
+
+if ! test -d ClockerPlugIn; then
+ echo >&2 "Cannot find ClockerPlugIn -- run from root of examples directory."
+ exit 1
+fi
+
+gzip --force README
+find . -name '*.gz' -print0 | xargs -0 gunzip -f
+
+mkdir -p src/cppunit
+ln -f -s /usr/lib/libcppunit.la src/cppunit
+
+aclocal
+libtoolize --automake
+automake --add-missing --foreign
+autoconf
diff --git a/debian/patch04.assert-doubles-equal b/debian/patch04.assert-doubles-equal
new file mode 100644
index 0000000..568e8c1
--- /dev/null
+++ b/debian/patch04.assert-doubles-equal
@@ -0,0 +1,48 @@
+? cppunit.pc
+Index: examples/cppunittest/TestAssertTest.cpp
+===================================================================
+RCS file: /cvsroot/cppunit/cppunit/examples/cppunittest/TestAssertTest.cpp,v
+retrieving revision 1.9
+diff -u -b -B -r1.9 TestAssertTest.cpp
+--- examples/cppunittest/TestAssertTest.cpp 5 Nov 2004 22:47:21 -0000 1.9
++++ examples/cppunittest/TestAssertTest.cpp 11 Nov 2006 04:39:10 -0000
+@@ -167,6 +167,17 @@
+
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.1, 1.2, 0.09 ) );
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.2, 1.1, 0.09 ) );
++
++ double inf = std::numeric_limits<double>::infinity();
++ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( inf, 0.0, 1.0 ) );
++ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, inf, 1.0 ) );
++ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_DOUBLES_EQUAL( inf, inf, 1.0 ) );
++
++ double nan = std::numeric_limits<double>::quiet_NaN();
++ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, 0.0, 1.0 ) );
++ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, nan, 1.0 ) );
++ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, inf, 1.0 ) );
++ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( inf, nan, 1.0 ) );
+ }
+
+
+Index: src/cppunit/TestAssert.cpp
+===================================================================
+RCS file: /cvsroot/cppunit/cppunit/src/cppunit/TestAssert.cpp,v
+retrieving revision 1.12
+diff -u -b -B -r1.12 TestAssert.cpp
+--- src/cppunit/TestAssert.cpp 5 Nov 2004 22:47:20 -0000 1.12
++++ src/cppunit/TestAssert.cpp 11 Nov 2006 04:39:10 -0000
+@@ -21,7 +21,13 @@
+ assertion_traits<double>::toString(delta) );
+ msg.addDetail( AdditionalMessage(message) );
+
+- Asserter::failNotEqualIf( fabs( expected - actual ) > delta,
++ bool equal;
++ if ( isfinite(expected) && isfinite(actual) )
++ equal = fabs( expected - actual ) <= delta;
++ else
++ equal = expected == actual;
++
++ Asserter::failNotEqualIf( !equal,
+ assertion_traits<double>::toString(expected),
+ assertion_traits<double>::toString(actual),
+ sourceLine,
diff --git a/debian/rules b/debian/rules
index d562b34..91dbd5b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -82,7 +82,9 @@ install: build
dh_install -plibcppunit-dev --autodest debian/tmp/usr/share/aclocal
# Documentation package
+ $(MAKE) -C examples clean
dh_install -plibcppunit-doc --autodest debian/tmp/usr/share/doc
+ dh_installexamples -plibcppunit-doc examples/* debian/examples/*
# Build architecture-independent files here.
@@ -94,10 +96,6 @@ binary-arch: build install
dh_testdir
dh_testroot
dh_installdocs
- dh_installexamples -plibcppunit-doc \
- examples/hierarchy/*.h examples/hierarchy/*.cpp \
- examples/cppunittest/*.h examples/cppunittest/*.cpp \
- debian/examples/*
dh_installmenu
dh_installcron
dh_installinfo
diff --git a/examples/cppunittest/TestAssertTest.cpp b/examples/cppunittest/TestAssertTest.cpp
index 5c81a3f..429565f 100644
--- a/examples/cppunittest/TestAssertTest.cpp
+++ b/examples/cppunittest/TestAssertTest.cpp
@@ -167,6 +167,17 @@ TestAssertTest::testAssertDoubleEquals()
CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.1, 1.2, 0.09 ) );
CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( 1.2, 1.1, 0.09 ) );
+
+ double inf = std::numeric_limits<double>::infinity();
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( inf, 0.0, 1.0 ) );
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( 0.0, inf, 1.0 ) );
+ CPPUNIT_ASSERT_ASSERTION_PASS( CPPUNIT_ASSERT_DOUBLES_EQUAL( inf, inf, 1.0 ) );
+
+ double nan = std::numeric_limits<double>::quiet_NaN();
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, 0.0, 1.0 ) );
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, nan, 1.0 ) );
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( nan, inf, 1.0 ) );
+ CPPUNIT_ASSERT_ASSERTION_FAIL( CPPUNIT_ASSERT_DOUBLES_EQUAL( inf, nan, 1.0 ) );
}
diff --git a/src/cppunit/TestAssert.cpp b/src/cppunit/TestAssert.cpp
index 73375c2..291aa6e 100644
--- a/src/cppunit/TestAssert.cpp
+++ b/src/cppunit/TestAssert.cpp
@@ -21,7 +21,13 @@ assertDoubleEquals( double expected,
assertion_traits<double>::toString(delta) );
msg.addDetail( AdditionalMessage(message) );
- Asserter::failNotEqualIf( fabs( expected - actual ) > delta,
+ bool equal;
+ if ( isfinite(expected) && isfinite(actual) )
+ equal = fabs( expected - actual ) <= delta;
+ else
+ equal = expected == actual;
+
+ Asserter::failNotEqualIf( !equal,
assertion_traits<double>::toString(expected),
assertion_traits<double>::toString(actual),
sourceLine,
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-openoffice/cppunit.git
More information about the Pkg-openoffice-commits
mailing list