3 * Copyright (C) 2008 Jürg Billeter
4 * Copyright (C) 2009 Didier Villevalois, Julien Peeters
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
21 * Jürg Billeter <j@bitron.ch>
22 * Didier 'Ptitjes' Villevalois <ptitjes@free.fr>
23 * Julien Peeters <contact@julienpeeters.fr>
29 public abstract class MultiSetTests : CollectionTests {
31 public MultiSetTests (string name) {
33 add_test ("[MultiSet] duplicates are retained",
34 test_duplicates_are_retained);
37 private void test_duplicates_are_retained () {
38 var test_multi_set = test_collection as MultiSet<string>;
40 // Check the test set is not null
41 assert (test_multi_set != null);
43 assert (test_multi_set.count ("one") == 0);
45 assert (test_multi_set.add ("one"));
46 assert (test_multi_set.contains ("one"));
47 assert (test_multi_set.size == 1);
48 assert (test_multi_set.count ("one") == 1);
50 assert (test_multi_set.add ("one"));
51 assert (test_multi_set.contains ("one"));
52 assert (test_multi_set.size == 2);
53 assert (test_multi_set.count ("one") == 2);
55 assert (test_multi_set.add ("one"));
56 assert (test_multi_set.contains ("one"));
57 assert (test_multi_set.size == 3);
58 assert (test_multi_set.count ("one") == 3);
60 assert (test_multi_set.remove ("one"));
61 assert (test_multi_set.contains ("one"));
62 assert (test_multi_set.size == 2);
63 assert (test_multi_set.count ("one") == 2);
65 assert (test_multi_set.remove ("one"));
66 assert (test_multi_set.contains ("one"));
67 assert (test_multi_set.size == 1);
68 assert (test_multi_set.count ("one") == 1);
70 assert (test_multi_set.remove ("one"));
71 assert (!test_multi_set.contains ("one"));
72 assert (test_multi_set.size == 0);
73 assert (test_multi_set.count ("one") == 0);