File indexing completed on 2025-01-18 09:12:49
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include <boost/test/unit_test.hpp>
0010
0011 #include "Acts/Seeding/detail/UtilityFunctions.hpp"
0012
0013 #include <iterator>
0014 #include <list>
0015 #include <set>
0016 #include <string>
0017 #include <unordered_set>
0018 #include <vector>
0019
0020 namespace Acts::Test {
0021
0022 BOOST_AUTO_TEST_CASE(pushBackOrInsertAtEnd_vector) {
0023 std::vector<std::size_t> coll;
0024 Acts::detail::pushBackOrInsertAtEnd(coll, 2ul);
0025 BOOST_CHECK(coll.size() == 1ul);
0026 Acts::detail::pushBackOrInsertAtEnd(coll, 5ul);
0027 BOOST_CHECK(coll.size() == 2ul);
0028 std::size_t val = 1ul;
0029 Acts::detail::pushBackOrInsertAtEnd(coll, val);
0030 BOOST_CHECK(coll.size() == 3ul);
0031
0032 BOOST_CHECK_EQUAL(coll[0], 2ul);
0033 BOOST_CHECK_EQUAL(coll[1], 5ul);
0034 BOOST_CHECK_EQUAL(coll[2], 1ul);
0035 }
0036
0037 BOOST_AUTO_TEST_CASE(pushBackOrInsertAtEnd_list) {
0038 std::list<std::size_t> coll;
0039 Acts::detail::pushBackOrInsertAtEnd(coll, 2ul);
0040 BOOST_CHECK(coll.size() == 1ul);
0041 Acts::detail::pushBackOrInsertAtEnd(coll, 5ul);
0042 BOOST_CHECK(coll.size() == 2ul);
0043 std::size_t val = 1ul;
0044 Acts::detail::pushBackOrInsertAtEnd(coll, val);
0045 BOOST_CHECK(coll.size() == 3ul);
0046
0047 BOOST_CHECK_EQUAL(coll.front(), 2ul);
0048 coll.pop_front();
0049 BOOST_CHECK_EQUAL(coll.front(), 5ul);
0050 coll.pop_front();
0051 BOOST_CHECK_EQUAL(coll.front(), 1ul);
0052 coll.pop_front();
0053 }
0054
0055 BOOST_AUTO_TEST_CASE(pushBackOrInsertAtEnd_set) {
0056 std::set<std::size_t> coll;
0057 Acts::detail::pushBackOrInsertAtEnd(coll, 2ul);
0058 BOOST_CHECK(coll.size() == 1ul);
0059 Acts::detail::pushBackOrInsertAtEnd(coll, 5ul);
0060 BOOST_CHECK(coll.size() == 2ul);
0061 std::size_t val = 1ul;
0062 Acts::detail::pushBackOrInsertAtEnd(coll, val);
0063 BOOST_CHECK(coll.size() == 3ul);
0064
0065 BOOST_CHECK(coll.contains(2ul));
0066 BOOST_CHECK(coll.contains(5ul));
0067 BOOST_CHECK(coll.contains(1ul));
0068 }
0069
0070 BOOST_AUTO_TEST_CASE(pushBackOrInsertAtEnd_unordered_set) {
0071 std::unordered_set<std::size_t> coll;
0072 Acts::detail::pushBackOrInsertAtEnd(coll, 2ul);
0073 BOOST_CHECK(coll.size() == 1ul);
0074 Acts::detail::pushBackOrInsertAtEnd(coll, 5ul);
0075 BOOST_CHECK(coll.size() == 2ul);
0076 std::size_t val = 1ul;
0077 Acts::detail::pushBackOrInsertAtEnd(coll, val);
0078 BOOST_CHECK(coll.size() == 3ul);
0079
0080 BOOST_CHECK(coll.contains(2ul));
0081 BOOST_CHECK(coll.contains(5ul));
0082 BOOST_CHECK(coll.contains(1ul));
0083 }
0084
0085 }