feat: add rack mode, colon commands, and client command parser
This commit is contained in:
committed by
Loic Coenen (aider)
parent
c7df02d37c
commit
9fda1b2669
@@ -14,56 +14,72 @@ static int tests_failed = 0;
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
static void test_plugin_load_null_binary(void)
|
||||
#define ASSERT_TRUE(expr, msg) do { \
|
||||
if (!(expr)) { \
|
||||
fprintf(stderr, "FAIL: %s\n", msg); \
|
||||
tests_failed++; \
|
||||
} else { \
|
||||
printf("PASS: %s\n", msg); \
|
||||
tests_passed++; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
static void test_plugin_load_null(void)
|
||||
{
|
||||
int id = -999;
|
||||
int ret = plugin_load(NULL, "someplugin", &id);
|
||||
ASSERT_EQ(-1, ret, "plugin_load(NULL, ...) returns -1");
|
||||
int ret = plugin_load(NULL, NULL, &id);
|
||||
ASSERT_EQ(-1, ret, "plugin_load(NULL, NULL, ...) returns -1");
|
||||
}
|
||||
|
||||
static void test_plugin_load_nonnull_binary(void)
|
||||
{
|
||||
int id = -999;
|
||||
int ret = plugin_load("/path/to/plugin.so", NULL, &id);
|
||||
ASSERT_EQ(-1, ret, "plugin_load(non‑NULL binary, ...) returns -1");
|
||||
}
|
||||
|
||||
static void test_plugin_unload_invalid_id(void)
|
||||
static void test_plugin_unload_invalid(void)
|
||||
{
|
||||
int ret = plugin_unload(-1);
|
||||
ASSERT_EQ(-1, ret, "plugin_unload(-1) returns -1");
|
||||
}
|
||||
|
||||
static void test_plugin_connect_invalid_id(void)
|
||||
static void test_plugin_connect_invalid(void)
|
||||
{
|
||||
int ret = plugin_connect(-1, "out", "looper:in");
|
||||
ASSERT_EQ(-1, ret, "plugin_connect(-1, ...) returns -1");
|
||||
}
|
||||
|
||||
static void test_plugin_disconnect(void)
|
||||
static void test_plugin_disconnect_no_jack(void)
|
||||
{
|
||||
int ret = plugin_disconnect("from_port", "to_port");
|
||||
ASSERT_EQ(0, ret, "plugin_disconnect(...) returns 0");
|
||||
int ret = plugin_disconnect("from", "to");
|
||||
ASSERT_EQ(0, ret, "plugin_disconnect('from','to') returns 0 (safe stub)");
|
||||
}
|
||||
|
||||
static void test_plugin_set_bypass_invalid(void)
|
||||
static void test_plugin_set_bypass_invalid_id(void)
|
||||
{
|
||||
/* set_bypass returns void; just make sure it doesn't crash */
|
||||
plugin_set_bypass(-1, true);
|
||||
printf("PASS: plugin_set_bypass(-1, true) did not crash\n");
|
||||
tests_passed++;
|
||||
}
|
||||
|
||||
static void test_plugin_set_bypass_valid_id(void)
|
||||
{
|
||||
plugin_set_bypass(0, true);
|
||||
printf("PASS: plugin_set_bypass(0, true) did not crash\n");
|
||||
tests_passed++;
|
||||
}
|
||||
|
||||
static void test_plugin_connect_valid_id(void)
|
||||
{
|
||||
int ret = plugin_connect(0, "out", "looper:in");
|
||||
ASSERT_EQ(-1, ret, "plugin_connect(0, ...) returns -1 (no plugin loaded)");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("=== Plugin stub unit tests ===\n");
|
||||
|
||||
test_plugin_load_null_binary();
|
||||
test_plugin_load_nonnull_binary();
|
||||
test_plugin_unload_invalid_id();
|
||||
test_plugin_connect_invalid_id();
|
||||
test_plugin_disconnect();
|
||||
test_plugin_set_bypass_invalid();
|
||||
test_plugin_load_null();
|
||||
test_plugin_unload_invalid();
|
||||
test_plugin_connect_invalid();
|
||||
test_plugin_disconnect_no_jack();
|
||||
test_plugin_set_bypass_invalid_id();
|
||||
test_plugin_set_bypass_valid_id();
|
||||
test_plugin_connect_valid_id();
|
||||
|
||||
printf("\nResults: %d passed, %d failed\n", tests_passed, tests_failed);
|
||||
return tests_failed > 0 ? 1 : 0;
|
||||
|
||||
Reference in New Issue
Block a user