1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
|
#include "nvapi_tests_private.h"
#include "../inc/NvApiDriverSettings.h"
using namespace trompeloeil;
TEST_CASE("DRS methods succeed", "[.drs]") {
SECTION("CreateSession returns OK") {
NvDRSSessionHandle handle;
REQUIRE(NvAPI_DRS_CreateSession(&handle) == NVAPI_OK);
}
SECTION("LoadSettings returns OK") {
NvDRSSessionHandle handle{};
REQUIRE(NvAPI_DRS_LoadSettings(handle) == NVAPI_OK);
}
SECTION("FindProfileByName returns profile-not-found") {
NvDRSSessionHandle handle{};
NvDRSProfileHandle profile;
NvAPI_UnicodeString name{};
memcpy(name, L"Profile", 16);
REQUIRE(NvAPI_DRS_FindProfileByName(handle, name, &profile) == NVAPI_PROFILE_NOT_FOUND);
}
SECTION("FindApplicationByName returns executable-not-found") {
NvDRSSessionHandle handle{};
NvDRSProfileHandle profile;
NvAPI_UnicodeString name;
memcpy(name, L"Application", 24);
NVDRS_APPLICATION application;
REQUIRE(NvAPI_DRS_FindApplicationByName(handle, name, &profile, &application) == NVAPI_EXECUTABLE_NOT_FOUND);
}
SECTION("GetBaseProfile returns OK") {
NvDRSSessionHandle handle{};
NvDRSProfileHandle profile;
REQUIRE(NvAPI_DRS_GetBaseProfile(handle, &profile) == NVAPI_OK);
}
SECTION("GetSetting returns setting-not-found") {
struct Data {
int32_t settingId;
};
auto args = GENERATE(
Data{FXAA_ALLOW_ID},
Data{CUDA_EXCLUDED_GPUS_ID},
Data{0x12345678});
NvDRSSessionHandle handle{};
NvDRSProfileHandle profile{};
NVDRS_SETTING setting;
REQUIRE(NvAPI_DRS_GetSetting(handle, profile, args.settingId, &setting) == NVAPI_SETTING_NOT_FOUND);
}
SECTION("DestroySession returns OK") {
NvDRSSessionHandle handle{};
REQUIRE(NvAPI_DRS_DestroySession(handle) == NVAPI_OK);
}
}
|