xref: /llvm-project/offload/unittests/OffloadAPI/device/olGetDeviceCount.cpp (revision fd3907ccb583df99e9c19d2fe84e4e7c52d75de9)
1 //===------- Offload API tests - olGetDeviceCount --------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "../common/Fixtures.hpp"
10 #include <OffloadAPI.h>
11 #include <gtest/gtest.h>
12 
13 using olGetDeviceCountTest = offloadPlatformTest;
14 
15 TEST_F(olGetDeviceCountTest, Success) {
16   uint32_t Count = 0;
17   ASSERT_SUCCESS(olGetDeviceCount(Platform, &Count));
18 }
19 
20 TEST_F(olGetDeviceCountTest, InvalidNullPlatform) {
21   uint32_t Count = 0;
22   ASSERT_ERROR(OL_ERRC_INVALID_NULL_HANDLE, olGetDeviceCount(nullptr, &Count));
23 }
24 
25 TEST_F(olGetDeviceCountTest, InvalidNullPointer) {
26   ASSERT_ERROR(OL_ERRC_INVALID_NULL_POINTER,
27                olGetDeviceCount(Platform, nullptr));
28 }
29