// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
// All rights reserved.
// This component and the accompanying materials are made available
// under the terms of "Eclipse Public License v1.0"
// which accompanies this distribution, and is available
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
//
// Initial Contributors:
// Nokia Corporation - initial contribution.
//
// Contributors:
//
// Description:
//

//Has to be first for StackAllocator swap overload to be taken
//into account (at least using GCC 4.0.1)
#include "stack_allocator.h"
#include <e32std.h>
#include <algorithm>
#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
#  include <slist>
#  if !defined (_STLP_USE_NO_IOSTREAMS)
#    include <sstream>
#  endif
#  include <iterator>
#  include <functional>
#endif

#include "cppunit/cppunit_proxy.h"

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

template <class T> class is_odd : public std::unary_function<T, bool> 
{
public:
   bool operator( ) ( T& val ) 
   {
   return ( val % 2 ) == 1;
   }
};

//
// TestCase class
//
class SlistTest : public CPPUNIT_NS::TestCase
{
  CPPUNIT_TEST_SUITE(SlistTest);
#if !defined (STLPORT) || defined (_STLP_NO_EXTENSIONS) || defined (_STLP_USE_NO_IOSTREAMS) 
  CPPUNIT_IGNORE;
#endif
  CPPUNIT_TEST(slist1);
#if defined (STLPORT) && defined (_STLP_USE_NO_IOSTREAMS) 
  CPPUNIT_STOP_IGNORE;
#endif
  CPPUNIT_TEST(erase);
  CPPUNIT_TEST(insert);
  CPPUNIT_TEST(splice);
  CPPUNIT_TEST(allocator_with_state);
  CPPUNIT_TEST(slist_cov1);
  CPPUNIT_TEST(slist_cov2);
  CPPUNIT_TEST(slist_cov3);
  CPPUNIT_TEST_SUITE_END();

protected:
  void slist1();
  void erase();
  void insert();
  void splice();
  void allocator_with_state();
  void slist_cov1();
  void slist_cov2();
  void slist_cov3();
};

CPPUNIT_TEST_SUITE_REGISTRATION(SlistTest);

//
// tests implementation
//
void SlistTest::slist1()
{
#if defined (STLPORT) && !defined (_STLP_USE_NO_IOSTREAMS) && !defined (_STLP_NO_EXTENSIONS)
/*
original: xlxtss
reversed: sstxlx
removed: sstl
uniqued: stl
sorted: lst
*/

  char array [] = { 'x', 'l', 'x', 't', 's', 's' };
  ostringstream os;
  ostream_iterator<char> o(os,"");
  slist<char> str(array+0, array + 6);
  slist<char>::iterator i;
  //Check const_iterator construction from iterator
  slist<char>::const_iterator ci(i);
  slist<char>::const_iterator ci2(ci);
//  cout << "reversed: ";
  str.reverse();
  for(i = str.begin(); i != str.end(); i++)
    os << *i;
  stringbuf* buff=os.rdbuf();
  string result=buff->str();
  CPPUNIT_ASSERT(!strcmp(result.c_str(),"sstxlx"));

  //cout << "removed: ";
  str.remove('x');
  ostringstream os2;
  for(i = str.begin(); i != str.end(); i++)
    os2 << *i;
  buff=os2.rdbuf();
  result=buff->str();
  CPPUNIT_ASSERT(!strcmp(result.c_str(),"sstl"));


  //cout << "uniqued: ";
  str.unique();
  ostringstream os3;
  for(i = str.begin(); i != str.end(); i++)
    os3 << *i;
  buff=os3.rdbuf();
  result=buff->str();
  CPPUNIT_ASSERT(!strcmp(result.c_str(),"stl"));

  //cout << "sorted: ";
  str.sort();
  ostringstream os4;
  for(i = str.begin(); i != str.end(); i++)
    os4 << *i;
  buff = os4.rdbuf();
  result = buff->str();
  CPPUNIT_ASSERT(!strcmp(result.c_str(),"lst"));

  //A small compilation time check to be activated from time to time:
#  if 0
  {
    slist<char>::iterator sl_char_ite;
    slist<int>::iterator sl_int_ite;
    CPPUNIT_ASSERT( sl_char_ite != sl_int_ite );
  }
#  endif
#endif
}

void SlistTest::erase()
{
#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
  int array[] = { 0, 1, 2, 3, 4 };
  slist<int> sl(array, array + 5);
  slist<int>::iterator slit;

  slit = sl.erase(sl.begin());
  CPPUNIT_ASSERT( *slit == 1);

  ++slit++; ++slit;
  slit = sl.erase(sl.begin(), slit);
  CPPUNIT_ASSERT( *slit == 3 );

  sl.assign(array, array + 5);

  slit = sl.erase_after(sl.begin());
  CPPUNIT_ASSERT( *slit == 2 );

  slit = sl.begin(); ++slit; ++slit;
  slit = sl.erase_after(sl.begin(), slit);
  CPPUNIT_ASSERT( *slit == 3 );

  sl.erase_after(sl.before_begin());
  CPPUNIT_ASSERT( sl.front() == 3 );
#endif
}

void SlistTest::insert()
{
#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
  int array[] = { 0, 1, 2, 3, 4 };

  //insert
  {
    slist<int> sl;

    sl.insert(sl.begin(), 5);
    CPPUNIT_ASSERT( sl.front() == 5 );
    CPPUNIT_ASSERT( sl.size() == 1 );

    //debug mode check:
    //sl.insert(sl.before_begin(), array, array + 5);

    sl.insert(sl.begin(), array, array + 5);
    CPPUNIT_ASSERT( sl.size() == 6 );
    int i;
    slist<int>::iterator slit(sl.begin());
    for (i = 0; slit != sl.end(); ++slit, ++i) {
      CPPUNIT_ASSERT( *slit == i );
    }
  }

  //insert_after
  {
    slist<int> sl;

    //debug check:
    //sl.insert_after(sl.begin(), 5);

    sl.insert_after(sl.before_begin(), 5);
    CPPUNIT_ASSERT( sl.front() == 5 );
    CPPUNIT_ASSERT( sl.size() == 1 );

    sl.insert_after(sl.before_begin(), array, array + 5);
    CPPUNIT_ASSERT( sl.size() == 6 );
    int i;
    slist<int>::iterator slit(sl.begin());
    for (i = 0; slit != sl.end(); ++slit, ++i) {
      CPPUNIT_ASSERT( *slit == i );
    }
  }
#endif
}

void SlistTest::splice()
{
#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
  int array[] = { 0, 1, 2, 3, 4 };

  //splice
  {
    slist<int> sl1(array, array + 5);
    slist<int> sl2(array, array + 5);
    slist<int>::iterator slit;

    //a no op:
    sl1.splice(sl1.begin(), sl1, sl1.begin());
    CPPUNIT_ASSERT( sl1 == sl2 );

    slit = sl1.begin(); ++slit;
    //a no op:
    sl1.splice(slit, sl1, sl1.begin());
    CPPUNIT_ASSERT( sl1 == sl2 );

    sl1.splice(sl1.end(), sl1, sl1.begin());
    slit = sl1.begin();
    CPPUNIT_ASSERT( *(slit++) == 1 );
    CPPUNIT_ASSERT( *(slit++) == 2 );
    CPPUNIT_ASSERT( *(slit++) == 3 );
    CPPUNIT_ASSERT( *(slit++) == 4 );
    CPPUNIT_ASSERT( *slit == 0 );
    sl1.splice(sl1.begin(), sl1, slit);
    CPPUNIT_ASSERT( sl1 == sl2 );

    sl1.splice(sl1.begin(), sl2);
    size_t i;
    for (i = 0, slit = sl1.begin(); slit != sl1.end(); ++slit, ++i) {
      if (i == 5) i = 0;
      CPPUNIT_ASSERT( *slit == array[i] );
    }

    slit = sl1.begin();
    advance(slit, 5);
    CPPUNIT_ASSERT( *slit == 0 );
    sl2.splice(sl2.begin(), sl1, sl1.begin(), slit);
    CPPUNIT_ASSERT( sl1 == sl2 );

    slit = sl1.begin(); ++slit;
    sl1.splice(sl1.begin(), sl1, slit, sl1.end());
    slit = sl1.begin();
    CPPUNIT_ASSERT( *(slit++) == 1 );
    CPPUNIT_ASSERT( *(slit++) == 2 );
    CPPUNIT_ASSERT( *(slit++) == 3 );
    CPPUNIT_ASSERT( *(slit++) == 4 );
    CPPUNIT_ASSERT( *slit == 0 );

    // a no op
    sl2.splice(sl2.end(), sl2, sl2.begin(), sl2.end());
    for (i = 0, slit = sl2.begin(); slit != sl2.end(); ++slit, ++i) {
      CPPUNIT_ASSERT( i < 5 );
      CPPUNIT_ASSERT( *slit == array[i] );
    }

    slit = sl2.begin();
    advance(slit, 3);
    sl2.splice(sl2.end(), sl2, sl2.begin(), slit);
    slit = sl2.begin();
    CPPUNIT_ASSERT( *(slit++) == 3 );
    CPPUNIT_ASSERT( *(slit++) == 4 );
    CPPUNIT_ASSERT( *(slit++) == 0 );
    CPPUNIT_ASSERT( *(slit++) == 1 );
    CPPUNIT_ASSERT( *slit == 2 );
  }

  //splice_after
  {
    slist<int> sl1(array, array + 5);
    slist<int> sl2(array, array + 5);
    slist<int>::iterator slit;

    //a no op:
    sl1.splice_after(sl1.begin(), sl1, sl1.begin());
    CPPUNIT_ASSERT( sl1 == sl2 );

    sl1.splice_after(sl1.before_begin(), sl1, sl1.begin());
    slit = sl1.begin();
    CPPUNIT_ASSERT( *(slit++) == 1 );
    CPPUNIT_ASSERT( *(slit++) == 0 );
    CPPUNIT_ASSERT( *(slit++) == 2 );
    CPPUNIT_ASSERT( *(slit++) == 3 );
    CPPUNIT_ASSERT( *slit == 4 );
    sl1.splice_after(sl1.before_begin(), sl1, sl1.begin());
    CPPUNIT_ASSERT( sl1 == sl2 );

    sl1.splice_after(sl1.before_begin(), sl2);
    size_t i;
    for (i = 0, slit = sl1.begin(); slit != sl1.end(); ++slit, ++i) {
      if (i == 5) i = 0;
      CPPUNIT_ASSERT( *slit == array[i] );
    }

    slit = sl1.begin();
    advance(slit, 4);
    CPPUNIT_ASSERT( *slit == 4 );
    sl2.splice_after(sl2.before_begin(), sl1, sl1.before_begin(), slit);
    CPPUNIT_ASSERT( sl1 == sl2 );

    sl1.splice_after(sl1.before_begin(), sl1, sl1.begin(), sl1.previous(sl1.end()));
    slit = sl1.begin();
    CPPUNIT_ASSERT( *(slit++) == 1 );
    CPPUNIT_ASSERT( *(slit++) == 2 );
    CPPUNIT_ASSERT( *(slit++) == 3 );
    CPPUNIT_ASSERT( *(slit++) == 4 );
    CPPUNIT_ASSERT( *slit == 0 );

    // a no op
    sl2.splice_after(sl2.before_begin(), sl2, sl2.before_begin(), sl2.previous(sl2.end()));
    for (i = 0, slit = sl2.begin(); slit != sl2.end(); ++slit, ++i) {
      CPPUNIT_ASSERT( i < 5 );
      CPPUNIT_ASSERT( *slit == array[i] );
    }

    slit = sl2.begin();
    advance(slit, 2);
    sl2.splice_after(sl2.previous(sl2.end()), sl2, sl2.before_begin(), slit);
    slit = sl2.begin();
    CPPUNIT_ASSERT( *(slit++) == 3 );
    CPPUNIT_ASSERT( *(slit++) == 4 );
    CPPUNIT_ASSERT( *(slit++) == 0 );
    CPPUNIT_ASSERT( *(slit++) == 1 );
    CPPUNIT_ASSERT( *slit == 2 );
  }
#endif
}


void SlistTest::allocator_with_state()
{
#if defined (STLPORT) && !defined (_STLP_NO_EXTENSIONS)
  char buf1[1024];
  StackAllocator<int> stack1(buf1, buf1 + sizeof(buf1));

  char buf2[1024];
  StackAllocator<int> stack2(buf2, buf2 + sizeof(buf2));

  typedef slist<int, StackAllocator<int> > SlistInt;
  {
    SlistInt slint1(10, 0, stack1);
    SlistInt slint1Cpy(slint1);

    SlistInt slint2(10, 1, stack2);
    SlistInt slint2Cpy(slint2);

    slint1.swap(slint2);

    CPPUNIT_ASSERT( slint1.get_allocator().swaped() );
    CPPUNIT_ASSERT( slint2.get_allocator().swaped() );

    CPPUNIT_ASSERT( slint1 == slint2Cpy );
    CPPUNIT_ASSERT( slint2 == slint1Cpy );
    CPPUNIT_ASSERT( slint1.get_allocator() == stack2 );
    CPPUNIT_ASSERT( slint2.get_allocator() == stack1 );
  }
  CPPUNIT_CHECK( stack1.ok() );
  CPPUNIT_CHECK( stack2.ok() );
  stack1.reset(); stack2.reset();

  {
    SlistInt slint1(stack1);
    SlistInt slint1Cpy(slint1);

    SlistInt slint2(10, 1, stack2);
    SlistInt slint2Cpy(slint2);

    slint1.swap(slint2);

    CPPUNIT_ASSERT( slint1.get_allocator().swaped() );
    CPPUNIT_ASSERT( slint2.get_allocator().swaped() );

    CPPUNIT_ASSERT( slint1 == slint2Cpy );
    CPPUNIT_ASSERT( slint2 == slint1Cpy );
    CPPUNIT_ASSERT( slint1.get_allocator() == stack2 );
    CPPUNIT_ASSERT( slint2.get_allocator() == stack1 );
  }
  CPPUNIT_CHECK( stack1.ok() );
  CPPUNIT_CHECK( stack2.ok() );
  stack1.reset(); stack2.reset();

  {
    SlistInt slint1(10, 0, stack1);
    SlistInt slint1Cpy(slint1);

    SlistInt slint2(stack2);
    SlistInt slint2Cpy(slint2);

    slint1.swap(slint2);

    CPPUNIT_ASSERT( slint1.get_allocator().swaped() );
    CPPUNIT_ASSERT( slint2.get_allocator().swaped() );

    CPPUNIT_ASSERT( slint1 == slint2Cpy );
    CPPUNIT_ASSERT( slint2 == slint1Cpy );
    CPPUNIT_ASSERT( slint1.get_allocator() == stack2 );
    CPPUNIT_ASSERT( slint2.get_allocator() == stack1 );
  }
  CPPUNIT_CHECK( stack1.ok() );
  CPPUNIT_CHECK( stack2.ok() );
  stack1.reset(); stack2.reset();

  //splice(iterator, slist)
  {
    SlistInt slint1(10, 0, stack1);
    SlistInt slint2(10, 1, stack2);

    slint1.splice(slint1.begin(), slint2);
    CPPUNIT_ASSERT( slint1.size() == 20 );
    CPPUNIT_ASSERT( slint2.empty() );
  }
  CPPUNIT_CHECK( stack1.ok() );
  CPPUNIT_CHECK( stack2.ok() );
  stack1.reset(); stack2.reset();

  //splice(iterator, slist, iterator)
  {
    SlistInt slint1(10, 0, stack1);
    SlistInt slint2(10, 1, stack2);

    slint1.splice(slint1.begin(), slint2, slint2.begin());
    CPPUNIT_ASSERT( slint1.size() == 11 );
    CPPUNIT_ASSERT( slint2.size() == 9 );
  }
  CPPUNIT_CHECK( stack1.ok() );
  CPPUNIT_CHECK( stack2.ok() );
  stack1.reset(); stack2.reset();

  //splice(iterator, slist, iterator, iterator)
  {
    SlistInt slint1(10, 0, stack1);
    SlistInt slint2(10, 1, stack2);

    SlistInt::iterator lit(slint2.begin());
    advance(lit, 5);
    slint1.splice(slint1.begin(), slint2, slint2.begin(), lit);
    CPPUNIT_ASSERT( slint1.size() == 15 );
    CPPUNIT_ASSERT( slint2.size() == 5 );
  }
  CPPUNIT_CHECK( stack1.ok() );
  CPPUNIT_CHECK( stack2.ok() );
  stack1.reset(); stack2.reset();

  //splice_after(iterator, slist)
  {
    SlistInt slint1(10, 0, stack1);
    SlistInt slint2(10, 1, stack2);

    slint1.splice_after(slint1.before_begin(), slint2);
    CPPUNIT_ASSERT( slint1.size() == 20 );
    CPPUNIT_ASSERT( slint2.empty() );
  }
  CPPUNIT_CHECK( stack1.ok() );
  CPPUNIT_CHECK( stack2.ok() );
  stack1.reset(); stack2.reset();

  //splice_after(iterator, slist, iterator)
  {
    SlistInt slint1(10, 0, stack1);
    SlistInt slint2(10, 1, stack2);

    slint1.splice_after(slint1.before_begin(), slint2, slint2.before_begin());
    CPPUNIT_ASSERT( slint1.size() == 11 );
    CPPUNIT_ASSERT( slint2.size() == 9 );
  }
  CPPUNIT_CHECK( stack1.ok() );
  CPPUNIT_CHECK( stack2.ok() );
  stack1.reset(); stack2.reset();

  //splice_after(iterator, slist, iterator, iterator)
  {
    SlistInt slint1(10, 0, stack1);
    SlistInt slint2(10, 1, stack2);

    SlistInt::iterator lit(slint2.begin());
    advance(lit, 4);
    slint1.splice_after(slint1.before_begin(), slint2, slint2.before_begin(), lit);
    CPPUNIT_ASSERT( slint1.size() == 15 );
    CPPUNIT_ASSERT( slint2.size() == 5 );
  }
  CPPUNIT_CHECK( stack1.ok() );
  CPPUNIT_CHECK( stack2.ok() );
  stack1.reset(); stack2.reset();

  //merge(slist)
  {
    SlistInt slint1(10, 0, stack1);
    SlistInt slint2(10, 1, stack2);

    SlistInt slintref(stack2);
    slintref.insert_after(slintref.before_begin(), 10, 1);
    slintref.insert_after(slintref.before_begin(), 10, 0);

    slint1.merge(slint2);
    CPPUNIT_ASSERT( slint1.size() == 20 );
    CPPUNIT_ASSERT( slint1 == slintref );
    CPPUNIT_ASSERT( slint2.empty() );
  }
  CPPUNIT_CHECK( stack1.ok() );
  CPPUNIT_CHECK( stack2.ok() );

  //merge(slist, predicate)
#  if !defined (STLPORT) || !defined (_STLP_NO_MEMBER_TEMPLATES)
  {
    SlistInt slint1(10, 0, stack1);
    SlistInt slint2(10, 1, stack2);

    SlistInt slintref(stack2);
    slintref.insert_after(slintref.before_begin(), 10, 0);
    slintref.insert_after(slintref.before_begin(), 10, 1);

    slint1.merge(slint2, greater<int>());
    CPPUNIT_ASSERT( slint1.size() == 20 );
    CPPUNIT_ASSERT( slint1 == slintref );
    CPPUNIT_ASSERT( slint2.empty() );
  }
  CPPUNIT_CHECK( stack1.ok() );
  CPPUNIT_CHECK( stack2.ok() );

  //sort
  {
    //This is rather a compile time test.
    //We check that sort implementation is correct when list is instanciated
    //with an allocator that do not have a default constructor.
    SlistInt slint1(stack1);
    slint1.push_front(1);
    slint1.insert_after(slint1.before_begin(), 10, 0);
    slint1.sort(greater<int>());
    CPPUNIT_ASSERT( slint1.front() == 1 );
    slint1.sort();
    SlistInt::iterator slit(slint1.begin());
    advance(slit, 10);
    CPPUNIT_ASSERT( *slit == 1 );
  }
#  endif
#endif
}

void SlistTest::slist_cov1()
	{
	  __UHEAP_MARK;
		{
		char array [] = { 's', 's', 't', 'l'};
		slist<char>::iterator i;
		  
		slist<char> str(array, array + 4);
 	    str.unique(); 
		i = str.begin();
		CPPUNIT_ASSERT(*i=='s');
		i++;
		CPPUNIT_ASSERT(*i=='t');
		i++;
		CPPUNIT_ASSERT(*i=='l');
		str.max_size();
		}
		{
		int array [] = { -10,10,20,-10 };
		slist <int> c1(array,array+4),c3;
		slist <int>::iterator c3_Iter;
		not_equal_to<int> mypred;
		c3=c1;
		c3.unique( mypred );
		c3_Iter = c3.begin( ); 
		CPPUNIT_ASSERT(*c3_Iter == -10 );
		c3_Iter++;
		CPPUNIT_ASSERT(*c3_Iter == -10 );
		}
		  __UHEAP_MARKEND;
	}
void SlistTest::slist_cov2()
	{
	  __UHEAP_MARK;
		{
		slist<int> L;
		slist <int>::iterator c3_Iter;
		L.push_front(0);
		L.push_front(1);
		L.insert_after(L.begin(), 2);
		slist<int>::iterator back = L.previous(L.end());
		back = L.insert_after(back, 3); 
		c3_Iter = L.begin( ); 
		CPPUNIT_ASSERT(*c3_Iter == 1 );
		c3_Iter++;
		CPPUNIT_ASSERT(*c3_Iter == 2 );
		c3_Iter++;
		CPPUNIT_ASSERT(*c3_Iter == 0 );
		c3_Iter++;
		CPPUNIT_ASSERT(*c3_Iter == 3 );
		}
		{
		int array [] = { 10,20,30 };
		slist <int> c1(array,array+3);
		slist <int>::iterator Iter,Iter1;
		slist <int>::const_iterator cIter;
		Iter = c1.begin( );
		Iter++;
		Iter++;
		c1.insert( Iter, 2, 200 );
		Iter1 = c1.begin( );
		CPPUNIT_ASSERT(*Iter1 == 10 );
		Iter1++;
		CPPUNIT_ASSERT(*Iter1 == 20 );
		Iter1++;
		CPPUNIT_ASSERT(*Iter1 == 200 );
		Iter1++;
		CPPUNIT_ASSERT(*Iter1 == 200 );
		Iter1++;
		CPPUNIT_ASSERT(*Iter1 == 30 );
		const int& ii = c1.front( );
		CPPUNIT_ASSERT(ii == 10 );
		cIter = c1.before_begin();
		cIter++;
		CPPUNIT_ASSERT(*cIter == 10 );
		}
		{
		int array [] = { 10,20,30 };
		slist <int> c1(array,array+3);
		slist <int>::iterator Iter1;
		c1.assign( 3, 4 );
		
		Iter1 = c1.begin( );
		CPPUNIT_ASSERT(*Iter1 == 4 );
		Iter1++;
		CPPUNIT_ASSERT(*Iter1 == 4 );
		Iter1++;
		CPPUNIT_ASSERT(*Iter1 == 4 );
		}
		  __UHEAP_MARKEND;
	}
void SlistTest::slist_cov3()
	{
	  __UHEAP_MARK;
		{
		int array [] = { 3,4,5,6,7,8 };
		slist <int> c1(array,array+6),c2;
		slist <int>::iterator Iter1;	
		c2 = c1;
		c2.remove_if( is_odd<int>( ) );
		Iter1 = c2.begin( );
		CPPUNIT_ASSERT(*Iter1 == 4 );
		Iter1++;
		CPPUNIT_ASSERT(*Iter1 == 6 );
		Iter1++;
		CPPUNIT_ASSERT(*Iter1 == 8 );
		}
		{
		int array [] = { 10,20,30 };
		slist <int> c1(array,array+3);
		CPPUNIT_ASSERT(c1.size() ==  3);
		c1.resize(4,40);
		CPPUNIT_ASSERT(c1.size() == 4 );
		}
		{
		int array1 [] = { 10,20,30 };
		int array2 [] = { 100};
		slist <int> c1(array1,array1+3);
		slist <int> c2(array2,array2+3);
		swap(c1,c2);
		slist <int>::iterator Iter1;
		Iter1 = c1.begin( );
		CPPUNIT_ASSERT(*Iter1 == 100 );
		}
		{
		int array1 [] = { 10,20,30 };
		int array2 [] = { 10,20,31};
		slist <int> c1(array1,array1+3);
		slist <int> c2(array2,array2+3);
		bool res = c1 < c2;
		CPPUNIT_ASSERT(res == true);
		}
	  __UHEAP_MARKEND;
	}
