mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2024-11-28 00:10:51 +01:00
camhook: fixup some minor formatting and enable iidxhook8-config-cam-test
This commit is contained in:
parent
b434d7975d
commit
2011bfafd6
@ -147,6 +147,7 @@ include src/test/iidxhook-util/Module.mk
|
||||
include src/test/security/Module.mk
|
||||
include src/test/test/Module.mk
|
||||
include src/test/util/Module.mk
|
||||
include src/test/iidxhook8/Module.mk
|
||||
|
||||
#
|
||||
# Distribution build rules
|
||||
@ -480,6 +481,7 @@ $(BUILDDIR)/tests.zip: \
|
||||
build/bin/indep-32/security-rp3-test.exe \
|
||||
build/bin/indep-32/security-util-test.exe \
|
||||
build/bin/indep-32/util-net-test.exe \
|
||||
build/bin/indep-64/iidxhook8-config-cam-test.exe \
|
||||
dist/test/run-tests.sh \
|
||||
| $(zipdir)/
|
||||
$(V)echo ... $@
|
||||
|
@ -793,6 +793,7 @@ void camhook_init(struct camhook_config_cam *config_cam)
|
||||
}
|
||||
|
||||
size_t num_setup = 0;
|
||||
|
||||
for (size_t i = 0; i < config_cam->num_devices; ++i) {
|
||||
if (camData[i].setup) {
|
||||
num_setup++;
|
||||
|
@ -7,6 +7,8 @@
|
||||
#define CAMHOOK_CONFIG_CAM_DISABLE_EMU_KEY "cam.disable_emu"
|
||||
#define CAMHOOK_CONFIG_CAM_DEFAULT_DISABLE_EMU_VALUE false
|
||||
|
||||
// the following two arrays are based on CAMHOOK_CONFIG_CAM_MAX
|
||||
// please insert more elements if more cams are added
|
||||
const char *camhook_config_device_id_keys[CAMHOOK_CONFIG_CAM_MAX] = {
|
||||
"cam.device_id1",
|
||||
"cam.device_id2",
|
||||
|
@ -3,6 +3,7 @@ testexes += iidxhook8-config-cam-test
|
||||
srcdir_iidxhook8-config-cam-test := src/test/iidxhook8
|
||||
|
||||
libs_iidxhook8-config-cam-test := \
|
||||
camhook \
|
||||
cconfig \
|
||||
test \
|
||||
util \
|
||||
|
@ -1,4 +1,4 @@
|
||||
#include "iidxhook8/config-cam.h"
|
||||
#include "camhook/config-cam.h"
|
||||
|
||||
#include "test/check.h"
|
||||
#include "test/test.h"
|
||||
@ -9,65 +9,65 @@
|
||||
static void test_config_cam_defaults()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook8_config_cam config_cam;
|
||||
struct camhook_config_cam config_cam;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook8_config_cam_init(config);
|
||||
iidxhook8_config_cam_get(&config_cam, config);
|
||||
camhook_config_cam_init(config, 2);
|
||||
camhook_config_cam_get(&config_cam, config, 2);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_bool_false(config_cam.disable_emu);
|
||||
check_str_eq(config_cam.device_id1, "");
|
||||
check_str_eq(config_cam.device_id2, "");
|
||||
check_str_eq(config_cam.device_id[0], "");
|
||||
check_str_eq(config_cam.device_id[1], "");
|
||||
}
|
||||
|
||||
static void test_config_cam()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook8_config_cam config_cam;
|
||||
struct camhook_config_cam config_cam;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook8_config_cam_init(config);
|
||||
camhook_config_cam_init(config, 2);
|
||||
|
||||
cconfig_set2(config, "cam.disable_emu", "true");
|
||||
cconfig_set2(config, "cam.device_id1", "asdjkasd");
|
||||
cconfig_set2(config, "cam.device_id2", "1234");
|
||||
|
||||
iidxhook8_config_cam_get(&config_cam, config);
|
||||
camhook_config_cam_get(&config_cam, config, 2);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_bool_true(config_cam.disable_emu);
|
||||
check_str_eq(config_cam.device_id1, "asdjkasd");
|
||||
check_str_eq(config_cam.device_id2, "1234");
|
||||
check_str_eq(config_cam.device_id[0], "asdjkasd");
|
||||
check_str_eq(config_cam.device_id[1], "1234");
|
||||
}
|
||||
|
||||
static void test_config_invalid_values()
|
||||
static void test_config_cam_invalid_values()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook8_config_cam config_cam;
|
||||
struct camhook_config_cam config_cam;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook8_config_cam_init(config);
|
||||
camhook_config_cam_init(config, 2);
|
||||
|
||||
cconfig_set2(config, "cam.disable_emu", "123");
|
||||
cconfig_set2(config, "cam.device_id1", "asdjkasd");
|
||||
cconfig_set2(config, "cam.device_id2", "1234");
|
||||
|
||||
iidxhook8_config_cam_get(&config_cam, config);
|
||||
camhook_config_cam_get(&config_cam, config, 2);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_bool_fakse(config_cam.disable_emu);
|
||||
check_str_eq(config_cam.device_id1, "asdjkasd");
|
||||
check_str_eq(config_cam.device_id2, "1234");
|
||||
check_bool_false(config_cam.disable_emu);
|
||||
check_str_eq(config_cam.device_id[0], "asdjkasd");
|
||||
check_str_eq(config_cam.device_id[1], "1234");
|
||||
}
|
||||
|
||||
TEST_MODULE_BEGIN("iidxhook8-config-cam")
|
||||
TEST_MODULE_BEGIN("camhook-config-cam")
|
||||
TEST_MODULE_TEST(test_config_cam_defaults)
|
||||
TEST_MODULE_TEST(test_config_cam)
|
||||
TEST_MODULE_TEST(test_config_cam_invalid_values)
|
||||
|
@ -45,7 +45,7 @@ static void test_config_io()
|
||||
check_bool_true(config_io.disable_poll_limiter);
|
||||
}
|
||||
|
||||
static void test_config_invalid_values()
|
||||
static void test_config_io_invalid_values()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook8_config_io config_io;
|
||||
|
Loading…
Reference in New Issue
Block a user