Files
Triforce-Source/tests/test_gpu_choice.cpp
ruckus7382sfgsgdf 34b3683441 Triforce v0.2.0
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-10 19:32:48 -06:00

16 lines
655 B
C++

#include "../gpu/vk/gpu_choice.h"
#include <cstdio>
#define CHECK(name, condition) do { if (!(condition)) { std::fprintf(stderr, "FAIL %s at line %d\n", name, __LINE__); return 1; } } while (0)
int main() {
using mkwvk::gpu_choice::menu_device;
CHECK("Auto stays Auto", menu_device(0, 2) == -1);
CHECK("the n-th usable GPU", menu_device(1, 2) == 0 && menu_device(2, 2) == 1);
CHECK("a GPU taken out since is Auto", menu_device(2, 1) == -1);
CHECK("a negative choice (a hand-edited ini) is Auto", menu_device(-1, 2) == -1);
CHECK("no usable GPU: Auto", menu_device(1, 0) == -1);
std::puts("gpu choice: all checks passed");
}