Skip to content

Commit 960ee6e

Browse files
[arccore,collections] Ajoute test pour les dernières modifications.
1 parent 47945fd commit 960ee6e

File tree

1 file changed

+37
-2
lines changed

1 file changed

+37
-2
lines changed

arccore/src/collections/tests/TestArray.cc

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,21 +23,29 @@ void _testArraySwap(bool use_own_swap)
2323
{
2424
std::cout << "** TestArraySwap is_own=" << use_own_swap << "\n";
2525

26+
String c1_name = "TestC1";
2627
UniqueArray<IntSubClass> c1(7);
27-
IntSubClass* x1 = c1.unguardedBasePointer();
28+
c1.setDebugName(c1_name);
29+
IntSubClass* x1 = c1.data();
2830
std::cout << "** C1_this = " << &c1 << "\n";
2931
std::cout << "** C1_BASE = " << x1 << "\n";
3032
UniqueArray<IntSubClass> c2(3);
31-
IntSubClass* x2 = c2.unguardedBasePointer();
33+
IntSubClass* x2 = c2.data();
3234
std::cout << "** C2_this = " << &c2 << "\n";
3335
std::cout << "** C2_BASE = " << x2 << "\n";
3436

37+
ASSERT_EQ(c1.debugName(), c1_name);
38+
ASSERT_EQ(c2.debugName(), String{});
39+
3540
if (use_own_swap) {
3641
swap(c1, c2);
3742
}
3843
else
3944
std::swap(c1, c2);
4045

46+
ASSERT_EQ(c2.debugName(), c1_name);
47+
ASSERT_EQ(c1.debugName(), String{});
48+
4149
IntSubClass* after_x1 = c1.data();
4250
IntSubClass* after_x2 = c2.data();
4351
std::cout << "** C1_BASE_AFTER = " << after_x1 << " size=" << c1.size() << "\n";
@@ -990,6 +998,9 @@ TEST(Array, AllocatorV2)
990998
}
991999
}
9921000

1001+
/*---------------------------------------------------------------------------*/
1002+
/*---------------------------------------------------------------------------*/
1003+
9931004
TEST(Array, DebugInfo)
9941005
{
9951006
using namespace Arccore;
@@ -1034,6 +1045,30 @@ TEST(Array, DebugInfo)
10341045
/*---------------------------------------------------------------------------*/
10351046
/*---------------------------------------------------------------------------*/
10361047

1048+
TEST(Collections, Memory)
1049+
{
1050+
using namespace Arccore;
1051+
std::cout << eHostDeviceMemoryLocation::Unknown << " "
1052+
<< eHostDeviceMemoryLocation::Device << " "
1053+
<< eHostDeviceMemoryLocation::Host << " "
1054+
<< eHostDeviceMemoryLocation::ManagedMemoryDevice << " "
1055+
<< eHostDeviceMemoryLocation::ManagedMemoryHost << "\n";
1056+
1057+
std::cout << eMemoryResource::Unknown << " "
1058+
<< eMemoryResource::Host << " "
1059+
<< eMemoryResource::HostPinned << " "
1060+
<< eMemoryResource::Device << " "
1061+
<< eMemoryResource::UnifiedMemory << "\n";
1062+
1063+
UniqueArray<Int32> a1;
1064+
ASSERT_EQ(a1.hostDeviceMemoryLocation(), eHostDeviceMemoryLocation::Unknown);
1065+
a1._internalSetHostDeviceMemoryLocation(eHostDeviceMemoryLocation::Host);
1066+
ASSERT_EQ(a1.hostDeviceMemoryLocation(), eHostDeviceMemoryLocation::Host);
1067+
}
1068+
1069+
/*---------------------------------------------------------------------------*/
1070+
/*---------------------------------------------------------------------------*/
1071+
10371072
namespace Arccore
10381073
{
10391074
// Instancie explicitement les classes tableaux pour garantir

0 commit comments

Comments
 (0)