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);
}
}
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;
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);
}
}
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);
}
}
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++) {
/**
* {@inheritDoc}
*/
- public virtual G[] to_array() {
+ public virtual G[] to_array () {
G[] array = new G[size];
int index = 0;
foreach (G element in this) {
for (int index = 0; index < size_of_items; index++) {
if (!collection.contains (items[index])) {
changed = changed | remove (items[index]);
- }
+ }
}
return changed;
}
* @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; }
}
/**
* 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);
* 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);
* 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);
/**
* 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.
*/
* {@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.
*
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
/**
* 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.
*/
* 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.
*
/**
* 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.
*/
/**
* 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 ();
}
owned get { return this; }
}
-
+
private class Iterator<G> : ReadOnlyCollection.Iterator<G>, BidirIterator<G>, ListIterator<G> {
public Iterator (ListIterator<G> iterator) {
base (iterator);
* @param set the set to decorate.
*/
public ReadOnlySet (Set<G> set) {
- base(set);
+ base (set);
}
public virtual new Set<G> read_only_view {
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);
// 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 ();
}
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
}
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;
}
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);
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);
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 {
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;
}
}
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);
}
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);
}
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);
}
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);
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) {
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);
}
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) {
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
* 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];
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);
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);
}
dummy.clear ();
}
- public void test_to_array() {
+ public void test_to_array () {
// Check the collection exists
assert (test_collection != null);
}
}
- public void test_gobject_properties() {
+ public void test_gobject_properties () {
// Check the collection exists
assert (test_collection != null);
Value value;
public class ComparableTests : Gee.TestCase {
public ComparableTests () {
- base("Comparable");
+ base ("Comparable");
add_test ("[Comparable] selected functions", test_selected_functions);
}
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
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
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
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");
// 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);
// 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);
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 ();
// 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 ();
// 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 ();
// 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 () {
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;
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; }
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
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
}
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 () {
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