From 9f7b71ac576375e9bbaf30e963d50b6ff4420ab7 Mon Sep 17 00:00:00 2001 From: Andreas Waidler Date: Sat, 6 Aug 2011 22:58:06 +0200 Subject: [PATCH] Removed redundancy in test suite naming. --- tests/{TestException.cxx => Exception.cxx} | 22 +++++++++++----------- tests/{TestException.hxx => Exception.hxx} | 10 +++++----- tests/{TestUtility.cxx => Utility.cxx} | 28 ++++++++++++++-------------- tests/{TestUtility.hxx => Utility.hxx} | 10 +++++----- tests/registry.cxx | 8 ++++---- 5 files changed, 39 insertions(+), 39 deletions(-) rename tests/{TestException.cxx => Exception.cxx} (77%) rename tests/{TestException.hxx => Exception.hxx} (83%) rename tests/{TestUtility.cxx => Utility.cxx} (77%) rename tests/{TestUtility.hxx => Utility.hxx} (90%) diff --git a/tests/TestException.cxx b/tests/Exception.cxx similarity index 77% rename from tests/TestException.cxx rename to tests/Exception.cxx index aad236b..c956c0d 100644 --- a/tests/TestException.cxx +++ b/tests/Exception.cxx @@ -1,11 +1,11 @@ -#include +#include #include #include #include #include -void tests::TestException::testCopyingOfShortMessage() +void tests::Exception::testCopyingOfShortMessage() { char* const cstr = new char[80]; strcpy(cstr, "TEST0001"); @@ -17,7 +17,7 @@ void tests::TestException::testCopyingOfShortMessage() CPPUNIT_ASSERT_EQUAL(exp, act); } -void tests::TestException::testWhetherLongMessageDoesNotOverflow() +void tests::Exception::testWhetherLongMessageDoesNotOverflow() { size_t length = libsex::Exception::LENGTH; std::string str; @@ -36,7 +36,7 @@ void tests::TestException::testWhetherLongMessageDoesNotOverflow() } } -void tests::TestException::testWhetherPreviousExceptionIsCloned() +void tests::Exception::testWhetherPreviousExceptionIsCloned() { CPPUNIT_ASSERT_EQUAL(0, CountingException::instances); CountingException e1("e1"); @@ -45,7 +45,7 @@ void tests::TestException::testWhetherPreviousExceptionIsCloned() CPPUNIT_ASSERT_EQUAL(2, CountingException::instances); } -void tests::TestException::testWhetherClonedExceptionIsDeleted() +void tests::Exception::testWhetherClonedExceptionIsDeleted() { CPPUNIT_ASSERT_EQUAL(0, CountingException::instances); @@ -58,13 +58,13 @@ void tests::TestException::testWhetherClonedExceptionIsDeleted() CPPUNIT_ASSERT_EQUAL(1, CountingException::instances); } -void tests::TestException::testWhetherBadAllocOnCloneIsSwallowed() +void tests::Exception::testWhetherBadAllocOnCloneIsSwallowed() { UncloneableException e1; libsex::Exception e2("e2", e1); } -void tests::TestException::testWhetherNoticeIsAppendedOnBadAlloc() +void tests::Exception::testWhetherNoticeIsAppendedOnBadAlloc() { UncloneableException e1; libsex::Exception e2("e2", e1); @@ -77,7 +77,7 @@ void tests::TestException::testWhetherNoticeIsAppendedOnBadAlloc() CPPUNIT_ASSERT_EQUAL(exp, act); } -void tests::TestException::testWhetherNoticeDoesNotOverflowIfBufferTooSmall() +void tests::Exception::testWhetherNoticeDoesNotOverflowIfBufferTooSmall() { size_t length = libsex::Exception::LENGTH; std::string str; @@ -93,9 +93,9 @@ void tests::TestException::testWhetherNoticeDoesNotOverflowIfBufferTooSmall() CPPUNIT_ASSERT_EQUAL(str, std::string(e2.what())); } -void tests::TestException::testWritingToStream() +void tests::Exception::testWritingToStream() { - std::string exp("TestException"); + std::string exp("Exception"); libsex::Exception e(exp.c_str()); std::stringstream act; @@ -104,7 +104,7 @@ void tests::TestException::testWritingToStream() CPPUNIT_ASSERT_EQUAL(exp, act.str()); } -void tests::TestException::testBacktrace() +void tests::Exception::testBacktrace() { libsex::Exception cause("Failed to foo."); libsex::Exception e("Failed to bar.", cause); diff --git a/tests/TestException.hxx b/tests/Exception.hxx similarity index 83% rename from tests/TestException.hxx rename to tests/Exception.hxx index 19ff153..b4966ff 100644 --- a/tests/TestException.hxx +++ b/tests/Exception.hxx @@ -1,16 +1,16 @@ -#ifndef TESTS_TESTEXCEPTION_HXX -#define TESTS_TESTEXCEPTION_HXX +#ifndef TESTS_EXCEPTION_HXX +#define TESTS_EXCEPTION_HXX #include namespace tests { - class TestException; + class Exception; } -class tests::TestException : public CppUnit::TestFixture +class tests::Exception : public CppUnit::TestFixture { -CPPUNIT_TEST_SUITE(TestException); +CPPUNIT_TEST_SUITE(Exception); CPPUNIT_TEST(testCopyingOfShortMessage); CPPUNIT_TEST(testWhetherLongMessageDoesNotOverflow); CPPUNIT_TEST(testWhetherPreviousExceptionIsCloned); diff --git a/tests/TestUtility.cxx b/tests/Utility.cxx similarity index 77% rename from tests/TestUtility.cxx rename to tests/Utility.cxx index fbc3c78..6d1c4f7 100644 --- a/tests/TestUtility.cxx +++ b/tests/Utility.cxx @@ -1,11 +1,11 @@ -#include +#include #include #include #include -void tests::TestUtility::testShortTemplateWithoutFormatting() +void tests::Utility::testShortTemplateWithoutFormatting() { char buf[100] = { 0 }; @@ -19,7 +19,7 @@ void tests::TestUtility::testShortTemplateWithoutFormatting() CPPUNIT_ASSERT_EQUAL(exp, std::string(buf)); } -void tests::TestUtility::testWhetherFalseIsReturnedWhenHeaderFillsBuffer() +void tests::Utility::testWhetherFalseIsReturnedWhenHeaderFillsBuffer() { char buf[100] = { 0 }; @@ -33,7 +33,7 @@ void tests::TestUtility::testWhetherFalseIsReturnedWhenHeaderFillsBuffer() CPPUNIT_ASSERT_EQUAL(exp, std::string(buf)); } -void tests::TestUtility::testWhetherTrueIsReturnedOnExactFit() +void tests::Utility::testWhetherTrueIsReturnedOnExactFit() { char buf[100] = { 0 }; @@ -47,7 +47,7 @@ void tests::TestUtility::testWhetherTrueIsReturnedOnExactFit() CPPUNIT_ASSERT_EQUAL(exp, std::string(buf)); } -void tests::TestUtility::testWhetherUnformattedOverflowsArePrevented() +void tests::Utility::testWhetherUnformattedOverflowsArePrevented() { // Array should be large enough to not really get // overwritten. Just adjust the parameter 'length' @@ -63,7 +63,7 @@ void tests::TestUtility::testWhetherUnformattedOverflowsArePrevented() assertBoundary(buf, 10, 100); } -void tests::TestUtility::testWhetherSimpleFormattingWorks() +void tests::Utility::testWhetherSimpleFormattingWorks() { char buf[100] = { 0 }; @@ -77,7 +77,7 @@ void tests::TestUtility::testWhetherSimpleFormattingWorks() CPPUNIT_ASSERT_EQUAL(exp, std::string(buf)); } -void tests::TestUtility::testWhetherFormattedOverflowsArePreventedBeforeFormatstring() +void tests::Utility::testWhetherFormattedOverflowsArePreventedBeforeFormatstring() { // Array should be large enough to not really get // overwritten. Just adjust the parameter 'length' @@ -93,7 +93,7 @@ void tests::TestUtility::testWhetherFormattedOverflowsArePreventedBeforeFormatst assertBoundary(buf, 10, 100); } -void tests::TestUtility::testWhetherFormattedOverflowsArePreventedInFormatstring() +void tests::Utility::testWhetherFormattedOverflowsArePreventedInFormatstring() { // Array should be large enough to not really get // overwritten. Just adjust the parameter 'length' @@ -109,7 +109,7 @@ void tests::TestUtility::testWhetherFormattedOverflowsArePreventedInFormatstring assertBoundary(buf, 28, 100); } -void tests::TestUtility::testMultipleFormatParameters() +void tests::Utility::testMultipleFormatParameters() { char buf[100] = { 0 }; @@ -123,7 +123,7 @@ void tests::TestUtility::testMultipleFormatParameters() CPPUNIT_ASSERT_EQUAL(exp, std::string(buf)); } -void tests::TestUtility::testWhetherMultipleParametersDontOverflowBeforeFormatstring() +void tests::Utility::testWhetherMultipleParametersDontOverflowBeforeFormatstring() { char buf[100] = { 0 }; @@ -136,7 +136,7 @@ void tests::TestUtility::testWhetherMultipleParametersDontOverflowBeforeFormatst assertBoundary(buf, 10, 100); } -void tests::TestUtility::testWhetherMultipleParametersDontOverflowInFormatstring() +void tests::Utility::testWhetherMultipleParametersDontOverflowInFormatstring() { char buf[100] = { 0 }; @@ -149,7 +149,7 @@ void tests::TestUtility::testWhetherMultipleParametersDontOverflowInFormatstring assertBoundary(buf, 18, 100); } -void tests::TestUtility::testTemplateFactory() +void tests::Utility::testTemplateFactory() { MockException e = libsex::formatted( @@ -161,7 +161,7 @@ void tests::TestUtility::testTemplateFactory() std::string(e.what())); } -void tests::TestUtility::testChainedTemplateFactory() +void tests::Utility::testChainedTemplateFactory() { MockException e1 = libsex::formatted( @@ -182,7 +182,7 @@ void tests::TestUtility::testChainedTemplateFactory() act.str()); } -void tests::TestUtility::assertBoundary( +void tests::Utility::assertBoundary( const char* const buffer, size_t boundary, size_t length) diff --git a/tests/TestUtility.hxx b/tests/Utility.hxx similarity index 90% rename from tests/TestUtility.hxx rename to tests/Utility.hxx index 7ba30f5..72f7cef 100644 --- a/tests/TestUtility.hxx +++ b/tests/Utility.hxx @@ -1,16 +1,16 @@ -#ifndef TESTS_TESTUTILITY_HXX -#define TESTS_TESTUTILITY_HXX +#ifndef TESTS_UTILITY_HXX +#define TESTS_UTILITY_HXX #include namespace tests { - class TestUtility; + class Utility; } -class tests::TestUtility : public CppUnit::TestFixture +class tests::Utility : public CppUnit::TestFixture { -CPPUNIT_TEST_SUITE(TestUtility); +CPPUNIT_TEST_SUITE(Utility); CPPUNIT_TEST(testShortTemplateWithoutFormatting); CPPUNIT_TEST(testWhetherFalseIsReturnedWhenHeaderFillsBuffer); CPPUNIT_TEST(testWhetherTrueIsReturnedOnExactFit); diff --git a/tests/registry.cxx b/tests/registry.cxx index fc428a7..b111382 100644 --- a/tests/registry.cxx +++ b/tests/registry.cxx @@ -3,11 +3,11 @@ // Registering all unit tests here, to make them // easier to disable and enable. -#include -CPPUNIT_TEST_SUITE_REGISTRATION(tests::TestException); +#include +CPPUNIT_TEST_SUITE_REGISTRATION(tests::Exception); -#include -CPPUNIT_TEST_SUITE_REGISTRATION(tests::TestUtility); +#include +CPPUNIT_TEST_SUITE_REGISTRATION(tests::Utility); #include CPPUNIT_TEST_SUITE_REGISTRATION(tests::UsageExamples); -- 2.11.4.GIT