Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/jp7677/dxvk-nvapi.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorJens Peters <jp7677@gmail.com>2022-02-11 16:53:38 +0300
committerJens Peters <jp7677@gmail.com>2022-02-11 19:04:39 +0300
commit4362553b53aa754300d56216a21fc2a76bbaca49 (patch)
tree8d7cb7d671bf374225df15390530c65802357cd1 /tests
parent672188139cdf9d4ba21cc2c902cc6681756fe6d4 (diff)
tests: Add DRS tests
Diffstat (limited to 'tests')
-rw-r--r--tests/main.cpp4
-rw-r--r--tests/nvapi_drs.cpp54
-rw-r--r--tests/nvapi_tests.cpp2
3 files changed, 58 insertions, 2 deletions
diff --git a/tests/main.cpp b/tests/main.cpp
index 82111e3..328f533 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -1,6 +1,6 @@
#define CATCH_CONFIG_MAIN
#include "../inc/catch.hpp"
-CATCH_REGISTER_TAG_ALIAS("[@unit-tests]", "[d3d],[d3d11],[d3d12],[sysinfo]")
+CATCH_REGISTER_TAG_ALIAS("[@unit-tests]", "[d3d],[d3d11],[d3d12],[drs],[sysinfo]")
CATCH_REGISTER_TAG_ALIAS("[@system]", "[system]")
-CATCH_REGISTER_TAG_ALIAS("[@all]", "[d3d],[d3d11],[d3d12],[sysinfo],[system]")
+CATCH_REGISTER_TAG_ALIAS("[@all]", "[d3d],[d3d11],[d3d12],[drs],[sysinfo],[system]")
diff --git a/tests/nvapi_drs.cpp b/tests/nvapi_drs.cpp
new file mode 100644
index 0000000..ec89388
--- /dev/null
+++ b/tests/nvapi_drs.cpp
@@ -0,0 +1,54 @@
+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{0x1234});
+
+ 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);
+ }
+}
diff --git a/tests/nvapi_tests.cpp b/tests/nvapi_tests.cpp
index 20c5088..8ed3275 100644
--- a/tests/nvapi_tests.cpp
+++ b/tests/nvapi_tests.cpp
@@ -7,6 +7,7 @@
#include "../src/nvapi_d3d.cpp"
#include "../src/nvapi_d3d11.cpp"
#include "../src/nvapi_d3d12.cpp"
+#include "../src/nvapi_drs.cpp"
#include "../src/nvapi.cpp"
#include "../src/nvapi_sys.cpp"
#include "../src/nvapi_gpu.cpp"
@@ -22,4 +23,5 @@
#include "nvapi_d3d.cpp"
#include "nvapi_d3d11.cpp"
#include "nvapi_d3d12.cpp"
+#include "nvapi_drs.cpp"
#include "nvapi_sysinfo.cpp"