os/ossrv/genericopenlibs/cppstdlib/stl/test/unit/iota_test.cpp
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
#include <vector>
sl@0
     2
#include <numeric>
sl@0
     3
sl@0
     4
#include "cppunit/cppunit_proxy.h"
sl@0
     5
sl@0
     6
#if defined(_STLP_USE_NAMESPACES)
sl@0
     7
using namespace std;
sl@0
     8
#endif
sl@0
     9
sl@0
    10
//
sl@0
    11
// TestCase class
sl@0
    12
//
sl@0
    13
class IotaTest : public CPPUNIT_NS::TestCase
sl@0
    14
{
sl@0
    15
  CPPUNIT_TEST_SUITE(IotaTest);
sl@0
    16
#if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS)
sl@0
    17
  CPPUNIT_IGNORE;
sl@0
    18
#endif
sl@0
    19
  CPPUNIT_TEST(iota1);
sl@0
    20
  CPPUNIT_TEST_SUITE_END();
sl@0
    21
sl@0
    22
protected:
sl@0
    23
  void iota1();
sl@0
    24
};
sl@0
    25
sl@0
    26
CPPUNIT_TEST_SUITE_REGISTRATION(IotaTest);
sl@0
    27
sl@0
    28
//
sl@0
    29
// tests implementation
sl@0
    30
//
sl@0
    31
void IotaTest::iota1()
sl@0
    32
{
sl@0
    33
#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
sl@0
    34
  int numbers[10];
sl@0
    35
  iota(numbers, numbers + 10, 42);
sl@0
    36
  CPPUNIT_ASSERT(numbers[0]==42);
sl@0
    37
  CPPUNIT_ASSERT(numbers[1]==43);
sl@0
    38
  CPPUNIT_ASSERT(numbers[2]==44);
sl@0
    39
  CPPUNIT_ASSERT(numbers[3]==45);
sl@0
    40
  CPPUNIT_ASSERT(numbers[4]==46);
sl@0
    41
  CPPUNIT_ASSERT(numbers[5]==47);
sl@0
    42
  CPPUNIT_ASSERT(numbers[6]==48);
sl@0
    43
  CPPUNIT_ASSERT(numbers[7]==49);
sl@0
    44
  CPPUNIT_ASSERT(numbers[8]==50);
sl@0
    45
  CPPUNIT_ASSERT(numbers[9]==51);
sl@0
    46
#endif
sl@0
    47
}