[libgee] Remove depending on order of iteration in read-only collections' test
- From: Maciej Marcin Piechotka <mpiechotka src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [libgee] Remove depending on order of iteration in read-only collections' test
- Date: Mon, 27 Dec 2010 14:41:48 +0000 (UTC)
commit d8881d4465a9f6066049dfa34cfbf3d6a1da48a4
Author: Maciej Piechotka <uzytkownik2 gmail com>
Date: Mon Dec 27 15:37:43 2010 +0100
Remove depending on order of iteration in read-only collections' test
tests/testreadonlycollection.vala | 27 ++++++++++++++++++++-------
1 files changed, 20 insertions(+), 7 deletions(-)
---
diff --git a/tests/testreadonlycollection.vala b/tests/testreadonlycollection.vala
index 30874ee..75232ff 100644
--- a/tests/testreadonlycollection.vala
+++ b/tests/testreadonlycollection.vala
@@ -83,13 +83,27 @@ public class ReadOnlyCollectionTests : Gee.TestCase {
Iterator<string> iterator = ro_collection.iterator ();
- assert (iterator.has_next ());
- assert (iterator.next ());
- assert (iterator.get () == "one");
+ bool one_found = false;
+ bool two_found = false;
+
+ while (iterator.next ()) {
+ assert (iterator.valid);
+ switch(iterator.get ()) {
+ case "one":
+ assert (! one_found);
+ one_found = true;
+ break;
+ case "two":
+ assert (! two_found);
+ two_found = true;
+ break;
+ default:
+ assert_not_reached ();
+ }
+ }
- assert (iterator.has_next ());
- assert (iterator.next ());
- assert (iterator.get () == "two");
+ assert (one_found);
+ assert (two_found);
assert (! iterator.has_next ());
assert (! iterator.next ());
@@ -97,7 +111,6 @@ public class ReadOnlyCollectionTests : Gee.TestCase {
iterator = ro_collection.iterator ();
assert (iterator.has_next ());
assert (iterator.next ());
- assert (iterator.get () == "one");
if (Test.trap_fork (0, TestTrapFlags.SILENCE_STDOUT |
TestTrapFlags.SILENCE_STDERR)) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]