@@ -92,6 +92,26 @@ void check_platform_default_context(
92
92
EXPECT_NO_FATAL_FAILURE (DPCTLContext_Delete (CRef));
93
93
}
94
94
95
+ void check_platform_get_devices (__dpctl_keep const DPCTLSyclPlatformRef PRef)
96
+ {
97
+ DPCTLDeviceVectorRef DVRef = nullptr ;
98
+ size_t nDevices = 0 ;
99
+
100
+ DPCTLSyclDeviceType defDTy = DPCTLSyclDeviceType::DPCTL_ALL;
101
+ EXPECT_NO_FATAL_FAILURE (DVRef = DPCTLPlatform_GetDevices (PRef, defDTy));
102
+ EXPECT_TRUE (DVRef != nullptr );
103
+ EXPECT_NO_FATAL_FAILURE (nDevices = DPCTLDeviceVector_Size (DVRef));
104
+ for (auto i = 0ul ; i < nDevices; ++i) {
105
+ DPCTLSyclDeviceRef DRef = nullptr ;
106
+ EXPECT_NO_FATAL_FAILURE (DRef = DPCTLDeviceVector_GetAt (DV, i));
107
+ ASSERT_TRUE (DRef != nullptr );
108
+ EXPECT_NO_FATAL_FAILURE (DPCTLDevice_Delete (DRef));
109
+ }
110
+
111
+ EXPECT_NO_FATAL_FAILURE (DPCTLDeviceVector_Clear (DVRef));
112
+ EXPECT_NO_FATAL_FAILURE (DPCTLDeviceVector_Delete (DVRef));
113
+ }
114
+
95
115
} // namespace
96
116
97
117
struct TestDPCTLSyclPlatformInterface
@@ -282,6 +302,11 @@ TEST_P(TestDPCTLSyclPlatformInterface, ChkAreEqNullArg)
282
302
ASSERT_TRUE (DPCTLPlatform_Hash (Null_PRef) == 0 );
283
303
}
284
304
305
+ TEST_P (TestDPCTLSyclPlatformInterface, ChkGetDevices)
306
+ {
307
+ check_platform_get_devices (PRef);
308
+ }
309
+
285
310
TEST_F (TestDPCTLSyclDefaultPlatform, ChkGetName) { check_platform_name (PRef); }
286
311
287
312
TEST_F (TestDPCTLSyclDefaultPlatform, ChkGetVendor)
0 commit comments