aboutsummaryrefslogtreecommitdiff
path: root/src/unit/list.unit
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-11-12 17:05:30 +0000
committerMike Buland <eichlan@xagasoft.com>2009-11-12 17:05:30 +0000
commit509d136e9adb60c56369565b9545e613cac3678e (patch)
treef118d676edeae2d5e17f48b32b180d4761b60520 /src/unit/list.unit
parent3166bd631a093f42ea44a4b0f4d914cf51518bd4 (diff)
downloadlibbu++-509d136e9adb60c56369565b9545e613cac3678e.tar.gz
libbu++-509d136e9adb60c56369565b9545e613cac3678e.tar.bz2
libbu++-509d136e9adb60c56369565b9545e613cac3678e.tar.xz
libbu++-509d136e9adb60c56369565b9545e613cac3678e.zip
I've started my campaign to clean up all of the header files in libbu++ as far
as includes go. This required a little bit of reworking as far as archive goes, but I've been planning on changing it aronud for a bit anyway. The final result here is that you may need to add some more includes in your own code, libbu++ doesn't include as many random things you didn't ask for anymore, most of these seem to be bu/hash.h, unistd.h, and time.h. Also, any Archive functions and operators should use ArchiveBase when they can instead of Archive, archivebase.h is a much lighterweight include that will be used everywhere in core that it can be, there are a few classes that actually want a specific archiver to be used, they will use it (such as the nids storage class). So far, except for adding header files, nothing has changed in functionality, and no other code changes should be required, although the above mentioned archive changeover is reccomended.
Diffstat (limited to '')
-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