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