[libgee] DÃefinitiely remove trailing whitespaces
- From: Didier 'Ptitjes' Villevalois <dvillevalois src gnome org>
- To: svn-commits-list gnome org
- Cc:
- Subject: [libgee] DÃefinitiely remove trailing whitespaces
- Date: Fri, 11 Sep 2009 16:07:28 +0000 (UTC)
commit 9f7fb45882aba3bf8cb467b99ce33c4d2a3905d9
Author: Didier 'Ptitjes <ptitjes free fr>
Date: Fri Sep 11 18:06:53 2009 +0200
DÃefinitiely remove trailing whitespaces
benchmark/benchmark.vala | 4 +-
gee/treemap.vala | 2 +-
tests/testhashmap.vala | 110 +++++++++++++++++++++++-----------------------
tests/testhashset.vala | 88 ++++++++++++++++++------------------
4 files changed, 102 insertions(+), 102 deletions(-)
---
diff --git a/benchmark/benchmark.vala b/benchmark/benchmark.vala
index b0e12d6..444ee3a 100644
--- a/benchmark/benchmark.vala
+++ b/benchmark/benchmark.vala
@@ -127,7 +127,7 @@ namespace Gee.Benchmark {
}
public class Benchmark<G> : Object {
-
+
public Benchmark (Factory<G> factory,
Gee.List<Algorithm<G>> algorithms,
Gee.List<Generator<G>> generators,
@@ -176,7 +176,7 @@ namespace Gee.Benchmark {
for (int k = 0; k < algorithms.size; k++) {
Collection<G> copy = factory.copy (collection);
-
+
timer.reset ();
timer.start ();
algorithms[k].process_collection (copy);
diff --git a/gee/treemap.vala b/gee/treemap.vala
index 3a20a64..6f91a3a 100644
--- a/gee/treemap.vala
+++ b/gee/treemap.vala
@@ -231,7 +231,7 @@ public class Gee.TreeMap<K,V> : Gee.AbstractMap<K,V> {
if (is_red (node.left)) {
rotate_right (ref node);
}
-
+
weak Node<K,V> r = node.right;
if (key_compare_func (key, node.key) == 0 && r == null) {
value = (owned) node.value;
diff --git a/tests/testhashmap.vala b/tests/testhashmap.vala
index 14871f9..b4967ae 100644
--- a/tests/testhashmap.vala
+++ b/tests/testhashmap.vala
@@ -27,45 +27,45 @@ const string CODE_NOT_REACHABLE = "*code should not be reached*";
void test_hashmap_get () {
var hashmap = new HashMap<string,string> (str_hash, str_equal, str_equal);
-
+
// Check get from empty map
assert (hashmap.get ("foo") == null);
-
+
// Check get from map with one items
hashmap.set ("key", "value");
assert (hashmap.get ("key") == "value");
-
+
// Check get from non-existing key
assert (hashmap.get ("foo") == null);
-
+
// Check get from map with multiple items
hashmap.set ("key2", "value2");
hashmap.set ("key3", "value3");
assert (hashmap.get ("key") == "value");
assert (hashmap.get ("key2") == "value2");
assert (hashmap.get ("key3") == "value3");
-
+
}
void test_hashmap_set () {
var hashmap = new HashMap<string,string> (str_hash, str_equal, str_equal);
-
+
// check map is empty
assert (hashmap.size == 0);
-
+
// check set an item to map
hashmap.set ("abc", "one");
assert (hashmap.contains ("abc"));
assert (hashmap.get ("abc") == "one");
assert (hashmap.size == 1);
-
+
// check set an item to map with same value
hashmap.set ("def", "one");
assert (hashmap.contains ("def"));
assert (hashmap.get ("abc") == "one");
assert (hashmap.get ("def") == "one");
assert (hashmap.size == 2);
-
+
// check set with same key
hashmap.set ("def", "two");
assert (hashmap.contains ("def"));
@@ -77,35 +77,35 @@ void test_hashmap_set () {
void test_hashmap_remove () {
var hashmap = new HashMap<string,string> (str_hash, str_equal, str_equal);
string? value;
-
+
// check removing when map is empty
hashmap.remove ("foo");
assert (hashmap.size == 0);
-
+
// add items
hashmap.set ("aaa", "111");
hashmap.set ("bbb", "222");
hashmap.set ("ccc", "333");
hashmap.set ("ddd", "444");
assert (hashmap.size == 4);
-
+
// check remove on first place
hashmap.remove ("aaa");
assert (hashmap.size == 3);
-
+
// check remove in between
hashmap.remove ("ccc", out value);
assert (hashmap.size == 2);
assert (value == "333");
-
+
// check remove in last place
hashmap.remove ("ddd");
assert (hashmap.size == 1);
-
+
// check remove invalid key
hashmap.remove ("bar", out value);
assert (value == null);
-
+
// check remove last in map
hashmap.remove ("bbb");
assert (hashmap.size == 0);
@@ -113,64 +113,64 @@ void test_hashmap_remove () {
void test_hashmap_contains () {
var hashmap = new HashMap<string,string> (str_hash, str_equal, str_equal);
-
+
// Check on empty map
assert (!hashmap.contains ("111"));
-
+
// Check items
hashmap.set ("10", "111");
assert (hashmap.contains ("10"));
assert (!hashmap.contains ("20"));
assert (!hashmap.contains ("30"));
-
+
assert (hashmap.get ("10") == "111");
-
+
hashmap.set ("20", "222");
assert (hashmap.contains ("10"));
assert (hashmap.contains ("20"));
assert (!hashmap.contains ("30"));
-
+
assert (hashmap.get ("10") == "111");
assert (hashmap.get ("20") == "222");
-
+
hashmap.set ("30", "333");
assert (hashmap.contains ("10"));
assert (hashmap.contains ("20"));
assert (hashmap.contains ("30"));
-
+
assert (hashmap.get ("10") == "111");
assert (hashmap.get ("20") == "222");
assert (hashmap.get ("30") == "333");
-
+
// Clear and recheck
hashmap.clear ();
assert (!hashmap.contains ("10"));
assert (!hashmap.contains ("20"));
assert (!hashmap.contains ("30"));
-
+
var hashmapOfInt = new HashMap<int,int> ();
-
+
// Check items
hashmapOfInt.set (10, 111);
assert (hashmapOfInt.contains (10));
assert (!hashmapOfInt.contains (20));
assert (!hashmapOfInt.contains (30));
-
+
assert (hashmapOfInt.get (10) == 111);
-
+
hashmapOfInt.set (20, 222);
assert (hashmapOfInt.contains (10));
assert (hashmapOfInt.contains (20));
assert (!hashmapOfInt.contains (30));
-
+
assert (hashmapOfInt.get (10) == 111);
assert (hashmapOfInt.get (20) == 222);
-
+
hashmapOfInt.set (30, 333);
assert (hashmapOfInt.contains (10));
assert (hashmapOfInt.contains (20));
assert (hashmapOfInt.contains (30));
-
+
assert (hashmapOfInt.get (10) == 111);
assert (hashmapOfInt.get (20) == 222);
assert (hashmapOfInt.get (30) == 333);
@@ -178,18 +178,18 @@ void test_hashmap_contains () {
void test_hashmap_size () {
var hashmap = new HashMap<string,string> (str_hash, str_equal, str_equal);
-
+
// Check empty map
assert (hashmap.size == 0);
-
+
// Check when one item
hashmap.set ("1", "1");
assert (hashmap.size == 1);
-
+
// Check when more items
hashmap.set ("2", "2");
assert (hashmap.size == 2);
-
+
// Check when items cleared
hashmap.clear ();
assert (hashmap.size == 0);
@@ -197,11 +197,11 @@ void test_hashmap_size () {
void test_hashmap_get_keys () {
var hashmap = new HashMap<string,string> (str_hash, str_equal, str_equal);
-
+
// Check keys on empty map
var keySet = hashmap.get_keys ();
assert (keySet.size == 0);
-
+
// Check keys on map with one item
hashmap.set ("aaa", "111");
assert (keySet.size == 1);
@@ -209,7 +209,7 @@ void test_hashmap_get_keys () {
keySet = hashmap.get_keys ();
assert (keySet.size == 1);
assert (keySet.contains ("aaa"));
-
+
// Check modify key set directly
if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | TestTrapFlags.SILENCE_STDERR)) {
keySet.add ("ccc");
@@ -217,7 +217,7 @@ void test_hashmap_get_keys () {
}
Test.trap_assert_failed ();
Test.trap_assert_stderr (CODE_NOT_REACHABLE);
-
+
// Check keys on map with multiple items
hashmap.set ("bbb", "222");
assert (keySet.size == 2);
@@ -227,22 +227,22 @@ void test_hashmap_get_keys () {
assert (keySet.size == 2);
assert (keySet.contains ("aaa"));
assert (keySet.contains ("bbb"));
-
+
// Check keys on map clear
hashmap.clear ();
assert (keySet.size == 0);
keySet = hashmap.get_keys ();
assert (keySet.size == 0);
-
+
}
void test_hashmap_get_values () {
var hashmap = new HashMap<string,string> (str_hash, str_equal, str_equal);
-
+
// Check keys on empty map
var valueCollection = hashmap.get_values ();
assert (valueCollection.size == 0);
-
+
// Check keys on map with one item
hashmap.set ("aaa", "111");
assert (valueCollection.size == 1);
@@ -250,7 +250,7 @@ void test_hashmap_get_values () {
valueCollection = hashmap.get_values ();
assert (valueCollection.size == 1);
assert (valueCollection.contains ("111"));
-
+
// Check modify key set directly
if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT | TestTrapFlags.SILENCE_STDERR)) {
valueCollection.add ("ccc");
@@ -258,7 +258,7 @@ void test_hashmap_get_values () {
}
Test.trap_assert_failed ();
Test.trap_assert_stderr (CODE_NOT_REACHABLE);
-
+
// Check keys on map with multiple items
hashmap.set ("bbb", "222");
assert (valueCollection.size == 2);
@@ -268,7 +268,7 @@ void test_hashmap_get_values () {
assert (valueCollection.size == 2);
assert (valueCollection.contains ("111"));
assert (valueCollection.contains ("222"));
-
+
// Check keys on map clear
hashmap.clear ();
assert (valueCollection.size == 0);
@@ -280,17 +280,17 @@ void test_hashmap_get_values () {
void test_hashmap_clear () {
var hashmap = new HashMap<string,string> (str_hash, str_equal, str_equal);
assert (hashmap.size == 0);
-
+
// Check clear on empty map
hashmap.clear ();
assert (hashmap.size == 0);
-
+
// Check clear one item
hashmap.set ("1", "1");
assert (hashmap.size == 1);
hashmap.clear ();
assert (hashmap.size == 0);
-
+
// Check clear multiple items
hashmap.set ("1", "1");
hashmap.set ("2", "2");
@@ -351,7 +351,7 @@ void test_hashmap_set_all () {
void test_hashmap_remove_all () {
var map1 = new HashMap<string,string> (str_hash, str_equal, str_equal);
var map2 = new HashMap<string,string> (str_hash, str_equal, str_equal);
-
+
// Check remove all on empty maps.
assert (map1.is_empty);
@@ -380,7 +380,7 @@ void test_hashmap_remove_all () {
map1.clear ();
map2.clear ();
-
+
// Map1 has entries, map2 is empty. -> no change
map1.set ("a", "1");
@@ -435,7 +435,7 @@ void test_hashmap_remove_all () {
assert (map1.size == 2);
assert (map2.size == 5);
-
+
assert (map1.contains ("x"));
assert (map1.contains ("y"));
@@ -452,7 +452,7 @@ void test_hashmap_contains_all() {
assert (map1.contains_all (map2));
// Map1 has items, map2 is empty.
-
+
map1.set ("1", "1");
assert (map1.contains_all (map2));
@@ -461,7 +461,7 @@ void test_hashmap_contains_all() {
map2.clear ();
// Map1 is empty, map2 has items.
-
+
map2.set ("1", "1");
assert (!map1.contains_all (map2));
@@ -470,7 +470,7 @@ void test_hashmap_contains_all() {
map2.clear ();
// Map1 and map2 are the same.
-
+
map1.set ("1", "a");
map1.set ("2", "b");
diff --git a/tests/testhashset.vala b/tests/testhashset.vala
index 04efeef..352b17b 100644
--- a/tests/testhashset.vala
+++ b/tests/testhashset.vala
@@ -30,52 +30,52 @@ void test_hashset_add () {
hashset.add ("42");
assert (hashset.contains ("42"));
assert (hashset.size == 1);
-
+
hashset.add ("43");
assert (hashset.contains ("42"));
assert (hashset.contains ("43"));
assert (hashset.size == 2);
-
+
// Check add same element
assert (hashset.size == 2);
hashset.add ("43");
assert (hashset.contains ("42"));
assert (hashset.contains ("43"));
assert (hashset.size == 2);
-
+
// Check adding of ints
var hashsetInt = new HashSet<int> ();
hashsetInt.add (42);
assert (hashsetInt.contains (42));
assert (hashsetInt.size == 1);
-
+
hashsetInt.add (43);
assert (hashsetInt.contains (42));
assert (hashsetInt.contains (43));
assert (hashsetInt.size == 2);
-
+
// Check add same element
assert (hashsetInt.size == 2);
hashsetInt.add (43);
assert (hashsetInt.contains (42));
assert (hashsetInt.contains (43));
assert (hashsetInt.size == 2);
-
+
// Check adding of objects
var hashsetObject = new HashSet<Object> ();
-
+
var fooObject = new Object();
hashsetObject.add (fooObject);
assert (hashsetObject.contains (fooObject));
assert (hashsetObject.size == 1);
-
+
var fooObject2 = new Object();
hashsetObject.add (fooObject2);
assert (hashsetObject.contains (fooObject));
assert (hashsetObject.contains (fooObject2));
assert (hashsetObject.size == 2);
-
+
// Check add same element
assert (hashsetObject.size == 2);
hashsetObject.add (fooObject2);
@@ -87,17 +87,17 @@ void test_hashset_add () {
void test_hashset_clear () {
var hashset = new HashSet<string> (str_hash, str_equal);
assert (hashset.size == 0);
-
+
// Check clear on empty set
hashset.clear ();
assert (hashset.size == 0);
-
+
// Check clear one item
hashset.add ("1");
assert (hashset.size == 1);
hashset.clear ();
assert (hashset.size == 0);
-
+
// Check clear multiple items
hashset.add ("1");
hashset.add ("2");
@@ -109,50 +109,50 @@ void test_hashset_clear () {
void test_hashset_contains () {
var hashsetString = new HashSet<string> (str_hash, str_equal);
-
+
// Check on empty set
assert (!hashsetString.contains ("1"));
-
+
// Check items
hashsetString.add ("10");
assert (hashsetString.contains ("10"));
assert (!hashsetString.contains ("20"));
assert (!hashsetString.contains ("30"));
-
+
hashsetString.add ("20");
assert (hashsetString.contains ("10"));
assert (hashsetString.contains ("20"));
assert (!hashsetString.contains ("30"));
-
+
hashsetString.add ("30");
assert (hashsetString.contains ("10"));
assert (hashsetString.contains ("20"));
assert (hashsetString.contains ("30"));
-
+
// Clear and recheck
hashsetString.clear ();
assert (!hashsetString.contains ("10"));
assert (!hashsetString.contains ("20"));
assert (!hashsetString.contains ("30"));
-
+
var hashsetInt = new HashSet<int> ();
-
+
// Check items
hashsetInt.add (10);
assert (hashsetInt.contains (10));
assert (!hashsetInt.contains (20));
assert (!hashsetInt.contains (30));
-
+
hashsetInt.add (20);
assert (hashsetInt.contains (10));
assert (hashsetInt.contains (20));
assert (!hashsetInt.contains (30));
-
+
hashsetInt.add (30);
assert (hashsetInt.contains (10));
assert (hashsetInt.contains (20));
assert (hashsetInt.contains (30));
-
+
// Clear and recheck
hashsetInt.clear ();
assert (!hashsetInt.contains (10));
@@ -162,10 +162,10 @@ void test_hashset_contains () {
void test_hashset_remove () {
var hashsetString = new HashSet<string> (str_hash, str_equal);
-
+
// Check remove if list is empty
hashsetString.remove ("42");
-
+
// Add 5 different elements
hashsetString.add ("42");
hashsetString.add ("43");
@@ -173,7 +173,7 @@ void test_hashset_remove () {
hashsetString.add ("45");
hashsetString.add ("46");
assert (hashsetString.size == 5);
-
+
// Check remove first
hashsetString.remove ("42");
assert (hashsetString.size == 4);
@@ -181,14 +181,14 @@ void test_hashset_remove () {
assert (hashsetString.contains ("44"));
assert (hashsetString.contains ("45"));
assert (hashsetString.contains ("46"));
-
+
// Check remove last
hashsetString.remove ("46");
assert (hashsetString.size == 3);
assert (hashsetString.contains ("43"));
assert (hashsetString.contains ("44"));
assert (hashsetString.contains ("45"));
-
+
// Check remove in between
hashsetString.remove ("44");
assert (hashsetString.size == 2);
@@ -197,7 +197,7 @@ void test_hashset_remove () {
// Check removing of int element
var hashsetInt = new HashSet<int> ();
-
+
// Add 5 different elements
hashsetInt.add (42);
hashsetInt.add (43);
@@ -205,7 +205,7 @@ void test_hashset_remove () {
hashsetInt.add (45);
hashsetInt.add (46);
assert (hashsetInt.size == 5);
-
+
// Remove first
hashsetInt.remove (42);
assert (hashsetInt.size == 4);
@@ -213,14 +213,14 @@ void test_hashset_remove () {
assert (hashsetInt.contains (44));
assert (hashsetInt.contains (45));
assert (hashsetInt.contains (46));
-
+
// Remove last
hashsetInt.remove (46);
assert (hashsetInt.size == 3);
assert (hashsetInt.contains (43));
assert (hashsetInt.contains (44));
assert (hashsetInt.contains (45));
-
+
// Remove in between
hashsetInt.remove (44);
assert (hashsetInt.size == 2);
@@ -230,18 +230,18 @@ void test_hashset_remove () {
void test_hashset_size () {
var hashset = new HashSet<string> (str_hash, str_equal);
-
+
// Check empty list
assert (hashset.size == 0);
-
+
// Check when one item
hashset.add ("1");
assert (hashset.size == 1);
-
+
// Check when more items
hashset.add ("2");
assert (hashset.size == 2);
-
+
// Check when items cleared
hashset.clear ();
assert (hashset.size == 0);
@@ -249,27 +249,27 @@ void test_hashset_size () {
void test_hashset_iterator () {
var hashset = new HashSet<string> (str_hash, str_equal);
-
+
// Check iterate empty list
var iterator = hashset.iterator ();
assert (!iterator.next());
-
+
// Check iterate list
hashset.add ("42");
hashset.add ("43");
-
+
iterator = hashset.iterator ();
-
+
// A set is usually not ordered, so this is not a requirement
assert (iterator.next());
string firstString = iterator.get();
assert (hashset.contains (firstString));
-
+
assert (iterator.next());
string secondString = iterator.get();
assert (hashset.contains (secondString));
assert (!str_equal (firstString, secondString)); // they can not be identical neither equal
-
+
assert (!iterator.next());
}
@@ -304,7 +304,7 @@ void test_hashset_add_all () {
// Case 2: Check hashset1 not empty, hashset2 is empty
hashset1.add ("1");
-
+
hashset1.add_all (hashset2);
assert (hashset1.size == 1);
@@ -576,7 +576,7 @@ void test_hashset_retain_all () {
hashset1.clear ();
hashset2.clear ();
-
+
// Case 4: Hashset1 and hashset2 have no common elements -> everything is removed in hashset1
hashset1.add (1);
hashset1.add (2);
@@ -616,7 +616,7 @@ void test_hashset_retain_all () {
hashset2.clear ();
// Case 6: Hashset1 and hashset2 have 2 common elements but each also has his own elements -> hashset1 only retains what is in hashset2
-
+
hashset1.add (1);
hashset1.add (2);
hashset1.add (3);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]