File indexing completed on 2026-07-26 08:22:24
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "traccc/seeding/grids/populator.hpp"
0010
0011
0012 #include <gtest/gtest.h>
0013
0014
0015 #include <limits>
0016
0017 using namespace traccc;
0018
0019 GTEST_TEST(traccc_grid2, replace_populator) {
0020 replace_populator<> replacer;
0021 unsigned int stored = 3u;
0022 replacer(stored, 2u);
0023 EXPECT_EQ(stored, 2u);
0024
0025 replacer(stored, 42u);
0026 EXPECT_EQ(stored, 42u);
0027 }
0028
0029 GTEST_TEST(traccc_grid2, complete_populator) {
0030 using cpopulator4 = complete_populator<vecmem::vector, vecmem::jagged_vector,
0031 std::array, unsigned int, false, 4u>;
0032 cpopulator4 completer;
0033
0034 cpopulator4::store_value stored = {completer.m_invalid, completer.m_invalid,
0035 completer.m_invalid, completer.m_invalid};
0036
0037 cpopulator4::store_value test = stored;
0038 test[0] = 9u;
0039 completer(stored, 9u);
0040 EXPECT_EQ(stored, test);
0041
0042 test[1] = 3u;
0043 completer(stored, 3u);
0044 EXPECT_EQ(stored, test);
0045
0046 using sort_cpopulator4 =
0047 complete_populator<vecmem::vector, vecmem::jagged_vector, std::array,
0048 unsigned int, true, 4u>;
0049 sort_cpopulator4 sort_completer;
0050
0051 test = {0u, 3u, 9u, 1000u};
0052 sort_completer(stored, 1000u);
0053 sort_completer(stored, 0u);
0054 EXPECT_EQ(stored, test);
0055 }
0056
0057 GTEST_TEST(traccc_grid2, attach_populator) {
0058
0059 attach_populator<> attacher;
0060 attach_populator<>::store_value stored = {3u};
0061 attacher(stored, 2u);
0062 attach_populator<>::store_value test = {3u, 2u};
0063 EXPECT_EQ(stored, test);
0064
0065 attacher(stored, 42u);
0066 test = {3u, 2u, 42u};
0067 EXPECT_EQ(stored, test);
0068
0069
0070 attach_populator<vecmem::vector, vecmem::jagged_vector, std::array,
0071 unsigned int, true>
0072 sort_attacher;
0073 sort_attacher(stored, 11u);
0074 test = {2u, 3u, 11u, 42u};
0075 EXPECT_EQ(stored, test);
0076 }