os/ossrv/genericopenlibs/cppstdlib/stl/test/eh/test_push_back.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
/***********************************************************************************
sl@0
     2
  test_push_back.h
sl@0
     3
sl@0
     4
    Interface for the test_push_back class
sl@0
     5
sl@0
     6
 * Copyright (c) 1997
sl@0
     7
 * Mark of the Unicorn, Inc.
sl@0
     8
 *
sl@0
     9
 * Permission to use, copy, modify, distribute and sell this software
sl@0
    10
 * and its documentation for any purpose is hereby granted without fee,
sl@0
    11
 * provided that the above copyright notice appear in all copies and
sl@0
    12
 * that both that copyright notice and this permission notice appear
sl@0
    13
 * in supporting documentation.  Mark of the Unicorn makes no
sl@0
    14
 * representations about the suitability of this software for any
sl@0
    15
 * purpose.  It is provided "as is" without express or implied warranty.
sl@0
    16
sl@0
    17
***********************************************************************************/
sl@0
    18
#ifndef test_push_back_H_
sl@0
    19
#define test_push_back_H_
sl@0
    20
# ifdef EH_NEW_HEADERS
sl@0
    21
#  include <cassert>
sl@0
    22
# else
sl@0
    23
#  include <assert.h>
sl@0
    24
# endif
sl@0
    25
sl@0
    26
# include "Prefix.h"
sl@0
    27
#include "nc_alloc.h"
sl@0
    28
sl@0
    29
template <class C>
sl@0
    30
struct test_push_back
sl@0
    31
{
sl@0
    32
  test_push_back( const C& orig ) : original( orig )
sl@0
    33
  {
sl@0
    34
        gTestController.SetCurrentTestName("push_back() method");
sl@0
    35
    }
sl@0
    36
sl@0
    37
  void operator()( C& c ) const
sl@0
    38
  {
sl@0
    39
      typedef typename C::value_type _value_type;
sl@0
    40
    c.push_back(_value_type() );
sl@0
    41
    // Prevent simulated failures during verification
sl@0
    42
        gTestController.CancelFailureCountdown();
sl@0
    43
    EH_ASSERT( c.size() == original.size() + 1 );
sl@0
    44
    EH_ASSERT( EH_STD::equal( original.begin(), original.end(), c.begin() ) );
sl@0
    45
  }
sl@0
    46
private:
sl@0
    47
  const C& original;
sl@0
    48
};
sl@0
    49
sl@0
    50
#endif // test_push_back_H_