MCPcopy Create free account
hub / github.com/AMReX-Codes/amrex / test_copy_assignment

Function test_copy_assignment

Tests/Base/TrackedVector/main.cpp:310–331  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

308}
309
310void test_copy_assignment ()
311{
312 TVec a;
313 a.host().assign({7, 8, 9});
314 // Sync via read-only access
315 [[maybe_unused]] auto ds = a.device_const().size();
316
317 TVec b;
318 b.host().assign({0});
319 [[maybe_unused]] auto ds2 = b.device_const().size();
320
321 b = a; // copy assign
322
323 AMREX_ALWAYS_ASSERT(b.host_const().size() == 3U);
324 AMREX_ALWAYS_ASSERT(b.host_const()[0] == 7 && b.host_const()[1] == 8 && b.host_const()[2] == 9);
325 AMREX_ALWAYS_ASSERT(b.status() == a.status());
326 verify_host_device_match(b);
327
328 // Modifying b doesn't affect a
329 b.host()[0] = 99;
330 AMREX_ALWAYS_ASSERT(a.host_const()[0] == 7);
331}
332
333void test_move_assignment ()
334{

Callers 1

Calls 4

verify_host_device_matchFunction · 0.85
statusMethod · 0.80
assignMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected