summaryrefslogtreecommitdiff
path: root/tests/test_misc.cc
diff options
context:
space:
mode:
authorDaniel Burrows <Daniel_Burrows@alumni.brown.edu>2007-03-10 18:08:57 +0000
committerDaniel Burrows <Daniel_Burrows@alumni.brown.edu>2007-03-10 18:08:57 +0000
commitd8af56781594f1283ba93873f9d5780e69e7ff39 (patch)
tree150fb4d59a5e1bcb6506e8b9d6836be94fd4a940 /tests/test_misc.cc
parent704403d970ade12a13215669328fa329111ccc1a (diff)
downloadaptitude-d8af56781594f1283ba93873f9d5780e69e7ff39.tar.gz
[aptitude @ Add a test that ssprintf works when the string being formed gets long (current version dies horribly!)]
Diffstat (limited to 'tests/test_misc.cc')
-rw-r--r--tests/test_misc.cc13
1 files changed, 12 insertions, 1 deletions
diff --git a/tests/test_misc.cc b/tests/test_misc.cc
index 1adb77d0..1202de6c 100644
--- a/tests/test_misc.cc
+++ b/tests/test_misc.cc
@@ -1,6 +1,6 @@
// Miscellaneous tests.
//
-// Copyright (C) 2005 Daniel Burrows
+// Copyright (C) 2005, 2007 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
@@ -27,6 +27,7 @@ class MiscTest : public CppUnit::TestFixture
CPPUNIT_TEST(testStripWS);
CPPUNIT_TEST(testOrderlessLt);
+ CPPUNIT_TEST(test_ssprintf);
CPPUNIT_TEST_SUITE_END();
private:
@@ -94,6 +95,16 @@ private:
CPPUNIT_ASSERT(!cmp(d, c));
CPPUNIT_ASSERT(!cmp(e, d));
}
+
+ void test_ssprintf()
+ {
+ // Test that inserting very long strings via ssprintf actually works.
+ std::string horriblelongthing = "abcdefghijklmnopqrstuvwxyz";
+ while(horriblelongthing.size() < 4096)
+ horriblelongthing += horriblelongthing;
+
+ CPPUNIT_ASSERT_EQUAL(horriblelongthing + " 20", ssprintf("%s %d", horriblelongthing.c_str(), 20));
+ }
};
CPPUNIT_TEST_SUITE_REGISTRATION(MiscTest);