[Vala] Gee tests and extension proposal



Hello.

I have extended the tests in Gee library. Now they cover all methods
provided by the interfaces they extend so that future changes to the
library can be done without fear to break the behavior of those
methods. The extended tests are attached to this post.

I would also like to propose an extension to the interfaces in form of
additional convenient / often used methods. What I had in mind is
this:

Collection interface:
- void add_all(Collection) - Adds all items from the input collection
to this collection. Convenient for joining collections. Java also has
this on the interface of Collection.
- bool contains_all(Collection) - Checks if all items in the input
collection are present in this collection. Convenient for checking
items for example if "a" AND "b" exist in collection.
- bool contains_any(Collection) - Checks if any items in the input
collection are present in this collection. Convenient for checking
items for example if "a" OR "b" exist in collection.
- bool is_empty() - special state of a collection when it doesn't
contain any value. Added because it is clearer as list.size == 0.

List interface
- G first()
- G last() - First and last items are often special - it adds better
clarity to the algorithm if they don't need to be "addressed" as
list.get(0) or worse list.get(list.size -1).

Set interface

Map interface
- void set_all(Map) - Same as add_all for collections.
- expose Node<K,V> and make it possible to iterate through Nodes:
foreach (Node<int,int> item in map.get_nodes()) {

}

Iterators
- It would be convenient

Attachment: testarraylist.vala
Description: Text Data

Attachment: testhashmap.vala
Description: Text Data

Attachment: testhashset.vala
Description: Text Data



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]