File indexing completed on 2026-07-26 08:22:24
0001
0002
0003
0004
0005
0006
0007
0008
0009 #include "traccc/edm/container.hpp"
0010
0011
0012 #include <vecmem/memory/host_memory_resource.hpp>
0013
0014
0015 #include <gtest/gtest.h>
0016
0017 TEST(ContainerCopy, HostToHost) {
0018 using test_container_types = traccc::container_types<int, int>;
0019
0020
0021 vecmem::host_memory_resource host_mr;
0022
0023
0024 test_container_types::host host_orig{&host_mr};
0025
0026
0027 for (int i = 0; i < 3; ++i) {
0028 host_orig.push_back(i,
0029 test_container_types::host::vector_type<int>{i, i + 1});
0030 }
0031
0032
0033 auto host_buffer = traccc::get_data(host_orig);
0034 test_container_types::device host_copy{host_buffer};
0035
0036
0037 ASSERT_EQ(host_copy.size(), 3u);
0038 const auto& host_headers = host_copy.get_headers();
0039 ASSERT_EQ(host_headers.size(), 3u);
0040 ASSERT_EQ(host_headers[0], 0);
0041 ASSERT_EQ(host_headers[1], 1);
0042 ASSERT_EQ(host_headers[2], 2);
0043
0044 const auto& host_items = host_copy.get_items();
0045 ASSERT_EQ(host_items.size(), 3u);
0046 ASSERT_EQ(host_items[0].size(), 2u);
0047 ASSERT_EQ(host_items[0][0], 0);
0048 ASSERT_EQ(host_items[0][1], 1);
0049 ASSERT_EQ(host_items[1].size(), 2u);
0050 ASSERT_EQ(host_items[1][0], 1);
0051 ASSERT_EQ(host_items[1][1], 2);
0052 ASSERT_EQ(host_items[2].size(), 2u);
0053 ASSERT_EQ(host_items[2][0], 2);
0054 ASSERT_EQ(host_items[2][1], 3);
0055 }