[libgee] Make some style consistence enhancements
- From: Didier Villevalois <dvillevalois src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libgee] Make some style consistence enhancements
- Date: Mon, 28 Sep 2009 17:26:54 +0000 (UTC)
commit 1ab9f390c946d64b556de57cdd00208ddd6e54cc
Author: Didier 'Ptitjes <ptitjes free fr>
Date: Mon Sep 28 18:45:58 2009 +0200
Make some style consistence enhancements
benchmark/benchmark.vala | 10 ++--
gee/abstractcollection.vala | 4 +-
gee/abstractmultimap.vala | 2 +-
gee/collection.vala | 22 +++---
gee/iterable.vala | 2 +-
gee/iterator.vala | 2 +-
gee/list.vala | 2 +-
gee/map.vala | 2 +-
gee/mapiterator.vala | 2 +-
gee/multimap.vala | 2 +-
gee/readonlycollection.vala | 4 +-
gee/readonlylist.vala | 2 +-
gee/readonlyset.vala | 2 +-
gee/timsort.vala | 105 ++++++++++++++++---------------
gee/treeset.vala | 6 +-
tests/testarraylist.vala | 2 +-
tests/testcase.vala | 2 +-
tests/testcollection.vala | 60 +++++++++---------
tests/testcomparable.vala | 2 +-
tests/testhashmap.vala | 2 +-
tests/testhashset.vala | 2 +-
tests/testlinkedlist.vala | 2 +-
tests/testmap.vala | 138 +++++++++++++++++++++---------------------
tests/testpriorityqueue.vala | 2 +-
tests/testqueue.vala | 2 +-
tests/testsortedset.vala | 30 +++++-----
tests/testtreemap.vala | 2 +-
27 files changed, 209 insertions(+), 206 deletions(-)
---
diff --git a/benchmark/benchmark.vala b/benchmark/benchmark.vala
index 444ee3a..0aae1a5 100644
--- a/benchmark/benchmark.vala
+++ b/benchmark/benchmark.vala
@@ -63,7 +63,7 @@ namespace Gee.Benchmark {
public void generate_collection (int size, Collection<int32> collection) {
int variance = (int) Math.sqrt (size);
- for(int i = 0; i < size; i++) {
+ for (int i = 0; i < size; i++) {
collection.add (i + GLib.Random.int_range (0, variance) - variance / 2);
}
}
@@ -80,7 +80,7 @@ namespace Gee.Benchmark {
while (index < size) {
int width = GLib.Random.int_range (0, variance);
int height = GLib.Random.int_range (- variance / 2, variance / 2);
- for(int i = 0; i < width; i++) {
+ for (int i = 0; i < width; i++) {
collection.add (last + height / width);
}
index += width;
@@ -94,7 +94,7 @@ namespace Gee.Benchmark {
public string name { get { return "ReverseSorted"; } }
public void generate_collection (int size, Collection<int32> collection) {
- for(int i = 0; i < size; i++) {
+ for (int i = 0; i < size; i++) {
collection.add (size - i - 1);
}
}
@@ -105,7 +105,7 @@ namespace Gee.Benchmark {
public string name { get { return "Sorted"; } }
public void generate_collection (int size, Collection<int32> collection) {
- for(int i = 0; i < size; i++) {
+ for (int i = 0; i < size; i++) {
collection.add (i);
}
}
@@ -171,7 +171,7 @@ namespace Gee.Benchmark {
for (int i = 0; i < sizes.length; i++) {
int size = sizes[i];
for (int j = 0; j < generators.size; j++) {
- Collection<G> collection = factory.create();
+ Collection<G> collection = factory.create ();
generators[j].generate_collection (size, collection);
for (int k = 0; k < algorithms.size; k++) {
diff --git a/gee/abstractcollection.vala b/gee/abstractcollection.vala
index 88d8240..55d8ba3 100644
--- a/gee/abstractcollection.vala
+++ b/gee/abstractcollection.vala
@@ -67,7 +67,7 @@ public abstract class Gee.AbstractCollection<G> : Object, Iterable<G>, Collectio
/**
* { inheritDoc}
*/
- public virtual G[] to_array() {
+ public virtual G[] to_array () {
G[] array = new G[size];
int index = 0;
foreach (G element in this) {
@@ -128,7 +128,7 @@ public abstract class Gee.AbstractCollection<G> : Object, Iterable<G>, Collectio
for (int index = 0; index < size_of_items; index++) {
if (!collection.contains (items[index])) {
changed = changed | remove (items[index]);
- }
+ }
}
return changed;
}
diff --git a/gee/abstractmultimap.vala b/gee/abstractmultimap.vala
index 4020f43..d867607 100644
--- a/gee/abstractmultimap.vala
+++ b/gee/abstractmultimap.vala
@@ -27,7 +27,7 @@
* @see HashMultiMap
* @see TreeMultiMap
*/
-public abstract class Gee.AbstractMultiMap<K,V> : GLib.Object, MultiMap<K,V> {
+public abstract class Gee.AbstractMultiMap<K,V> : Object, MultiMap<K,V> {
public int size {
get { return _nitems; }
}
diff --git a/gee/collection.vala b/gee/collection.vala
index 32dd0ad..c4e9122 100644
--- a/gee/collection.vala
+++ b/gee/collection.vala
@@ -71,21 +71,21 @@ public interface Gee.Collection<G> : Iterable<G> {
/**
* Adds all items in the input collection to this collection.
- *
- * @param collection the collection which items will be added to this
+ *
+ * @param collection the collection which items will be added to this
* collection.
- *
+ *
* @return true if the collection has been changed, false otherwise
*/
public abstract bool add_all (Collection<G> collection);
/**
- * Returns true it this collection contains all items as the input
+ * Returns true it this collection contains all items as the input
* collection.
*
- * @param collection the collection which items will be compared with
+ * @param collection the collection which items will be compared with
* this collection.
- *
+ *
* @return true if the collection has been changed, false otherwise
*/
public abstract bool contains_all (Collection<G> collection);
@@ -95,10 +95,10 @@ public interface Gee.Collection<G> : Iterable<G> {
* elments in the input collection. If there is several occurrences of
* the same value in this collection they are decremented of the number
* of occurrences in the input collection.
- *
+ *
* @param collection the collection which items will be compared with
* this collection.
- *
+ *
* @return true if the collection has been changed, false otherwise
*/
public abstract bool remove_all (Collection<G> collection);
@@ -107,10 +107,10 @@ public interface Gee.Collection<G> : Iterable<G> {
* Removes all items in this collection that are not contained in the input
* collection. In other words all common items of both collections are
* retained in this collection.
- *
- * @param collection the collection which items will be compared with
+ *
+ * @param collection the collection which items will be compared with
* this collection.
- *
+ *
* @return true if the collection has been changed, false otherwise
*/
public abstract bool retain_all (Collection<G> collection);
diff --git a/gee/iterable.vala b/gee/iterable.vala
index bdb3611..a6ef612 100644
--- a/gee/iterable.vala
+++ b/gee/iterable.vala
@@ -25,7 +25,7 @@ using GLib;
/**
* An object that can provide an { link Iterator}.
*/
-public interface Gee.Iterable<G> : GLib.Object {
+public interface Gee.Iterable<G> : Object {
/**
* The type of the elements in this collection.
*/
diff --git a/gee/iterator.vala b/gee/iterator.vala
index bf9deac..078ffb6 100644
--- a/gee/iterator.vala
+++ b/gee/iterator.vala
@@ -34,7 +34,7 @@
* { link remove} are defined and both will fail. After the next call to
* { link next} or { link first}, they will be defined again.
*/
-public interface Gee.Iterator<G> : GLib.Object {
+public interface Gee.Iterator<G> : Object {
/**
* Advances to the next element in the iteration.
*
diff --git a/gee/list.vala b/gee/list.vala
index c6e74e1..3537a05 100644
--- a/gee/list.vala
+++ b/gee/list.vala
@@ -98,7 +98,7 @@ public interface Gee.List<G> : Collection<G> {
public abstract G last ();
/**
- * Inserts items into this list for the input collection at the
+ * Inserts items into this list for the input collection at the
* specified position.
*
* @param index zero-based index of the items to be inserted
diff --git a/gee/map.vala b/gee/map.vala
index 917cff3..987300d 100644
--- a/gee/map.vala
+++ b/gee/map.vala
@@ -23,7 +23,7 @@
/**
* An object that maps keys to values.
*/
-public interface Gee.Map<K,V> : GLib.Object, Iterable<Map.Entry<K,V>> {
+public interface Gee.Map<K,V> : Object, Iterable<Map.Entry<K,V>> {
/**
* The number of items in this map.
*/
diff --git a/gee/mapiterator.vala b/gee/mapiterator.vala
index 230cd77..db614b3 100644
--- a/gee/mapiterator.vala
+++ b/gee/mapiterator.vala
@@ -32,7 +32,7 @@
* will fail. After the next call to { link next} or { link first}, they will
* be defined again.
*/
-public interface Gee.MapIterator<K,V> : GLib.Object {
+public interface Gee.MapIterator<K,V> : Object {
/**
* Advances to the next entry in the iteration.
*
diff --git a/gee/multimap.vala b/gee/multimap.vala
index 4bb40a7..5d6f2b3 100644
--- a/gee/multimap.vala
+++ b/gee/multimap.vala
@@ -23,7 +23,7 @@
/**
* A map with multiple values per key.
*/
-public interface Gee.MultiMap<K,V> : GLib.Object {
+public interface Gee.MultiMap<K,V> : Object {
/**
* The number of key/value pairs in this map.
*/
diff --git a/gee/readonlycollection.vala b/gee/readonlycollection.vala
index 0c1dfe2..54ff850 100644
--- a/gee/readonlycollection.vala
+++ b/gee/readonlycollection.vala
@@ -125,14 +125,14 @@ internal class Gee.ReadOnlyCollection<G> : Object, Iterable<G>, Collection<G> {
/**
* Unimplemented method (read only collection).
*/
- public bool retain_all(Collection<G> collection) {
+ public bool retain_all (Collection<G> collection) {
assert_not_reached ();
}
/**
* { inheritDoc}
*/
- public G[] to_array() {
+ public G[] to_array () {
return _collection.to_array ();
}
diff --git a/gee/readonlylist.vala b/gee/readonlylist.vala
index 8ccb2cf..58d5e9a 100644
--- a/gee/readonlylist.vala
+++ b/gee/readonlylist.vala
@@ -127,7 +127,7 @@ internal class Gee.ReadOnlyList<G> : Gee.ReadOnlyCollection<G>, List<G> {
owned get { return this; }
}
-
+
private class Iterator<G> : ReadOnlyCollection.Iterator<G>, BidirIterator<G>, ListIterator<G> {
public Iterator (ListIterator<G> iterator) {
base (iterator);
diff --git a/gee/readonlyset.vala b/gee/readonlyset.vala
index 71fd2fb..8988e6f 100644
--- a/gee/readonlyset.vala
+++ b/gee/readonlyset.vala
@@ -39,7 +39,7 @@ internal class Gee.ReadOnlySet<G> : Gee.ReadOnlyCollection<G>, Set<G> {
* @param set the set to decorate.
*/
public ReadOnlySet (Set<G> set) {
- base(set);
+ base (set);
}
public virtual new Set<G> read_only_view {
diff --git a/gee/timsort.vala b/gee/timsort.vala
index 465875d..933eb2b 100644
--- a/gee/timsort.vala
+++ b/gee/timsort.vala
@@ -66,7 +66,7 @@ internal class Gee.TimSort<G> : Object {
helper.do_sort ();
- // TODO Use a list iterator and use iter.set(item)
+ // TODO Use a list iterator and use iter.set (item)
list.clear ();
foreach (G item in helper.array) {
list.add (item);
@@ -111,9 +111,10 @@ internal class Gee.TimSort<G> : Object {
// Get the next run
bool descending;
Slice<G>* run = compute_longest_run (remaining, out descending);
-#if DEBUG
- message("New run (%d, %d) %s", run->index, run->length, descending ? "descending" : "ascending");
-#endif
+ #if DEBUG
+ message ("New run (%d, %d) %s", run->index, run->length,
+ descending ? "descending" : "ascending");
+ #endif
if (descending) {
run->reverse ();
}
@@ -123,9 +124,10 @@ internal class Gee.TimSort<G> : Object {
int sorted_count = run->length;
run->length = int.min (minimum_length, remaining->length);
insertion_sort (run, sorted_count);
-#if DEBUG
- message("Extended to (%d, %d) and sorted from index %d", run->index, run->length, sorted_count);
-#endif
+ #if DEBUG
+ message ("Extended to (%d, %d) and sorted from index %d",
+ run->index, run->length, sorted_count);
+ #endif
}
// Move remaining after run
@@ -198,9 +200,9 @@ internal class Gee.TimSort<G> : Object {
}
private void insertion_sort (Slice<G>* a, int offset) {
-#if DEBUG
- message("Sorting (%d, %d) at %d", a->index, a->length, offset);
-#endif
+ #if DEBUG
+ message ("Sorting (%d, %d) at %d", a->index, a->length, offset);
+ #endif
for (int start = a->index + offset; start < a->index + a->length; start++) {
int left = a->index;
int right = start;
@@ -222,17 +224,18 @@ internal class Gee.TimSort<G> : Object {
}
private void merge_collapse () {
-#if DEBUG
- message("Merge Collapse");
-#endif
+ #if DEBUG
+ message ("Merge Collapse");
+ #endif
int count = pending.length;
while (count > 1) {
-#if DEBUG
- message("Pending count: %d", count);
- if (count >= 3) {
- message("pending[count-3]=%p; pending[count-2]=%p; pending[count-1]=%p", pending[count-3], pending[count-2], pending[count-1]);
- }
-#endif
+ #if DEBUG
+ message ("Pending count: %d", count);
+ if (count >= 3) {
+ message ("pending[count-3]=%p; pending[count-2]=%p; pending[count-1]=%p",
+ pending[count-3], pending[count-2], pending[count-1]);
+ }
+ #endif
if (count >= 3 && pending[count-3]->length <= pending[count-2]->length + pending[count-1]->length) {
if (pending[count-3]->length < pending[count-1]->length) {
merge_at (count-3);
@@ -245,20 +248,20 @@ internal class Gee.TimSort<G> : Object {
break;
}
count = pending.length;
-#if DEBUG
- message("New pending count: %d", count);
-#endif
+ #if DEBUG
+ message ("New pending count: %d", count);
+ #endif
}
}
private void merge_force_collapse () {
-#if DEBUG
- message("Merge Force Collapse");
-#endif
+ #if DEBUG
+ message ("Merge Force Collapse");
+ #endif
int count = pending.length;
-#if DEBUG
- message("Pending count: %d", count);
-#endif
+ #if DEBUG
+ message ("Pending count: %d", count);
+ #endif
while (count > 1) {
if (count >= 3 && pending[count-3]->length < pending[count-1]->length) {
merge_at (count-3);
@@ -266,16 +269,16 @@ internal class Gee.TimSort<G> : Object {
merge_at (count-2);
}
count = pending.length;
-#if DEBUG
- message("New pending count: %d", count);
-#endif
+ #if DEBUG
+ message ("New pending count: %d", count);
+ #endif
}
}
private void merge_at (int index) {
-#if DEBUG
- message("Merge at %d", index);
-#endif
+ #if DEBUG
+ message ("Merge at %d", index);
+ #endif
Slice<G>* a = pending[index];
Slice<G>* b = pending[index + 1];
try {
@@ -287,13 +290,13 @@ internal class Gee.TimSort<G> : Object {
pending.move (index + 2, index + 1, pending.length - index - 2);
pending.length -= 1;
- int sorted_count = gallop_rightmost (b->peek_first (), a, 0);
+ int sorted_count = gallop_rightmost (b->peek_first (), a, 0);
a->shorten_start (sorted_count);
if (a->length == 0) {
return;
}
- b->length = gallop_leftmost(a->peek_last (), b, b->length - 1);
+ b->length = gallop_leftmost (a->peek_last (), b, b->length - 1);
if (b->length == 0) {
return;
}
@@ -310,9 +313,9 @@ internal class Gee.TimSort<G> : Object {
}
private int gallop_leftmost (G key, Slice<G>* a, int hint) {
-#if DEBUG
- message("Galop leftmost in (%d, %d), hint=%d", a->index, a->length, hint);
-#endif
+ #if DEBUG
+ message ("Galop leftmost in (%d, %d), hint=%d", a->index, a->length, hint);
+ #endif
assert (0 <= hint);
assert (hint < a->length);
@@ -378,9 +381,9 @@ internal class Gee.TimSort<G> : Object {
}
private int gallop_rightmost (G key, Slice<G>* a, int hint) {
-#if DEBUG
- message("Galop rightmost in (%d, %d), hint=%d", a->index, a->length, hint);
-#endif
+ #if DEBUG
+ message ("Galop rightmost in (%d, %d), hint=%d", a->index, a->length, hint);
+ #endif
assert (0 <= hint);
assert (hint < a->length);
@@ -446,9 +449,9 @@ internal class Gee.TimSort<G> : Object {
}
private void merge_low (Slice<G>* a, Slice<G>* b) {
-#if DEBUG
- message("Merge low (%d, %d) (%d, %d)", a->index, a->length, b->index, b->length);
-#endif
+ #if DEBUG
+ message ("Merge low (%d, %d) (%d, %d)", a->index, a->length, b->index, b->length);
+ #endif
assert (a->length > 0);
assert (b->length > 0);
assert (a->index + a->length == b->index);
@@ -542,9 +545,9 @@ internal class Gee.TimSort<G> : Object {
}
private void merge_high (Slice<G>* a, Slice<G>* b) {
-#if DEBUG
- message("Merge high (%d, %d) (%d, %d)", a->index, a->length, b->index, b->length);
-#endif
+ #if DEBUG
+ message ("Merge high (%d, %d) (%d, %d)", a->index, a->length, b->index, b->length);
+ #endif
assert (a->length > 0);
assert (b->length > 0);
assert (a->index + a->length == b->index);
@@ -655,17 +658,17 @@ internal class Gee.TimSort<G> : Object {
public void copy () {
new_list = new G[length];
- Memory.copy (&new_list[0], &list[index], sizeof(G) * length);
+ Memory.copy (&new_list[0], &list[index], sizeof (G) * length);
list = new_list;
index = 0;
}
public inline void merge_in (G[] dest_array, int index, int dest_index, int count) {
- Memory.move (&dest_array[dest_index], &list[index], sizeof(G) * count);
+ Memory.move (&dest_array[dest_index], &list[index], sizeof (G) * count);
}
public inline void merge_in_reversed (G[] dest_array, int index, int dest_index, int count) {
- Memory.move (&dest_array[dest_index], &list[index], sizeof(G) * count);
+ Memory.move (&dest_array[dest_index], &list[index], sizeof (G) * count);
}
public inline void shorten_start (int n) {
diff --git a/gee/treeset.vala b/gee/treeset.vala
index 6d6b9a8..2cb3ee7 100644
--- a/gee/treeset.vala
+++ b/gee/treeset.vala
@@ -482,8 +482,8 @@ public class Gee.TreeSet<G> : AbstractSet<G>, SortedSet<G> {
private inline uint check_subtree (Node<G>? node) {
if (node == null)
return 0;
- assert (!(is_black (node.left) && is_red (node.right))); // Check left-leaning
- assert (!(is_red (node) && is_red (node.left))); // Check red property
+ assert (! (is_black (node.left) && is_red (node.right))); // Check left-leaning
+ assert (! (is_red (node) && is_red (node.left))); // Check red property
uint l = check_subtree (node.left);
uint r = check_subtree (node.right);
assert (l == r);
@@ -766,7 +766,7 @@ public class Gee.TreeSet<G> : AbstractSet<G>, SortedSet<G> {
}
public bool in_range (G item) {
- return type == RangeType.EMPTY ? false : compare_range(item) == 0;
+ return type == RangeType.EMPTY ? false : compare_range (item) == 0;
}
public int compare_range (G item) {
diff --git a/tests/testarraylist.vala b/tests/testarraylist.vala
index 888db97..6c649fd 100644
--- a/tests/testarraylist.vala
+++ b/tests/testarraylist.vala
@@ -55,7 +55,7 @@ public class ArrayListTests : ListTests {
assert (test_list.equal_func == str_equal);
}
- public new void test_gobject_properties() {
+ public new void test_gobject_properties () {
var test_list = test_collection as ArrayList<string>;
// Check the list exists
diff --git a/tests/testcase.vala b/tests/testcase.vala
index 2717ab9..edcbe04 100644
--- a/tests/testcase.vala
+++ b/tests/testcase.vala
@@ -20,7 +20,7 @@
* Julien Peeters <contact julienpeeters fr>
*/
-public abstract class Gee.TestCase : GLib.Object {
+public abstract class Gee.TestCase : Object {
private GLib.TestSuite suite;
private Adaptor[] adaptors = new Adaptor[0];
diff --git a/tests/testcollection.vala b/tests/testcollection.vala
index b96654a..682302d 100644
--- a/tests/testcollection.vala
+++ b/tests/testcollection.vala
@@ -28,7 +28,7 @@ using Gee;
public abstract class CollectionTests : Gee.TestCase {
public CollectionTests (string name) {
- base(name);
+ base (name);
add_test ("[Collection] type correctness", test_type_correctness);
add_test ("[Collection] iterator returns all elements once",
test_iterator_returns_all_elements_once);
@@ -262,71 +262,71 @@ public abstract class CollectionTests : Gee.TestCase {
assert (test_collection != null);
// Check the collection is initially empty
- assert (! test_collection.contains("one"));
- assert (! test_collection.contains("two"));
- assert (! test_collection.contains("three"));
+ assert (! test_collection.contains ("one"));
+ assert (! test_collection.contains ("two"));
+ assert (! test_collection.contains ("three"));
assert (test_collection.size == 0);
assert (test_collection.is_empty);
// Add an element
assert (test_collection.add ("one"));
- assert (test_collection.contains("one"));
- assert (! test_collection.contains("two"));
- assert (! test_collection.contains("three"));
+ assert (test_collection.contains ("one"));
+ assert (! test_collection.contains ("two"));
+ assert (! test_collection.contains ("three"));
assert (test_collection.size == 1);
assert (! test_collection.is_empty);
// Remove the added element
assert (test_collection.remove ("one"));
- assert (! test_collection.contains("one"));
- assert (! test_collection.contains("two"));
- assert (! test_collection.contains("three"));
+ assert (! test_collection.contains ("one"));
+ assert (! test_collection.contains ("two"));
+ assert (! test_collection.contains ("three"));
assert (test_collection.size == 0);
assert (test_collection.is_empty);
// Add more elements
assert (test_collection.add ("one"));
- assert (test_collection.contains("one"));
- assert (! test_collection.contains("two"));
- assert (! test_collection.contains("three"));
+ assert (test_collection.contains ("one"));
+ assert (! test_collection.contains ("two"));
+ assert (! test_collection.contains ("three"));
assert (test_collection.size == 1);
assert (! test_collection.is_empty);
assert (test_collection.add ("two"));
- assert (test_collection.contains("one"));
- assert (test_collection.contains("two"));
- assert (! test_collection.contains("three"));
+ assert (test_collection.contains ("one"));
+ assert (test_collection.contains ("two"));
+ assert (! test_collection.contains ("three"));
assert (test_collection.size == 2);
assert (! test_collection.is_empty);
assert (test_collection.add ("three"));
- assert (test_collection.contains("one"));
- assert (test_collection.contains("two"));
- assert (test_collection.contains("three"));
+ assert (test_collection.contains ("one"));
+ assert (test_collection.contains ("two"));
+ assert (test_collection.contains ("three"));
assert (test_collection.size == 3);
assert (! test_collection.is_empty);
// Remove one element
assert (test_collection.remove ("two"));
- assert (test_collection.contains("one"));
- assert (! test_collection.contains("two"));
- assert (test_collection.contains("three"));
+ assert (test_collection.contains ("one"));
+ assert (! test_collection.contains ("two"));
+ assert (test_collection.contains ("three"));
assert (test_collection.size == 2);
assert (! test_collection.is_empty);
// Remove the same element again
assert (! test_collection.remove ("two"));
- assert (test_collection.contains("one"));
- assert (! test_collection.contains("two"));
- assert (test_collection.contains("three"));
+ assert (test_collection.contains ("one"));
+ assert (! test_collection.contains ("two"));
+ assert (test_collection.contains ("three"));
assert (test_collection.size == 2);
assert (! test_collection.is_empty);
// Remove all elements
test_collection.clear ();
- assert (! test_collection.contains("one"));
- assert (! test_collection.contains("two"));
- assert (! test_collection.contains("three"));
+ assert (! test_collection.contains ("one"));
+ assert (! test_collection.contains ("two"));
+ assert (! test_collection.contains ("three"));
assert (test_collection.size == 0);
assert (test_collection.is_empty);
}
@@ -658,7 +658,7 @@ public abstract class CollectionTests : Gee.TestCase {
dummy.clear ();
}
- public void test_to_array() {
+ public void test_to_array () {
// Check the collection exists
assert (test_collection != null);
@@ -678,7 +678,7 @@ public abstract class CollectionTests : Gee.TestCase {
}
}
- public void test_gobject_properties() {
+ public void test_gobject_properties () {
// Check the collection exists
assert (test_collection != null);
Value value;
diff --git a/tests/testcomparable.vala b/tests/testcomparable.vala
index a646176..de5c2ef 100644
--- a/tests/testcomparable.vala
+++ b/tests/testcomparable.vala
@@ -25,7 +25,7 @@ using Gee;
public class ComparableTests : Gee.TestCase {
public ComparableTests () {
- base("Comparable");
+ base ("Comparable");
add_test ("[Comparable] selected functions", test_selected_functions);
}
diff --git a/tests/testhashmap.vala b/tests/testhashmap.vala
index 2c62950..6ea5582 100644
--- a/tests/testhashmap.vala
+++ b/tests/testhashmap.vala
@@ -51,7 +51,7 @@ public class HashMapTests : MapTests {
assert (test_hash_map.value_equal_func == str_equal);
}
- public new void test_gobject_properties() {
+ public new void test_gobject_properties () {
var test_hash_map = test_map as HashMap<string,string>;
// Check the list exists
diff --git a/tests/testhashset.vala b/tests/testhashset.vala
index c724c58..b252c19 100644
--- a/tests/testhashset.vala
+++ b/tests/testhashset.vala
@@ -50,7 +50,7 @@ public class HashSetTests : SetTests {
assert (test_set.equal_func == str_equal);
}
- public new void test_gobject_properties() {
+ public new void test_gobject_properties () {
var test_set = test_collection as HashSet<string>;
// Check the list exists
diff --git a/tests/testlinkedlist.vala b/tests/testlinkedlist.vala
index c30fd8c..737b6e3 100644
--- a/tests/testlinkedlist.vala
+++ b/tests/testlinkedlist.vala
@@ -51,7 +51,7 @@ public class LinkedListTests : ListTests {
assert (test_list.equal_func == str_equal);
}
- public new void test_gobject_properties() {
+ public new void test_gobject_properties () {
var test_list = test_collection as LinkedList<string>;
// Check the list exists
diff --git a/tests/testmap.vala b/tests/testmap.vala
index f69ee66..8a0a38b 100644
--- a/tests/testmap.vala
+++ b/tests/testmap.vala
@@ -121,7 +121,7 @@ public abstract class MapTests : Gee.TestCase {
assert (test_map.size == 3);
assert (! test_map.is_empty);
- // Update an existent binding
+ // Update an existent binding
test_map.set ("two", "value_of_two_new");
assert (test_map.has_key ("one"));
assert (test_map.get ("one") == "value_of_one");
@@ -135,11 +135,11 @@ public abstract class MapTests : Gee.TestCase {
// Remove one element
assert (test_map.unset ("two", out value));
assert (value == "value_of_two_new");
- assert (test_map.has_key("one"));
+ assert (test_map.has_key ("one"));
assert (test_map.get ("one") == "value_of_one");
- assert (! test_map.has_key("two"));
+ assert (! test_map.has_key ("two"));
assert (test_map.get ("two") == null);
- assert (test_map.has_key("three"));
+ assert (test_map.has_key ("three"));
assert (test_map.get ("three") == "value_of_three");
assert (test_map.size == 2);
assert (! test_map.is_empty);
@@ -147,19 +147,19 @@ public abstract class MapTests : Gee.TestCase {
// Remove the same element again
assert (! test_map.unset ("two", out value));
assert (value == null);
- assert (test_map.has_key("one"));
- assert (! test_map.has_key("two"));
- assert (test_map.has_key("three"));
+ assert (test_map.has_key ("one"));
+ assert (! test_map.has_key ("two"));
+ assert (test_map.has_key ("three"));
assert (test_map.size == 2);
assert (! test_map.is_empty);
// Remove all elements
test_map.clear ();
- assert (! test_map.has_key("one"));
+ assert (! test_map.has_key ("one"));
assert (test_map.get ("one") == null);
- assert (! test_map.has_key("two"));
+ assert (! test_map.has_key ("two"));
assert (test_map.get ("two") == null);
- assert (! test_map.has_key("three"));
+ assert (! test_map.has_key ("three"));
assert (test_map.get ("three") == null);
assert (test_map.size == 0);
assert (test_map.is_empty);
@@ -167,21 +167,21 @@ public abstract class MapTests : Gee.TestCase {
public void test_keys () {
// Check keys on empty map
- var keySet = test_map.keys;
- assert (keySet.size == 0);
+ var keys = test_map.keys;
+ assert (keys.size == 0);
// Check keys on map with one item
test_map.set ("one", "value_of_one");
- assert (keySet.size == 1);
- assert (keySet.contains ("one"));
- keySet = test_map.keys;
- assert (keySet.size == 1);
- assert (keySet.contains ("one"));
+ assert (keys.size == 1);
+ assert (keys.contains ("one"));
+ keys = test_map.keys;
+ assert (keys.size == 1);
+ assert (keys.contains ("one"));
// Check modify key set directly
if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
TestTrapFlags.SILENCE_STDERR)) {
- assert (! keySet.add ("three"));
+ assert (! keys.add ("three"));
return;
}
Test.trap_assert_failed ();
@@ -189,38 +189,38 @@ public abstract class MapTests : Gee.TestCase {
// Check keys on map with multiple items
test_map.set ("two", "value_of_two");
- assert (keySet.size == 2);
- assert (keySet.contains ("one"));
- assert (keySet.contains ("two"));
- keySet = test_map.keys;
- assert (keySet.size == 2);
- assert (keySet.contains ("one"));
- assert (keySet.contains ("two"));
+ assert (keys.size == 2);
+ assert (keys.contains ("one"));
+ assert (keys.contains ("two"));
+ keys = test_map.keys;
+ assert (keys.size == 2);
+ assert (keys.contains ("one"));
+ assert (keys.contains ("two"));
// Check keys on map clear
test_map.clear ();
- assert (keySet.size == 0);
- keySet = test_map.keys;
- assert (keySet.size == 0);
+ assert (keys.size == 0);
+ keys = test_map.keys;
+ assert (keys.size == 0);
}
public void test_values () {
// Check keys on empty map
- var valueCollection = test_map.values;
- assert (valueCollection.size == 0);
+ var values = test_map.values;
+ assert (values.size == 0);
// Check keys on map with one item
test_map.set ("one", "value_of_one");
- assert (valueCollection.size == 1);
- assert (valueCollection.contains ("value_of_one"));
- valueCollection = test_map.values;
- assert (valueCollection.size == 1);
- assert (valueCollection.contains ("value_of_one"));
+ assert (values.size == 1);
+ assert (values.contains ("value_of_one"));
+ values = test_map.values;
+ assert (values.size == 1);
+ assert (values.contains ("value_of_one"));
// Check modify key set directly
if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
TestTrapFlags.SILENCE_STDERR)) {
- assert (! valueCollection.add ("two"));
+ assert (! values.add ("two"));
return;
}
Test.trap_assert_failed ();
@@ -228,38 +228,38 @@ public abstract class MapTests : Gee.TestCase {
// Check keys on map with multiple items
test_map.set ("two", "value_of_two");
- assert (valueCollection.size == 2);
- assert (valueCollection.contains ("value_of_one"));
- assert (valueCollection.contains ("value_of_two"));
- valueCollection = test_map.values;
- assert (valueCollection.size == 2);
- assert (valueCollection.contains ("value_of_one"));
- assert (valueCollection.contains ("value_of_two"));
+ assert (values.size == 2);
+ assert (values.contains ("value_of_one"));
+ assert (values.contains ("value_of_two"));
+ values = test_map.values;
+ assert (values.size == 2);
+ assert (values.contains ("value_of_one"));
+ assert (values.contains ("value_of_two"));
// Check keys on map clear
test_map.clear ();
- assert (valueCollection.size == 0);
- valueCollection = test_map.values;
- assert (valueCollection.size == 0);
+ assert (values.size == 0);
+ values = test_map.values;
+ assert (values.size == 0);
}
public void test_entries () {
// Check entries on empty map
- var entryCollection = test_map.entries;
- assert (entryCollection.size == 0);
+ var entries = test_map.entries;
+ assert (entries.size == 0);
// Check entries on map with one item
test_map.set ("one", "value_of_one");
- assert (entryCollection.size == 1);
- assert (entryCollection.contains (new TestEntry<string,string> ("one", "value_of_one")));
- entryCollection = test_map.entries;
- assert (entryCollection.size == 1);
- assert (entryCollection.contains (new TestEntry<string,string> ("one", "value_of_one")));
+ assert (entries.size == 1);
+ assert (entries.contains (new TestEntry<string,string> ("one", "value_of_one")));
+ entries = test_map.entries;
+ assert (entries.size == 1);
+ assert (entries.contains (new TestEntry<string,string> ("one", "value_of_one")));
// Check modify entry set directly
if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
TestTrapFlags.SILENCE_STDERR)) {
- assert (! entryCollection.add (new TestEntry<string,string> ("two", "value_of_two")));
+ assert (! entries.add (new TestEntry<string,string> ("two", "value_of_two")));
return;
}
Test.trap_assert_failed ();
@@ -267,19 +267,19 @@ public abstract class MapTests : Gee.TestCase {
// Check entries on map with multiple items
test_map.set ("two", "value_of_two");
- assert (entryCollection.size == 2);
- assert (entryCollection.contains (new TestEntry<string,string> ("one", "value_of_one")));
- assert (entryCollection.contains (new TestEntry<string,string> ("two", "value_of_two")));
- entryCollection = test_map.entries;
- assert (entryCollection.size == 2);
- assert (entryCollection.contains (new TestEntry<string,string> ("one", "value_of_one")));
- assert (entryCollection.contains (new TestEntry<string,string> ("two", "value_of_two")));
+ assert (entries.size == 2);
+ assert (entries.contains (new TestEntry<string,string> ("one", "value_of_one")));
+ assert (entries.contains (new TestEntry<string,string> ("two", "value_of_two")));
+ entries = test_map.entries;
+ assert (entries.size == 2);
+ assert (entries.contains (new TestEntry<string,string> ("one", "value_of_one")));
+ assert (entries.contains (new TestEntry<string,string> ("two", "value_of_two")));
// Check keys on map clear
test_map.clear ();
- assert (entryCollection.size == 0);
- entryCollection = test_map.entries;
- assert (entryCollection.size == 0);
+ assert (entries.size == 0);
+ entries = test_map.entries;
+ assert (entries.size == 0);
}
public void test_set_all () {
@@ -487,7 +487,7 @@ public abstract class MapTests : Gee.TestCase {
assert (! test_map.has_all (another_map));
}
- public void test_gobject_properties() {
+ public void test_gobject_properties () {
// Check the map exists
assert (test_map != null);
Value value;
@@ -502,15 +502,15 @@ public abstract class MapTests : Gee.TestCase {
assert (value.get_int () == test_map.size);
value.unset ();
}
-
-
-
+
+
+
public class TestEntry<K,V> : Map.Entry<K,V> {
public TestEntry (K key, V value) {
this._key = key;
this.value = value;
}
-
+
public override K key { get {return _key; } }
private K _key;
public override V value { get; set; }
diff --git a/tests/testpriorityqueue.vala b/tests/testpriorityqueue.vala
index c712a23..9c82ab2 100644
--- a/tests/testpriorityqueue.vala
+++ b/tests/testpriorityqueue.vala
@@ -49,7 +49,7 @@ public class PriorityQueueTests : QueueTests {
assert (test_queue.compare_func == (CompareFunc) strcmp);
}
- public new void test_gobject_properties() {
+ public new void test_gobject_properties () {
var test_queue = test_collection as PriorityQueue<string>;
// Check the list exists
diff --git a/tests/testqueue.vala b/tests/testqueue.vala
index dd3c36d..aaeb545 100644
--- a/tests/testqueue.vala
+++ b/tests/testqueue.vala
@@ -112,7 +112,7 @@ public abstract class QueueTests : CollectionTests {
assert (recipient.get (0) == "one");
}
- public new void test_gobject_properties() {
+ public new void test_gobject_properties () {
var test_queue = test_collection as Gee.Queue<string>;
// Check the list exists
diff --git a/tests/testsortedset.vala b/tests/testsortedset.vala
index 3348a19..a8e9f33 100644
--- a/tests/testsortedset.vala
+++ b/tests/testsortedset.vala
@@ -387,23 +387,23 @@ public abstract class SortedSetTests : SetTests {
}
private Type type;
- public SubSet(SortedSetTests test, Type type) {
- base("%s Subset".printf (type.to_string ()));
+ public SubSet (SortedSetTests test, Type type) {
+ base ("%s Subset".printf (type.to_string ()));
this.test = test;
this.type = type;
- add_test("[Collection] size", test_size);
- add_test("[Collection] contains", test_contains);
- add_test("[Collection] add", test_add);
- add_test("[Collection] remove", test_remove);
- add_test("[Collection] iterator", test_iterator);
- add_test("[Collection] clear", test_clear);
- add_test("[SortedSet] iterator at", test_iterator_at);
- add_test("[SortedSet] lower", test_lower);
- add_test("[SortedSet] higher", test_higher);
- add_test("[SortedSet] ceil", test_ceil);
- add_test("[SortedSet] floor", test_floor);
- add_test("[SortedSet] subsets", test_subsets);
- add_test("[SortedSet] boundaries", test_boundaries);
+ add_test ("[Collection] size", test_size);
+ add_test ("[Collection] contains", test_contains);
+ add_test ("[Collection] add", test_add);
+ add_test ("[Collection] remove", test_remove);
+ add_test ("[Collection] iterator", test_iterator);
+ add_test ("[Collection] clear", test_clear);
+ add_test ("[SortedSet] iterator at", test_iterator_at);
+ add_test ("[SortedSet] lower", test_lower);
+ add_test ("[SortedSet] higher", test_higher);
+ add_test ("[SortedSet] ceil", test_ceil);
+ add_test ("[SortedSet] floor", test_floor);
+ add_test ("[SortedSet] subsets", test_subsets);
+ add_test ("[SortedSet] boundaries", test_boundaries);
}
public override void set_up () {
diff --git a/tests/testtreemap.vala b/tests/testtreemap.vala
index 82e1621..993c67e 100644
--- a/tests/testtreemap.vala
+++ b/tests/testtreemap.vala
@@ -51,7 +51,7 @@ public class TreeMapTests : MapTests {
assert (test_tree_map.value_equal_func == str_equal);
}
- public new void test_gobject_properties() {
+ public new void test_gobject_properties () {
var test_tree_map = test_map as TreeMap<string,string>;
// Check the list exists
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]