3 * Copyright (C) 2008 Jürg Billeter
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 * Jürg Billeter <j@bitron.ch>
21 * Mark Lee <marklee@src.gnome.org> (port to LinkedList)
22 * Julien Peeters <contact@julienpeeters.fr>
27 public class LinkedListTests : BidirListTests {
29 public LinkedListTests () {
31 add_test ("[LinkedList] sort", test_sort);
34 public override void set_up () {
35 test_collection = new LinkedList<string> ();
38 public override void tear_down () {
39 test_collection = null;
42 private void test_sort () {
43 var test_list = test_collection as LinkedList<string>;
45 // Check the collection exists
46 assert (test_list != null);
48 test_list.add ("one");
49 test_list.add ("two");
50 test_list.add ("three");
51 test_list.add ("four");
52 test_list.add ("five");
53 test_list.add ("six");
54 test_list.add ("seven");
55 test_list.add ("eight");
56 test_list.add ("nine");
57 test_list.add ("ten");
58 test_list.add ("eleven");
59 test_list.add ("twelve");
63 assert (test_list.get (0) == "eight");
64 assert (test_list.get (1) == "eleven");
65 assert (test_list.get (2) == "five");
66 assert (test_list.get (3) == "four");
67 assert (test_list.get (4) == "nine");
68 assert (test_list.get (5) == "one");
69 assert (test_list.get (6) == "seven");
70 assert (test_list.get (7) == "six");
71 assert (test_list.get (8) == "ten");
72 assert (test_list.get (9) == "three");
73 assert (test_list.get (10) == "twelve");
74 assert (test_list.get (11) == "two");