StringFormatTest.cc 676 B

1234567891011121314151617181920212223242526272829303132333435
  1. #include "StringFormat.h"
  2. #include "Exception.h"
  3. #include "Util.h"
  4. #include <iostream>
  5. #include <cppunit/extensions/HelperMacros.h>
  6. namespace aria2 {
  7. class StringFormatTest:public CppUnit::TestFixture {
  8. CPPUNIT_TEST_SUITE(StringFormatTest);
  9. CPPUNIT_TEST(testStr);
  10. CPPUNIT_TEST_SUITE_END();
  11. public:
  12. void setUp() {}
  13. void tearDown() {}
  14. void testStr();
  15. };
  16. CPPUNIT_TEST_SUITE_REGISTRATION(StringFormatTest);
  17. void StringFormatTest::testStr()
  18. {
  19. int major = 1;
  20. int minor = 0;
  21. int release = 7;
  22. StringFormat fmt("aria2-%d.%d.%d-%s", major, minor, release, "beta");
  23. CPPUNIT_ASSERT_EQUAL(std::string("aria2-1.0.7-beta"), fmt.str());
  24. }
  25. } // namespace aria2