aboutsummaryrefslogtreecommitdiff
path: root/src/unit/list.unit
diff options
context:
space:
mode:
Diffstat (limited to 'src/unit/list.unit')
-rw-r--r--src/unit/list.unit80
1 files changed, 80 insertions, 0 deletions
diff --git a/src/unit/list.unit b/src/unit/list.unit
index 9da0342..9f66f54 100644
--- a/src/unit/list.unit
+++ b/src/unit/list.unit
@@ -66,3 +66,83 @@ typedef Bu::List<int> IntList;
66 } 66 }
67} 67}
68 68
69{%sort1}
70{
71 IntList lst;
72
73 lst.insertSorted( 5 );
74 lst.insertSorted( 1 );
75 lst.insertSorted( 10 );
76 lst.insertSorted( 3 );
77
78 unitTest( lst == IntList(1).append(3).append(5).append(10) );
79}
80
81{%sort2}
82{
83 IntList lst;
84
85 lst.insertSorted<Bu::__basicGTCmp<int> >( 5 );
86 lst.insertSorted<Bu::__basicGTCmp<int> >( 1 );
87 lst.insertSorted<Bu::__basicGTCmp<int> >( 10 );
88 lst.insertSorted<Bu::__basicGTCmp<int> >( 3 );
89
90 unitTest( lst == IntList(10).append(5).append(3).append(1) );
91}
92
93{%sort3}
94{
95 IntList lst;
96 Bu::__basicGTCmp<int> cmp;
97
98 lst.insertSorted( cmp, 5 );
99 lst.insertSorted( cmp, 1 );
100 lst.insertSorted( cmp, 10 );
101 lst.insertSorted( cmp, 3 );
102
103 unitTest( lst == IntList(10).append(5).append(3).append(1) );
104}
105
106{%sort4}
107{
108 IntList lst;
109
110 lst.append( 5 );
111 lst.append( 1 );
112 lst.append( 10 );
113 lst.append( 3 );
114
115 lst.sort();
116
117 unitTest( lst == IntList(1).append(3).append(5).append(10) );
118}
119
120{%sort5}
121{
122 IntList lst;
123
124 lst.append( 5 );
125 lst.append( 1 );
126 lst.append( 10 );
127 lst.append( 3 );
128
129 lst.sort<Bu::__basicGTCmp<int> >();
130
131 unitTest( lst == IntList(10).append(5).append(3).append(1) );
132}
133
134{%sort6}
135{
136 IntList lst;
137
138 lst.append( 5 );
139 lst.append( 1 );
140 lst.append( 10 );
141 lst.append( 3 );
142
143 Bu::__basicGTCmp<int> x;
144 lst.sort( x );
145
146 unitTest( lst == IntList(10).append(5).append(3).append(1) );
147}
148