[Aptitude-svn-commit] r3699 - in branches/aptitude-0.3/aptitude: .
tests
Daniel Burrows
dburrows at costa.debian.org
Tue Jul 26 18:54:04 UTC 2005
Author: dburrows
Date: Tue Jul 26 18:54:02 2005
New Revision: 3699
Added:
branches/aptitude-0.3/aptitude/tests/test_misc.cc
Modified:
branches/aptitude-0.3/aptitude/ChangeLog
branches/aptitude-0.3/aptitude/tests/Makefile.am
Log:
Ad a file for tests that don't belong elsewhere.
Modified: branches/aptitude-0.3/aptitude/ChangeLog
==============================================================================
--- branches/aptitude-0.3/aptitude/ChangeLog (original)
+++ branches/aptitude-0.3/aptitude/ChangeLog Tue Jul 26 18:54:02 2005
@@ -1,5 +1,9 @@
2005-07-26 Daniel Burrows <dburrows at debian.org>
+ * tests/Makefile.am, tests/test_misc.cc:
+
+ Add a file for tests that don't belong elsewhere.
+
* tests/Makefile.am, tests/test_tags.cc:
Update the source to compile with the lifted suites.
Modified: branches/aptitude-0.3/aptitude/tests/Makefile.am
==============================================================================
--- branches/aptitude-0.3/aptitude/tests/Makefile.am (original)
+++ branches/aptitude-0.3/aptitude/tests/Makefile.am Tue Jul 26 18:54:02 2005
@@ -9,4 +9,5 @@
test_SOURCES = \
main.cc \
+ test_misc.cc \
test_tags.cc
\ No newline at end of file
Added: branches/aptitude-0.3/aptitude/tests/test_misc.cc
==============================================================================
--- (empty file)
+++ branches/aptitude-0.3/aptitude/tests/test_misc.cc Tue Jul 26 18:54:02 2005
@@ -0,0 +1,57 @@
+// Miscellaneous tests.
+//
+// Copyright (C) 2005 Daniel Burrows
+//
+// This program is free software; you can redistribute it and/or
+// modify it under the terms of the GNU General Public License as
+// published by the Free Software Foundation; either version 2 of
+// the License, or (at your option) any later version.
+//
+// This program is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with this program; see the file COPYING. If not, write to
+// the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+// Boston, MA 02111-1307, USA.
+
+#include <cppunit/extensions/HelperMacros.h>
+
+#include <src/generic/util.h>
+
+class MiscTest : public CppUnit::TestFixture
+{
+ CPPUNIT_TEST_SUITE(MiscTest);
+
+ CPPUNIT_TEST(testStripWS);
+
+ CPPUNIT_TEST_SUITE_END();
+private:
+ void assertStripWS(const std::string &s,
+ const std::string &expected)
+ {
+ std::string s2 = s;
+ stripws(s2);
+
+ CPPUNIT_ASSERT_EQUAL(expected, s2);
+ }
+
+ void testStripWS()
+ {
+ assertStripWS(" abc", "abc");
+ assertStripWS("abc ", "abc");
+ assertStripWS(" abc ", "abc");
+
+ assertStripWS(" ", "");
+
+ // double-check that there are no weird corner cases involving
+ // singly letters.
+ assertStripWS(" a", "a");
+ assertStripWS("a ", "a");
+ assertStripWS(" a ", "a");
+ }
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(MiscTest);
More information about the Aptitude-svn-commit
mailing list