Sha256: bdbe8e84aa4012a0b6ed546a426f2bab41abc9019d278909f035059f741d01f5

Contents?: true

Size: 1.29 KB

Versions: 135

Compression:

Stored size: 1.29 KB

Contents

#include <vector>
#include <algorithm>

#include "cppunit/cppunit_proxy.h"

#if !defined (STLPORT) || defined(_STLP_USE_NAMESPACES)
using namespace std;
#endif

//
// TestCase class
//
class BinsertTest : public CPPUNIT_NS::TestCase
{
  CPPUNIT_TEST_SUITE(BinsertTest);
  CPPUNIT_TEST(binsert1);
  CPPUNIT_TEST(binsert2);
  CPPUNIT_TEST_SUITE_END();

protected:
  void binsert1();
  void binsert2();
};

CPPUNIT_TEST_SUITE_REGISTRATION(BinsertTest);

//
// tests implementation
//
void BinsertTest::binsert1()
{
  char* array [] = { "laurie", "jennifer", "leisa" };
  vector<char*> names;
  back_insert_iterator<vector<char*> > bit(names);
  bit = copy(array, array + 3, back_insert_iterator<vector <char*> >(names));

  CPPUNIT_ASSERT(!strcmp(names[0],array[0]));
  CPPUNIT_ASSERT(!strcmp(names[1],array[1]));
  CPPUNIT_ASSERT(!strcmp(names[2],array[2]));

  copy(array, array + 3, bit);
  CPPUNIT_ASSERT(!strcmp(names[3],array[0]));
  CPPUNIT_ASSERT(!strcmp(names[4],array[1]));
  CPPUNIT_ASSERT(!strcmp(names[5],array[2]));
}
void BinsertTest::binsert2()
{
  char* array [] = { "laurie", "jennifer", "leisa" };
  vector<char*> names;
  copy(array, array + 3, back_inserter(names));
  CPPUNIT_ASSERT(!strcmp(names[0],array[0]));
  CPPUNIT_ASSERT(!strcmp(names[1],array[1]));
  CPPUNIT_ASSERT(!strcmp(names[2],array[2]));
}

Version data entries

135 entries across 135 versions & 2 rubygems

Version Path
rhodes-7.6.0 platform/shared/stlport/test/unit/binsert_test.cpp
rhodes-7.5.1 platform/shared/stlport/test/unit/binsert_test.cpp
rhodes-7.4.1 platform/shared/stlport/test/unit/binsert_test.cpp
rhodes-7.1.17 platform/shared/stlport/test/unit/binsert_test.cpp
rhodes-6.2.0 platform/shared/stlport/test/unit/binsert_test.cpp
rhodes-6.0.11 platform/shared/stlport/test/unit/binsert_test.cpp
rhodes-5.5.18 platform/shared/stlport/test/unit/binsert_test.cpp
rhodes-5.5.17 platform/shared/stlport/test/unit/binsert_test.cpp
rhodes-5.5.15 platform/shared/stlport/test/unit/binsert_test.cpp
rhodes-5.5.0.22 platform/shared/stlport/test/unit/binsert_test.cpp
rhodes-5.5.2 platform/shared/stlport/test/unit/binsert_test.cpp
rhodes-5.5.0.7 platform/shared/stlport/test/unit/binsert_test.cpp
rhodes-5.5.0.3 platform/shared/stlport/test/unit/binsert_test.cpp
rhodes-5.5.0 platform/shared/stlport/test/unit/binsert_test.cpp
tauplatform-1.0.3 platform/shared/stlport/test/unit/binsert_test.cpp
tauplatform-1.0.2 platform/shared/stlport/test/unit/binsert_test.cpp
tauplatform-1.0.1 platform/shared/stlport/test/unit/binsert_test.cpp
rhodes-3.5.1.12 platform/shared/stlport/test/unit/binsert_test.cpp
rhodes-3.3.5 platform/shared/stlport/test/unit/binsert_test.cpp
rhodes-3.4.2 platform/shared/stlport/test/unit/binsert_test.cpp