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