minix/external/bsd/libc++/dist/libcxx/test/containers/sequences/forwardlist/forwardlist.ops/remove.pass.cpp
Lionel Sambuc 4684ddb6aa LLVM Minix changes
- import libcxx
 - reduce targets to the one when compiled as a tools

Change-Id: Iabb8427f80ff8e89463559a28bcb8b4f2bdbc496
2014-07-28 17:05:59 +02:00

118 lines
3 KiB
C++

//===----------------------------------------------------------------------===//
//
// The LLVM Compiler Infrastructure
//
// This file is dual licensed under the MIT and the University of Illinois Open
// Source Licenses. See LICENSE.TXT for details.
//
//===----------------------------------------------------------------------===//
// <forward_list>
// void remove(const value_type& v);
#include <forward_list>
#include <iterator>
#include <cassert>
#include "../../../min_allocator.h"
int main()
{
{
typedef int T;
typedef std::forward_list<T> C;
const T t1[] = {0, 5, 5, 0, 0, 0, 5};
const T t2[] = {5, 5, 5};
C c1(std::begin(t1), std::end(t1));
C c2(std::begin(t2), std::end(t2));
c1.remove(0);
assert(c1 == c2);
}
{
typedef int T;
typedef std::forward_list<T> C;
const T t1[] = {0, 0, 0, 0};
C c1(std::begin(t1), std::end(t1));
C c2;
c1.remove(0);
assert(c1 == c2);
}
{
typedef int T;
typedef std::forward_list<T> C;
const T t1[] = {5, 5, 5};
const T t2[] = {5, 5, 5};
C c1(std::begin(t1), std::end(t1));
C c2(std::begin(t2), std::end(t2));
c1.remove(0);
assert(c1 == c2);
}
{
typedef int T;
typedef std::forward_list<T> C;
C c1;
C c2;
c1.remove(0);
assert(c1 == c2);
}
{
typedef int T;
typedef std::forward_list<T> C;
const T t1[] = {5, 5, 5, 0};
const T t2[] = {5, 5, 5};
C c1(std::begin(t1), std::end(t1));
C c2(std::begin(t2), std::end(t2));
c1.remove(0);
assert(c1 == c2);
}
#if __cplusplus >= 201103L
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
const T t1[] = {0, 5, 5, 0, 0, 0, 5};
const T t2[] = {5, 5, 5};
C c1(std::begin(t1), std::end(t1));
C c2(std::begin(t2), std::end(t2));
c1.remove(0);
assert(c1 == c2);
}
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
const T t1[] = {0, 0, 0, 0};
C c1(std::begin(t1), std::end(t1));
C c2;
c1.remove(0);
assert(c1 == c2);
}
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
const T t1[] = {5, 5, 5};
const T t2[] = {5, 5, 5};
C c1(std::begin(t1), std::end(t1));
C c2(std::begin(t2), std::end(t2));
c1.remove(0);
assert(c1 == c2);
}
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
C c1;
C c2;
c1.remove(0);
assert(c1 == c2);
}
{
typedef int T;
typedef std::forward_list<T, min_allocator<T>> C;
const T t1[] = {5, 5, 5, 0};
const T t2[] = {5, 5, 5};
C c1(std::begin(t1), std::end(t1));
C c2(std::begin(t2), std::end(t2));
c1.remove(0);
assert(c1 == c2);
}
#endif
}