mirror of
https://github.com/djhackersdev/bemanitools.git
synced 2026-08-22 08:24:02 -05:00
chore: Remove now obselete tests for cconfig
Due to the deprecation of cconfig, these are no longer needed.
This commit is contained in:
@@ -208,9 +208,7 @@ include src/main/vigem-sdvxio/Module.mk
|
||||
include src/main/vigem-ddrio/Module.mk
|
||||
include src/main/vigemstub/Module.mk
|
||||
|
||||
include src/test/cconfig/Module.mk
|
||||
include src/test/d3d9hook/Module.mk
|
||||
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
|
||||
@@ -906,15 +904,8 @@ $(zipdir)/doc.zip: \
|
||||
$(BUILDDIR)/tests.zip: \
|
||||
build/bin/indep-32/iidxhook1.dll \
|
||||
build/bin/avs2_0-32/iidxhook2.dll \
|
||||
build/bin/indep-32/cconfig-test.exe \
|
||||
build/bin/indep-32/cconfig-util-test.exe \
|
||||
build/bin/indep-32/cconfig-cmd-test.exe \
|
||||
build/bin/indep-32/d3d9hook.dll \
|
||||
build/bin/indep-32/d3d9hook-test.exe \
|
||||
build/bin/indep-32/iidxhook-util-config-eamuse-test.exe \
|
||||
build/bin/indep-32/iidxhook-util-config-gfx-test.exe \
|
||||
build/bin/indep-32/iidxhook-util-config-misc-test.exe \
|
||||
build/bin/indep-32/iidxhook-util-config-sec-test.exe \
|
||||
dist/dwarfstack/32/dwarfstack.dll \
|
||||
build/bin/indep-32/inject.exe \
|
||||
build/bin/indep-32/security-id-test.exe \
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
testexes += cconfig-test
|
||||
|
||||
srcdir_cconfig-test := src/test/cconfig
|
||||
|
||||
libs_cconfig-test := \
|
||||
core \
|
||||
cconfig \
|
||||
test \
|
||||
util \
|
||||
iface-core \
|
||||
|
||||
src_cconfig-test := \
|
||||
cconfig-test.c \
|
||||
|
||||
################################################################################
|
||||
|
||||
testexes += cconfig-util-test
|
||||
|
||||
srcdir_cconfig-util-test := src/test/cconfig
|
||||
|
||||
libs_cconfig-util-test := \
|
||||
core \
|
||||
cconfig \
|
||||
test \
|
||||
util \
|
||||
iface-core \
|
||||
|
||||
src_cconfig-util-test := \
|
||||
cconfig-util-test.c \
|
||||
|
||||
################################################################################
|
||||
|
||||
testexes += cconfig-cmd-test
|
||||
|
||||
srcdir_cconfig-cmd-test := src/test/cconfig
|
||||
|
||||
libs_cconfig-cmd-test := \
|
||||
core \
|
||||
cconfig \
|
||||
test \
|
||||
util \
|
||||
iface-core \
|
||||
|
||||
src_cconfig-cmd-test := \
|
||||
cconfig-cmd-test.c \
|
||||
|
||||
################################################################################
|
||||
@@ -1,66 +0,0 @@
|
||||
#include "cconfig/cconfig-util.h"
|
||||
#include "cconfig/cmd.h"
|
||||
|
||||
#include "test/check.h"
|
||||
#include "test/test.h"
|
||||
|
||||
static void test_cmd()
|
||||
{
|
||||
struct cconfig *config;
|
||||
int argc = 6;
|
||||
char *argv[] = {"-P", "test=aaa", "-C", "asdf", "-P", "test2=123"};
|
||||
char str[32];
|
||||
int32_t val;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
check_bool_true(cconfig_cmd_parse(config, "-P", argc, argv, true));
|
||||
|
||||
check_int_eq(config->nentries, 2);
|
||||
|
||||
check_bool_true(
|
||||
cconfig_util_get_str(config, "test", str, sizeof(str), "1"));
|
||||
check_str_eq(str, "aaa");
|
||||
|
||||
check_bool_true(cconfig_util_get_int(config, "test2", &val, 0));
|
||||
check_int_eq(val, 123);
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
static void test_cmd_absent_entries()
|
||||
{
|
||||
struct cconfig *config;
|
||||
int argc = 6;
|
||||
char *argv[] = {"-P", "test=aaa", "-C", "asdf", "-P", "test2=123"};
|
||||
char str[32];
|
||||
int32_t val;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
cconfig_set2(config, "test", "aaa");
|
||||
|
||||
check_bool_true(cconfig_cmd_parse(config, "-P", argc, argv, false));
|
||||
|
||||
check_int_eq(config->nentries, 1);
|
||||
|
||||
check_bool_true(
|
||||
cconfig_util_get_str(config, "test", str, sizeof(str), "1"));
|
||||
check_str_eq(str, "aaa");
|
||||
|
||||
check_bool_false(cconfig_util_get_int(config, "test2", &val, 0));
|
||||
check_int_eq(val, 0);
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
TEST_MODULE_BEGIN("cconfig-cmd")
|
||||
TEST_MODULE_TEST(test_cmd)
|
||||
TEST_MODULE_TEST(test_cmd_absent_entries)
|
||||
TEST_MODULE_END()
|
||||
@@ -1,156 +0,0 @@
|
||||
#include "cconfig/cconfig.h"
|
||||
|
||||
#include "test/check.h"
|
||||
#include "test/test.h"
|
||||
|
||||
static void test_init()
|
||||
{
|
||||
struct cconfig *config;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
static void test_get_empty()
|
||||
{
|
||||
struct cconfig *config;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
check_null(cconfig_get(config, "test"));
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
static void test_set_get_one_elem()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct cconfig_entry *entry;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
cconfig_set(config, "test", "123", "desc");
|
||||
|
||||
check_int_eq(config->nentries, 1);
|
||||
check_str_eq(config->entries[0].key, "test");
|
||||
check_str_eq(config->entries[0].value, "123");
|
||||
check_str_eq(config->entries[0].desc, "desc");
|
||||
|
||||
entry = cconfig_get(config, "test");
|
||||
|
||||
check_str_eq(entry->key, "test");
|
||||
check_str_eq(entry->value, "123");
|
||||
check_str_eq(entry->desc, "desc");
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
static void test_set_get_one_elem2()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct cconfig_entry *entry;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
cconfig_set2(config, "test", "123");
|
||||
|
||||
check_int_eq(config->nentries, 1);
|
||||
check_str_eq(config->entries[0].key, "test");
|
||||
check_str_eq(config->entries[0].value, "123");
|
||||
check_str_eq(config->entries[0].desc, "");
|
||||
|
||||
entry = cconfig_get(config, "test");
|
||||
|
||||
check_str_eq(entry->key, "test");
|
||||
check_str_eq(entry->value, "123");
|
||||
check_str_eq(entry->desc, "");
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
static void test_set_get_same_elem()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct cconfig_entry *entry;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
cconfig_set(config, "test", "123", "desc");
|
||||
cconfig_set(config, "test", "12345", "aaa");
|
||||
|
||||
check_int_eq(config->nentries, 1);
|
||||
|
||||
check_str_eq(config->entries[0].key, "test");
|
||||
check_str_eq(config->entries[0].value, "12345");
|
||||
check_str_eq(config->entries[0].desc, "aaa");
|
||||
|
||||
entry = cconfig_get(config, "test");
|
||||
|
||||
check_str_eq(entry->key, "test");
|
||||
check_str_eq(entry->value, "12345");
|
||||
check_str_eq(entry->desc, "aaa");
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
static void test_set_get_many_elem()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct cconfig_entry *entry;
|
||||
char key[16];
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
sprintf(key, "%d", i);
|
||||
cconfig_set(config, key, "123", "desc");
|
||||
}
|
||||
|
||||
check_int_eq(config->nentries, 1000);
|
||||
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
sprintf(key, "%d", i);
|
||||
check_str_eq(config->entries[i].key, key);
|
||||
check_str_eq(config->entries[i].value, "123");
|
||||
check_str_eq(config->entries[i].desc, "desc");
|
||||
}
|
||||
|
||||
for (int i = 0; i < 1000; i++) {
|
||||
sprintf(key, "%d", i);
|
||||
entry = cconfig_get(config, key);
|
||||
|
||||
check_str_eq(entry->key, key);
|
||||
check_str_eq(entry->value, "123");
|
||||
check_str_eq(entry->desc, "desc");
|
||||
}
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
TEST_MODULE_BEGIN("cconfig")
|
||||
TEST_MODULE_TEST(test_init)
|
||||
TEST_MODULE_TEST(test_get_empty)
|
||||
TEST_MODULE_TEST(test_set_get_one_elem)
|
||||
TEST_MODULE_TEST(test_set_get_one_elem2)
|
||||
TEST_MODULE_TEST(test_set_get_same_elem)
|
||||
TEST_MODULE_TEST(test_set_get_many_elem)
|
||||
TEST_MODULE_END()
|
||||
@@ -1,220 +0,0 @@
|
||||
#include "cconfig/cconfig-util.h"
|
||||
#include "cconfig/cconfig.h"
|
||||
|
||||
#include "test/check.h"
|
||||
#include "test/test.h"
|
||||
|
||||
static void test_set_get_int()
|
||||
{
|
||||
struct cconfig *config;
|
||||
int32_t value;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
cconfig_util_set_int(config, "test", 12345, "desc");
|
||||
|
||||
check_int_eq(config->nentries, 1);
|
||||
check_str_eq(config->entries[0].key, "test");
|
||||
check_str_eq(config->entries[0].value, "12345");
|
||||
check_str_eq(config->entries[0].desc, "desc");
|
||||
|
||||
check_bool_true(cconfig_util_get_int(config, "test", &value, 0));
|
||||
check_int_eq(value, 12345);
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
static void test_get_int_na()
|
||||
{
|
||||
struct cconfig *config;
|
||||
int32_t value;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
check_bool_false(cconfig_util_get_int(config, "test", &value, 123));
|
||||
check_int_eq(value, 123);
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
static void test_set_get_float()
|
||||
{
|
||||
struct cconfig *config;
|
||||
float value;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
cconfig_util_set_float(config, "test", 100.5f, "desc");
|
||||
|
||||
check_int_eq(config->nentries, 1);
|
||||
check_str_eq(config->entries[0].key, "test");
|
||||
check_str_eq(config->entries[0].desc, "desc");
|
||||
|
||||
check_bool_true(cconfig_util_get_float(config, "test", &value, 0));
|
||||
check_float_eq(value, 100.5f, 0.1f);
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
static void test_get_float_na()
|
||||
{
|
||||
struct cconfig *config;
|
||||
float value;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
check_bool_false(cconfig_util_get_float(config, "test", &value, 115.9f));
|
||||
check_float_eq(value, 115.9f, 0.1f);
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
static void test_set_get_bool()
|
||||
{
|
||||
struct cconfig *config;
|
||||
bool value;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
cconfig_util_set_bool(config, "test", true, "desc");
|
||||
|
||||
check_int_eq(config->nentries, 1);
|
||||
check_str_eq(config->entries[0].key, "test");
|
||||
check_str_eq(config->entries[0].desc, "desc");
|
||||
|
||||
check_bool_true(cconfig_util_get_bool(config, "test", &value, 0));
|
||||
check_bool_true(value);
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
static void test_get_bool_na()
|
||||
{
|
||||
struct cconfig *config;
|
||||
bool value;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
check_bool_false(cconfig_util_get_bool(config, "test", &value, true));
|
||||
check_bool_true(value);
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
static void test_set_get_str()
|
||||
{
|
||||
struct cconfig *config;
|
||||
char value[1024];
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
cconfig_util_set_str(config, "test", "hello world", "desc");
|
||||
|
||||
check_int_eq(config->nentries, 1);
|
||||
check_str_eq(config->entries[0].key, "test");
|
||||
check_str_eq(config->entries[0].desc, "desc");
|
||||
|
||||
check_bool_true(cconfig_util_get_str(
|
||||
config, "test", value, sizeof(value), "world hello"));
|
||||
check_str_eq(value, "hello world");
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
static void test_get_str_na()
|
||||
{
|
||||
struct cconfig *config;
|
||||
char value[1024];
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
check_bool_false(cconfig_util_get_str(
|
||||
config, "test", value, sizeof(value), "world hello"));
|
||||
check_str_eq(value, "world hello");
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
static void test_set_get_data()
|
||||
{
|
||||
struct cconfig *config;
|
||||
uint8_t value[1024];
|
||||
uint8_t value2[1024];
|
||||
uint8_t value_default[] = {0x00};
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
for (int i = 0; i < sizeof(value); i++) {
|
||||
value[i] = (uint8_t) i;
|
||||
}
|
||||
|
||||
cconfig_util_set_data(config, "test", value, sizeof(value), "desc");
|
||||
|
||||
check_int_eq(config->nentries, 1);
|
||||
check_str_eq(config->entries[0].key, "test");
|
||||
check_str_eq(config->entries[0].desc, "desc");
|
||||
|
||||
check_bool_true(cconfig_util_get_data(
|
||||
config, "test", value2, sizeof(value2), value_default));
|
||||
check_data_eq(value2, sizeof(value2), value, sizeof(value));
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
static void test_get_data_na()
|
||||
{
|
||||
struct cconfig *config;
|
||||
uint8_t value[1024];
|
||||
uint8_t value_default[] = {0x01};
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
check_int_eq(config->nentries, 0);
|
||||
check_null(config->entries);
|
||||
|
||||
check_bool_false(cconfig_util_get_data(
|
||||
config, "test", value, sizeof(value), value_default));
|
||||
check_data_eq(value, 1, value_default, sizeof(value_default));
|
||||
|
||||
cconfig_finit(config);
|
||||
}
|
||||
|
||||
TEST_MODULE_BEGIN("cconfig-util")
|
||||
TEST_MODULE_TEST(test_set_get_int)
|
||||
TEST_MODULE_TEST(test_get_int_na)
|
||||
TEST_MODULE_TEST(test_set_get_float)
|
||||
TEST_MODULE_TEST(test_get_float_na)
|
||||
TEST_MODULE_TEST(test_set_get_bool)
|
||||
TEST_MODULE_TEST(test_get_bool_na)
|
||||
TEST_MODULE_TEST(test_set_get_str)
|
||||
TEST_MODULE_TEST(test_get_str_na)
|
||||
TEST_MODULE_TEST(test_set_get_data)
|
||||
TEST_MODULE_TEST(test_get_data_na)
|
||||
TEST_MODULE_END()
|
||||
@@ -1,74 +0,0 @@
|
||||
testexes += iidxhook-util-config-eamuse-test
|
||||
|
||||
srcdir_iidxhook-util-config-eamuse-test := src/test/iidxhook-util
|
||||
|
||||
ldflags_iidxhook-util-config-eamuse-test := \
|
||||
-lws2_32 \
|
||||
|
||||
libs_iidxhook-util-config-eamuse-test := \
|
||||
core \
|
||||
security \
|
||||
iidxhook-util \
|
||||
cconfig \
|
||||
test \
|
||||
util \
|
||||
iface-core \
|
||||
|
||||
src_iidxhook-util-config-eamuse-test := \
|
||||
iidxhook-util-config-eamuse-test.c \
|
||||
|
||||
################################################################################
|
||||
|
||||
testexes += iidxhook-util-config-gfx-test
|
||||
|
||||
srcdir_iidxhook-util-config-gfx-test := src/test/iidxhook-util
|
||||
|
||||
libs_iidxhook-util-config-gfx-test := \
|
||||
core \
|
||||
security \
|
||||
iidxhook-util \
|
||||
cconfig \
|
||||
test \
|
||||
util \
|
||||
iface-core \
|
||||
|
||||
src_iidxhook-util-config-gfx-test := \
|
||||
iidxhook-util-config-gfx-test.c \
|
||||
|
||||
################################################################################
|
||||
|
||||
testexes += iidxhook-util-config-misc-test
|
||||
|
||||
srcdir_iidxhook-util-config-misc-test := src/test/iidxhook-util
|
||||
|
||||
libs_iidxhook-util-config-misc-test := \
|
||||
core \
|
||||
security \
|
||||
iidxhook-util \
|
||||
cconfig \
|
||||
test \
|
||||
util \
|
||||
iface-core \
|
||||
|
||||
src_iidxhook-util-config-misc-test := \
|
||||
iidxhook-util-config-misc-test.c \
|
||||
|
||||
################################################################################
|
||||
|
||||
testexes += iidxhook-util-config-sec-test
|
||||
|
||||
srcdir_iidxhook-util-config-sec-test := src/test/iidxhook-util
|
||||
|
||||
libs_iidxhook-util-config-sec-test := \
|
||||
core \
|
||||
security \
|
||||
iidxhook-util \
|
||||
cconfig \
|
||||
test \
|
||||
util \
|
||||
iface-core \
|
||||
|
||||
src_iidxhook-util-config-sec-test := \
|
||||
iidxhook-util-config-sec-test.c \
|
||||
|
||||
################################################################################
|
||||
@@ -1,92 +0,0 @@
|
||||
#include "iidxhook-util/config-eamuse.h"
|
||||
|
||||
#include "test/check.h"
|
||||
#include "test/test.h"
|
||||
|
||||
/* We don't care about cleaning up some of the memory to avoid cluttering
|
||||
the tests */
|
||||
|
||||
static void test_config_eamuse_defaults()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook_util_config_eamuse config_eamuse;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_util_config_eamuse_init(config);
|
||||
iidxhook_util_config_eamuse_get(&config_eamuse, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_str_eq(config_eamuse.card_type, "C02");
|
||||
check_str_eq(net_addr_to_str(&config_eamuse.server), "localhost:80");
|
||||
check_str_eq(
|
||||
security_id_to_str(&config_eamuse.pcbid, false),
|
||||
"0101020304050607086F");
|
||||
check_str_eq(
|
||||
security_id_to_str(&config_eamuse.eamid, false),
|
||||
"0101020304050607086F");
|
||||
}
|
||||
|
||||
static void test_config_eamuse()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook_util_config_eamuse config_eamuse;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_util_config_eamuse_init(config);
|
||||
|
||||
cconfig_set2(config, "eamuse.card_type", "D01");
|
||||
cconfig_set2(config, "eamuse.server", "http://myServer.com/legacy");
|
||||
cconfig_set2(config, "eamuse.pcbid", "0101020304050607086F");
|
||||
cconfig_set2(config, "eamuse.eamid", "0101020304050607086F");
|
||||
|
||||
iidxhook_util_config_eamuse_get(&config_eamuse, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_str_eq(config_eamuse.card_type, "D01");
|
||||
check_str_eq(
|
||||
net_addr_to_str(&config_eamuse.server), "http://myServer.com/legacy");
|
||||
check_str_eq(
|
||||
security_id_to_str(&config_eamuse.pcbid, false),
|
||||
"0101020304050607086F");
|
||||
check_str_eq(
|
||||
security_id_to_str(&config_eamuse.eamid, false),
|
||||
"0101020304050607086F");
|
||||
}
|
||||
|
||||
static void test_config_eamuse_invalid_values()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook_util_config_eamuse config_eamuse;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_util_config_eamuse_init(config);
|
||||
|
||||
cconfig_set2(config, "eamuse.card_type", "XXXX");
|
||||
cconfig_set2(config, "eamuse.server", "asdf");
|
||||
cconfig_set2(config, "eamuse.pcbid", "00000000000000000000");
|
||||
cconfig_set2(config, "eamuse.eamid", "00000000000000000000");
|
||||
|
||||
iidxhook_util_config_eamuse_get(&config_eamuse, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_str_eq(config_eamuse.card_type, "C02");
|
||||
check_str_eq(net_addr_to_str(&config_eamuse.server), "asdf");
|
||||
check_str_eq(
|
||||
security_id_to_str(&config_eamuse.pcbid, false),
|
||||
"00000000000000000000");
|
||||
check_str_eq(
|
||||
security_id_to_str(&config_eamuse.eamid, false),
|
||||
"00000000000000000000");
|
||||
}
|
||||
|
||||
TEST_MODULE_BEGIN("iidxhook-config-eamuse")
|
||||
TEST_MODULE_TEST(test_config_eamuse_defaults)
|
||||
TEST_MODULE_TEST(test_config_eamuse)
|
||||
TEST_MODULE_TEST(test_config_eamuse_invalid_values)
|
||||
TEST_MODULE_END()
|
||||
@@ -1,113 +0,0 @@
|
||||
#include "iidxhook-util/config-gfx.h"
|
||||
|
||||
#include "test/check.h"
|
||||
#include "test/test.h"
|
||||
|
||||
/* We don't care about cleaning up some of the memory to avoid cluttering
|
||||
the tests */
|
||||
|
||||
static void test_config_gfx_defaults()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook_config_gfx config_gfx;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_config_gfx_init(config);
|
||||
iidxhook_config_gfx_get(&config_gfx, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_bool_false(config_gfx.bgvideo_uv_fix);
|
||||
check_bool_false(config_gfx.framed);
|
||||
check_float_eq(config_gfx.frame_rate_limit, 0.0f, 0.1f);
|
||||
check_float_eq(config_gfx.monitor_check, -1.0f, 0.1f);
|
||||
check_int_eq(config_gfx.pci_id_vid, 0x1002);
|
||||
check_int_eq(config_gfx.pci_id_pid, 0x7146);
|
||||
check_bool_false(config_gfx.windowed);
|
||||
check_int_eq(config_gfx.scale_back_buffer_width, 0);
|
||||
check_int_eq(config_gfx.scale_back_buffer_height, 0);
|
||||
check_int_eq(
|
||||
config_gfx.scale_back_buffer_width,
|
||||
IIDXHOOK_UTIL_D3D9_BACK_BUFFER_SCALE_FILTER_NONE);
|
||||
}
|
||||
|
||||
static void test_config_gfx()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook_config_gfx config_gfx;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_config_gfx_init(config);
|
||||
|
||||
cconfig_set2(config, "gfx.bgvideo_uv_fix", "true");
|
||||
cconfig_set2(config, "gfx.framed", "true");
|
||||
cconfig_set2(config, "gfx.frame_rate_limit", "60.04");
|
||||
cconfig_set2(config, "gfx.monitor_check", "59.999");
|
||||
cconfig_set2(config, "gfx.pci_id", "1111:1234");
|
||||
cconfig_set2(config, "gfx.windowed", "true");
|
||||
cconfig_set2(config, "gfx.scale_back_buffer_width", "1920");
|
||||
cconfig_set2(config, "gfx.scale_back_buffer_height", "1080");
|
||||
cconfig_set2(config, "gfx.scale_back_buffer_filter", "linear");
|
||||
|
||||
iidxhook_config_gfx_get(&config_gfx, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_bool_true(config_gfx.bgvideo_uv_fix);
|
||||
check_bool_true(config_gfx.framed);
|
||||
check_float_eq(config_gfx.frame_rate_limit, 60.04f, 0.1f);
|
||||
check_float_eq(config_gfx.monitor_check, 59.999f, 0.001f);
|
||||
check_int_eq(config_gfx.pci_id_vid, 0x1111);
|
||||
check_int_eq(config_gfx.pci_id_pid, 0x1234);
|
||||
check_bool_true(config_gfx.windowed);
|
||||
check_int_eq(config_gfx.scale_back_buffer_width, 1920);
|
||||
check_int_eq(config_gfx.scale_back_buffer_height, 1080);
|
||||
check_int_eq(
|
||||
config_gfx.scale_back_buffer_filter,
|
||||
IIDXHOOK_UTIL_D3D9_BACK_BUFFER_SCALE_FILTER_LINEAR);
|
||||
}
|
||||
|
||||
static void test_config_gfx_invalid_values()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook_config_gfx config_gfx;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_config_gfx_init(config);
|
||||
|
||||
cconfig_set2(config, "gfx.bgvideo_uv_fix", "123");
|
||||
cconfig_set2(config, "gfx.framed", "aaa");
|
||||
cconfig_set2(config, "gfx.frame_rate_limit", "-1.0f");
|
||||
cconfig_set2(config, "gfx.monitor_check", "asdf");
|
||||
cconfig_set2(config, "gfx.pci_id", "11111234");
|
||||
cconfig_set2(config, "gfx.windowed", "-5");
|
||||
cconfig_set2(config, "gfx.scale_back_buffer_width", "asdf");
|
||||
cconfig_set2(config, "gfx.scale_back_buffer_height", "");
|
||||
cconfig_set2(config, "gfx.scale_back_buffer_filter", "ffff");
|
||||
|
||||
iidxhook_config_gfx_get(&config_gfx, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_bool_false(config_gfx.bgvideo_uv_fix);
|
||||
check_bool_false(config_gfx.framed);
|
||||
check_float_eq(config_gfx.frame_rate_limit, 0.0f, 0.1f);
|
||||
check_float_eq(config_gfx.monitor_check, -1.0f, 0.1f);
|
||||
check_int_eq(config_gfx.pci_id_vid, 0x1002);
|
||||
check_int_eq(config_gfx.pci_id_pid, 0x7146);
|
||||
check_bool_false(config_gfx.windowed);
|
||||
check_int_eq(config_gfx.scale_back_buffer_width, 0);
|
||||
check_int_eq(config_gfx.scale_back_buffer_height, 0);
|
||||
check_int_eq(
|
||||
config_gfx.scale_back_buffer_width,
|
||||
IIDXHOOK_UTIL_D3D9_BACK_BUFFER_SCALE_FILTER_NONE);
|
||||
}
|
||||
|
||||
TEST_MODULE_BEGIN("iidxhook-config-gfx")
|
||||
TEST_MODULE_TEST(test_config_gfx_defaults)
|
||||
TEST_MODULE_TEST(test_config_gfx)
|
||||
TEST_MODULE_TEST(test_config_gfx_invalid_values)
|
||||
TEST_MODULE_END()
|
||||
@@ -1,69 +0,0 @@
|
||||
#include "iidxhook-util/config-misc.h"
|
||||
|
||||
#include "test/check.h"
|
||||
#include "test/test.h"
|
||||
|
||||
/* We don't care about cleaning up some of the memory to avoid cluttering the
|
||||
* tests */
|
||||
|
||||
static void test_config_misc_defaults()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook_config_misc config_misc;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_config_misc_init(config);
|
||||
iidxhook_config_misc_get(&config_misc, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_bool_false(config_misc.disable_clock_set);
|
||||
check_bool_false(config_misc.rteffect_stub);
|
||||
}
|
||||
|
||||
static void test_config_misc()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook_config_misc config_misc;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_config_misc_init(config);
|
||||
|
||||
cconfig_set2(config, "misc.disable_clock_set", "true");
|
||||
cconfig_set2(config, "misc.rteffect_stub", "true");
|
||||
|
||||
iidxhook_config_misc_get(&config_misc, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_bool_true(config_misc.disable_clock_set);
|
||||
check_bool_true(config_misc.rteffect_stub);
|
||||
}
|
||||
|
||||
static void test_config_misc_invalid_values()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook_config_misc config_misc;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_config_misc_init(config);
|
||||
|
||||
cconfig_set2(config, "misc.disable_clock_set", "asdf");
|
||||
cconfig_set2(config, "misc.rteffect_stub", "222");
|
||||
|
||||
iidxhook_config_misc_get(&config_misc, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_bool_false(config_misc.disable_clock_set);
|
||||
check_bool_false(config_misc.rteffect_stub);
|
||||
}
|
||||
|
||||
TEST_MODULE_BEGIN("iidxhook-config-misc")
|
||||
TEST_MODULE_TEST(test_config_misc_defaults)
|
||||
TEST_MODULE_TEST(test_config_misc)
|
||||
TEST_MODULE_TEST(test_config_misc_invalid_values)
|
||||
TEST_MODULE_END()
|
||||
@@ -1,92 +0,0 @@
|
||||
#include "iidxhook-util/config-sec.h"
|
||||
|
||||
#include "test/check.h"
|
||||
#include "test/test.h"
|
||||
|
||||
/* We don't care about cleaning up some of the memory to avoid cluttering the
|
||||
* tests */
|
||||
|
||||
static void test_config_sec_defaults()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook_config_sec config_sec;
|
||||
const uint32_t boot_seeds[3] = {0, 0, 0};
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_config_sec_init(config);
|
||||
iidxhook_config_sec_get(&config_sec, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_str_eq(security_mcode_to_str(&config_sec.boot_version), "GEC02 ");
|
||||
check_data_eq(
|
||||
config_sec.boot_seeds,
|
||||
sizeof(config_sec.boot_seeds),
|
||||
(void *) boot_seeds,
|
||||
sizeof(boot_seeds));
|
||||
check_str_eq(
|
||||
security_mcode_to_str(&config_sec.black_plug_mcode), "GQC02JAA");
|
||||
}
|
||||
|
||||
static void test_config_sec()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook_config_sec config_sec;
|
||||
const uint32_t boot_seeds[3] = {1, 1, 1};
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_config_sec_init(config);
|
||||
|
||||
cconfig_set2(config, "sec.boot_version", "ASDFG ");
|
||||
cconfig_set2(config, "sec.boot_seeds", "1:1:1");
|
||||
cconfig_set2(config, "sec.black_plug_mcode", "GQD01JAB");
|
||||
|
||||
iidxhook_config_sec_get(&config_sec, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_str_eq(security_mcode_to_str(&config_sec.boot_version), "ASDFG ");
|
||||
check_data_eq(
|
||||
config_sec.boot_seeds,
|
||||
sizeof(config_sec.boot_seeds),
|
||||
(void *) boot_seeds,
|
||||
sizeof(boot_seeds));
|
||||
check_str_eq(
|
||||
security_mcode_to_str(&config_sec.black_plug_mcode), "GQD01JAB");
|
||||
}
|
||||
|
||||
static void test_config_sec_invalid_values()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook_config_sec config_sec;
|
||||
const uint32_t boot_seeds[3] = {0, 0, 0};
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_config_sec_init(config);
|
||||
|
||||
cconfig_set2(config, "sec.boot_version", "ASDFG1234");
|
||||
cconfig_set2(config, "sec.boot_seeds", "1:11");
|
||||
cconfig_set2(config, "sec.black_plug_mcode", "GQD01JABA");
|
||||
|
||||
iidxhook_config_sec_get(&config_sec, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_str_eq(security_mcode_to_str(&config_sec.boot_version), "GEC02 ");
|
||||
check_data_eq(
|
||||
config_sec.boot_seeds,
|
||||
sizeof(config_sec.boot_seeds),
|
||||
(void *) boot_seeds,
|
||||
sizeof(boot_seeds));
|
||||
check_str_eq(
|
||||
security_mcode_to_str(&config_sec.black_plug_mcode), "GQC02JAA");
|
||||
}
|
||||
|
||||
TEST_MODULE_BEGIN("iidxhook-config-sec")
|
||||
TEST_MODULE_TEST(test_config_sec_defaults)
|
||||
TEST_MODULE_TEST(test_config_sec)
|
||||
TEST_MODULE_TEST(test_config_sec_invalid_values)
|
||||
TEST_MODULE_END()
|
||||
@@ -1,33 +0,0 @@
|
||||
testexes += iidxhook-config-iidxhook1-test
|
||||
|
||||
srcdir_iidxhook-config-iidxhook1-test := src/test/iidxhook
|
||||
|
||||
libs_iidxhook-config-iidxhook1-test := \
|
||||
core \
|
||||
cconfig \
|
||||
iidxhook1 \
|
||||
test \
|
||||
util \
|
||||
iface-core \
|
||||
|
||||
src_iidxhook-config-iidxhook1-test := \
|
||||
iidxhook-config-iidxhook1-test.c \
|
||||
|
||||
################################################################################
|
||||
|
||||
testexes += iidxhook-config-iidxhook2-test
|
||||
|
||||
srcdir_iidxhook-config-iidxhook2-test := src/test/iidxhook
|
||||
|
||||
libs_iidxhook-config-iidxhook2-test := \
|
||||
core \
|
||||
iidxhook2 \
|
||||
cconfig \
|
||||
test \
|
||||
util \
|
||||
iface-core \
|
||||
|
||||
src_iidxhook-config-iidxhook2-test := \
|
||||
iidxhook-config-iidxhook2-test.c \
|
||||
|
||||
################################################################################
|
||||
@@ -1,64 +0,0 @@
|
||||
#include "iidxhook1/config-iidxhook1.h"
|
||||
|
||||
#include "test/check.h"
|
||||
#include "test/test.h"
|
||||
|
||||
/* We don't care about cleaning up some of the memory to avoid cluttering the
|
||||
* tests */
|
||||
|
||||
static void test_config_iidxhook1_defaults()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook_config_iidxhook1 config_iidxhook1;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_config_iidxhook1_init(config);
|
||||
iidxhook_config_iidxhook1_get(&config_iidxhook1, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_bool_false(config_iidxhook1.happy_sky_ms_bg_fix);
|
||||
}
|
||||
|
||||
static void test_config_iidxhook1()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook_config_iidxhook1 config_iidxhook1;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_config_iidxhook1_init(config);
|
||||
|
||||
cconfig_set2(config, "misc.happy_sky_ms_bg_fix", "true");
|
||||
|
||||
iidxhook_config_iidxhook1_get(&config_iidxhook1, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_bool_true(config_iidxhook1.happy_sky_ms_bg_fix);
|
||||
}
|
||||
|
||||
static void test_config_iidxhook1_invalid_values()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook_config_iidxhook1 config_iidxhook1;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_config_iidxhook1_init(config);
|
||||
|
||||
cconfig_set2(config, "misc.happy_sky_ms_bg_fix", "123");
|
||||
|
||||
iidxhook_config_iidxhook1_get(&config_iidxhook1, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_bool_false(config_iidxhook1.happy_sky_ms_bg_fix);
|
||||
}
|
||||
|
||||
TEST_MODULE_BEGIN("iidxhook-config-iidxhook1")
|
||||
TEST_MODULE_TEST(test_config_iidxhook1_defaults)
|
||||
TEST_MODULE_TEST(test_config_iidxhook1)
|
||||
TEST_MODULE_TEST(test_config_iidxhook1_invalid_values)
|
||||
TEST_MODULE_END()
|
||||
@@ -1,64 +0,0 @@
|
||||
#include "iidxhook2/config-iidxhook2.h"
|
||||
|
||||
#include "test/check.h"
|
||||
#include "test/test.h"
|
||||
|
||||
/* We don't care about cleaning up some of the memory to avoid cluttering the
|
||||
* tests */
|
||||
|
||||
static void test_config_iidxhook2_defaults()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook_config_iidxhook2 config_iidxhook2;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_config_iidxhook2_init(config);
|
||||
iidxhook_config_iidxhook2_get(&config_iidxhook2, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_bool_false(config_iidxhook2.distorted_ms_bg_fix);
|
||||
}
|
||||
|
||||
static void test_config_iidxhook2()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook_config_iidxhook2 config_iidxhook2;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_config_iidxhook2_init(config);
|
||||
|
||||
cconfig_set2(config, "misc.distorted_ms_bg_fix", "true");
|
||||
|
||||
iidxhook_config_iidxhook2_get(&config_iidxhook2, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_bool_true(config_iidxhook2.distorted_ms_bg_fix);
|
||||
}
|
||||
|
||||
static void test_config_iidxhook2_invalid_values()
|
||||
{
|
||||
struct cconfig *config;
|
||||
struct iidxhook_config_iidxhook2 config_iidxhook2;
|
||||
|
||||
config = cconfig_init();
|
||||
|
||||
iidxhook_config_iidxhook2_init(config);
|
||||
|
||||
cconfig_set2(config, "misc.distorted_ms_bg_fix", "123");
|
||||
|
||||
iidxhook_config_iidxhook2_get(&config_iidxhook2, config);
|
||||
|
||||
cconfig_finit(config);
|
||||
|
||||
check_bool_false(config_iidxhook2.distorted_ms_bg_fix);
|
||||
}
|
||||
|
||||
TEST_MODULE_BEGIN("iidxhook-config-iidxhook2")
|
||||
TEST_MODULE_TEST(test_config_iidxhook2_defaults)
|
||||
TEST_MODULE_TEST(test_config_iidxhook2)
|
||||
TEST_MODULE_TEST(test_config_iidxhook2_invalid_values)
|
||||
TEST_MODULE_END()
|
||||
Reference in New Issue
Block a user