1void test_glist () { 2 var list = new GLib.List<string> (); 3 list.prepend ("foo"); 4 list.prepend ("bar"); 5 assert (list.nth_data (1) == "foo"); 6 list = null; 7 8 var list2 = new GLib.List<unowned string> (); 9 list2.prepend ("foo"); 10 list2.prepend ("bar"); 11 assert (list2.nth_data (1) == "foo"); 12 list2 = null; 13} 14 15void test_gslist () { 16 var list = new GLib.SList<string> (); 17 list.prepend ("foo"); 18 list.prepend ("bar"); 19 assert (list.nth_data (1) == "foo"); 20 list = null; 21 22 var list2 = new GLib.SList<unowned string> (); 23 list2.prepend ("foo"); 24 list2.prepend ("bar"); 25 assert (list2.nth_data (1) == "foo"); 26 list2 = null; 27} 28 29void test_gqueue () { 30 var queue = new GLib.Queue<string> (); 31 queue.push_head ("foo"); 32 queue.push_head ("bar"); 33 assert (queue.peek_nth (1) == "foo"); 34 queue = null; 35 36 var queue2 = new GLib.Queue<unowned string> (); 37 queue2.push_head ("foo"); 38 queue2.push_head ("bar"); 39 assert (queue2.peek_nth (1) == "foo"); 40 queue2 = null; 41} 42 43void test_gnode () { 44 var nodes = new GLib.Node<string> (); 45 nodes.append_data ("foo"); 46 nodes.append_data ("bar"); 47 assert (nodes.nth_child (1).data == "bar"); 48 nodes = null; 49 50 var nodes2 = new GLib.Node<unowned string> (); 51 nodes2.append_data ("foo"); 52 nodes2.append_data ("bar"); 53 assert (nodes2.nth_child (1).data == "bar"); 54 nodes2 = null; 55} 56 57void main () { 58 test_glist (); 59 test_gslist (); 60 test_gqueue (); 61 test_gnode (); 62} 63