@@ -12,30 +12,26 @@ struct urPlatformGetTest : ::testing::Test {
1212};
1313
1414TEST_F (urPlatformGetTest, Success) {
15-   uint32_t  count;
16-   ASSERT_SUCCESS (urPlatformGet (adapters.data (),
17-                                static_cast <uint32_t >(adapters.size ()), 0 ,
18-                                nullptr , &count));
19-   ASSERT_NE (count, 0 );
20-   std::vector<ur_platform_handle_t > platforms (count);
21-   ASSERT_SUCCESS (urPlatformGet (adapters.data (),
22-                                static_cast <uint32_t >(adapters.size ()), count,
23-                                platforms.data (), nullptr ));
24-   for  (auto  platform : platforms) {
25-     ASSERT_NE (nullptr , platform);
15+   for  (auto  adapter : adapters) {
16+     uint32_t  count;
17+     ASSERT_SUCCESS (urPlatformGet (adapter, 0 , nullptr , &count));
18+     ASSERT_NE (count, 0 );
19+     std::vector<ur_platform_handle_t > platforms (count);
20+     ASSERT_SUCCESS (urPlatformGet (adapter, count, platforms.data (), nullptr ));
21+     for  (auto  platform : platforms) {
22+       ASSERT_NE (nullptr , platform);
23+     }
2624  }
2725}
2826
2927TEST_F (urPlatformGetTest, InvalidNumEntries) {
30-   uint32_t  count;
31-   ASSERT_SUCCESS (urPlatformGet (adapters.data (),
32-                                static_cast <uint32_t >(adapters.size ()), 0 ,
33-                                nullptr , &count));
34-   std::vector<ur_platform_handle_t > platforms (count);
35-   ASSERT_EQ_RESULT (UR_RESULT_ERROR_INVALID_SIZE,
36-                    urPlatformGet (adapters.data (),
37-                                  static_cast <uint32_t >(adapters.size ()), 0 ,
38-                                  platforms.data (), nullptr ));
28+   for  (auto  adapter : adapters) {
29+     uint32_t  count;
30+     ASSERT_SUCCESS (urPlatformGet (adapter, 0 , nullptr , &count));
31+     std::vector<ur_platform_handle_t > platforms (count);
32+     ASSERT_EQ_RESULT (UR_RESULT_ERROR_INVALID_SIZE,
33+                      urPlatformGet (adapter, 0 , platforms.data (), nullptr ));
34+   }
3935}
4036
4137TEST_F (urPlatformGetTest, InvalidNullPointer) {
@@ -47,8 +43,8 @@ TEST_F(urPlatformGetTest, InvalidNullPointer) {
4743}
4844
4945TEST_F (urPlatformGetTest, NullArgs) {
50-   ASSERT_EQ_RESULT (UR_RESULT_ERROR_INVALID_VALUE, 
51-                     urPlatformGet (adapters. data () ,
52-                                   static_cast < uint32_t >(adapters. size ()) , 0 ,
53-                                   nullptr ,  nullptr )); 
46+   for  ( auto  adapter : adapters) { 
47+     ASSERT_EQ_RESULT (UR_RESULT_ERROR_INVALID_VALUE ,
48+                      urPlatformGet (adapter , 0 ,  nullptr ,  nullptr )); 
49+   } 
5450}
0 commit comments