aboutsummaryrefslogtreecommitdiff
path: root/src/tests/listsort.cpp
blob: 60d9611830e15a78cdd1d4e90dddc9529e1258a1 (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-2010 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/fstring.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 );
	*/

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

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

	typedef List<FString> 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;
}