1 //===----------------------------------------------------------------------===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is dual licensed under the MIT and the University of Illinois Open
6 // Source Licenses. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 // <forward_list>
11 
12 // template <class T, class Allocator>
13 //     bool operator< (const forward_list<T, Allocator>& x,
14 //                     const forward_list<T, Allocator>& y);
15 //
16 // template <class T, class Allocator>
17 //     bool operator> (const forward_list<T, Allocator>& x,
18 //                     const forward_list<T, Allocator>& y);
19 //
20 // template <class T, class Allocator>
21 //     bool operator>=(const forward_list<T, Allocator>& x,
22 //                     const forward_list<T, Allocator>& y);
23 //
24 // template <class T, class Allocator>
25 //     bool operator<=(const forward_list<T, Allocator>& x,
26 //                     const forward_list<T, Allocator>& y);
27 
28 #include <forward_list>
29 #include <iterator>
30 #include <algorithm>
31 #include <cassert>
32 
33 #include "../../../min_allocator.h"
34 
35 template <class C>
36 void test(int N, int M)
37 {
38     typedef typename C::value_type T;
39     C c1;
40     for (int i = 0; i < N; ++i)
41         c1.push_front(i);
42     C c2;
43     for (int i = 0; i < M; ++i)
44         c2.push_front(i);
45     if (N < M)
46         assert(c1 < c2);
47     if (N <= M)
48         assert(c1 <= c2);
49     if (N >= M)
50         assert(c1 >= c2);
51     if (N > M)
52         assert(c1 > c2);
53 }
54 
55 int main()
56 {
57     for (int i = 0; i < 10; ++i)
58         for (int j = 0; j < 10; ++j)
59             test<std::forward_list<int> >(i, j);
60 #if __cplusplus >= 201103L
61     for (int i = 0; i < 10; ++i)
62         for (int j = 0; j < 10; ++j)
63             test<std::forward_list<int, min_allocator<int>> >(i, j);
64 #endif
65 }
66