aboutsummaryrefslogtreecommitdiff
path: root/src/tests/listsort.cpp
blob: 4873a053467fb128b2f28c795e4873b8f87a243a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/*
 * Copyright (C) 2007-2011 Xagasoft, All rights reserved.
 *
 * This file is part of the libbu++ library and is released under the
 * terms of the license contained in the file LICENSE.
 */

#include <bu/list.h>
#include <bu/sio.h>
#include <bu/string.h>

using namespace Bu;

int main()
{
	/*
	List<int> il;
	il.append( 5 );
	il.append( 12 );
	il.append( 0 );
	il.append( 7 );
	il.append( 3 );
	il.append( 5 );
	Bu::__basicLTCmp<int> cmp;
	il.sortI( cmp );
	*/

	String a("Soggy"), b("Sam");

	if( a < b )
	{
		sio << "Bad" << sio.nl;
	}
	else
	{
		sio << "Good" << sio.nl;
	}

	typedef List<String> StrList;

	StrList lNames;

	lNames.append("George");
	lNames.append("Sam");
	lNames.append("Abby");
	lNames.append("Zorro");
	lNames.append("Brianna");
	lNames.append("Kate");
	lNames.append("Soggy");

	sio << "Names: " << lNames << sio.nl;
	lNames.sort();
	
	sio << "Names: " << lNames << sio.nl;

	StrList lNames2;
	
	lNames2.insertSorted("George");
	lNames2.insertSorted("Sam");
	lNames2.insertSorted("Abby");
	lNames2.insertSorted("Zorro");
	lNames2.insertSorted("Brianna");
	lNames2.insertSorted("Kate");
	lNames2.insertSorted("Soggy");

	sio << "Names: " << lNames2 << sio.nl;

	if( lNames == lNames2 )
	{
		sio << "They're the same." << sio.nl;
	}
	else
	{
		sio << "They're different." << sio.nl;
	}

	return 0;
}