From b9bc1287d810412fef93951bf891f9ebabbcb6f0 Mon Sep 17 00:00:00 2001 From: Daniel Burrows Date: Sun, 9 May 2010 20:13:13 -0700 Subject: Write the first (trivial) test of the set union class. --- tests/test_dynamic_set.cc | 53 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'tests') diff --git a/tests/test_dynamic_set.cc b/tests/test_dynamic_set.cc index cf416103..6ad3c9b5 100644 --- a/tests/test_dynamic_set.cc +++ b/tests/test_dynamic_set.cc @@ -495,3 +495,56 @@ BOOST_FIXTURE_TEST_CASE(dynamicSetRemoveTwice, set_test) FINISH_SET_TEST(); } + + + +struct set_union_test +{ + shared_ptr > set1, set2, set3; + shared_ptr > valuesPtr; + dynamic_set_union &values; + dynamic_set_signals signals, expected_signals; + + std::vector expected; + + typedef inserted_call ins; + typedef removed_call rem; + + set_union_test() + : set1(dynamic_set_impl::create()), + set2(dynamic_set_impl::create()), + set3(dynamic_set_impl::create()), + valuesPtr(dynamic_set_union::create()), + values(*valuesPtr) + { + signals.attach(values); + } + + // Adds the sets in order (set1, then set2, then set3) + void addSets() + { + values.insert_set(set1); + values.insert_set(set2); + values.insert_set(set3); + } + + std::vector as_vector() const + { + std::vector rval; + + for(shared_ptr > e = values.enumerate(); + e->advance(); ) + { + rval.push_back(e->get_current()); + } + + return rval; + } +}; + +BOOST_FIXTURE_TEST_CASE(dynamicSetUnionInsertEmptySets, set_union_test) +{ + addSets(); + + FINISH_SET_TEST(); +} -- cgit v1.2.3