aboutsummaryrefslogtreecommitdiff
path: root/test/unit/transform_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/unit/transform_test.cpp')
-rw-r--r--test/unit/transform_test.cpp80
1 files changed, 0 insertions, 80 deletions
diff --git a/test/unit/transform_test.cpp b/test/unit/transform_test.cpp
deleted file mode 100644
index 81649e1..0000000
--- a/test/unit/transform_test.cpp
+++ /dev/null
@@ -1,80 +0,0 @@
-#include <string>
-#include <iterator>
-#include <vector>
-#include <algorithm>
-
-#include "cppunit/cppunit_proxy.h"
-
-#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
-using namespace std;
-#endif
-
-//
-// TestCase class
-//
-class TransformTest : public CPPUNIT_NS::TestCase
-{
- CPPUNIT_TEST_SUITE(TransformTest);
- CPPUNIT_TEST(trnsfrm1);
- CPPUNIT_TEST(trnsfrm2);
- CPPUNIT_TEST(self_str);
- CPPUNIT_TEST_SUITE_END();
-
-protected:
- void trnsfrm1();
- void trnsfrm2();
- void self_str();
-
- static int negate_int(int a_) {
- return -a_;
- }
- static char map_char(char a_, int b_) {
- return char(a_ + b_);
- }
- static char shift( char c ) {
- return char(((int)c + 1) % 256);
- }
-};
-
-CPPUNIT_TEST_SUITE_REGISTRATION(TransformTest);
-
-//
-// tests implementation
-//
-void TransformTest::trnsfrm1()
-{
- int numbers[6] = { -5, -1, 0, 1, 6, 11 };
-
- int result[6];
- transform((int*)numbers, (int*)numbers + 6, (int*)result, negate_int);
-
- CPPUNIT_ASSERT(result[0]==5);
- CPPUNIT_ASSERT(result[1]==1);
- CPPUNIT_ASSERT(result[2]==0);
- CPPUNIT_ASSERT(result[3]==-1);
- CPPUNIT_ASSERT(result[4]==-6);
- CPPUNIT_ASSERT(result[5]==-11);
-}
-void TransformTest::trnsfrm2()
-{
-#if defined (__MVS__)
- int trans[] = {-11, 4, -6, -6, -18, 0, 18, -14, 6, 0, -1, -59};
-#else
- int trans[] = {-4, 4, -6, -6, -10, 0, 10, -6, 6, 0, -1, -77};
-#endif
- char n[] = "Larry Mullen";
- const size_t count = ::strlen(n);
-
- string res;
- transform(n, n + count, trans, back_inserter(res), map_char);
- CPPUNIT_ASSERT( res == "Hello World!" )
-}
-
-void TransformTest::self_str()
-{
- string s( "0123456789abcdefg" );
- string r( "123456789:bcdefgh" );
- transform( s.begin(), s.end(), s.begin(), shift );
- CPPUNIT_ASSERT( s == r );
-}
-