feat: add rack mode, colon commands, and client command parser

This commit is contained in:
Loic Coenen
2026-05-16 23:15:07 +00:00
committed by Loic Coenen (aider)
parent c7df02d37c
commit 9fda1b2669
10 changed files with 560 additions and 43 deletions

View File

@@ -14,6 +14,16 @@ static int tests_failed = 0;
} \
} while(0)
#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_carla_load_null_binary(void)
{
int id = -999;
@@ -33,13 +43,50 @@ static void test_carla_connect_invalid_id(void)
ASSERT_EQ(-1, ret, "carla_connect(-1, ...) returns -1");
}
static void test_carla_get_handle_before_init(void)
{
CarlaHostHandle h = carla_get_handle();
ASSERT_TRUE(h == NULL, "carla_get_handle() returns NULL before init");
}
static void test_carla_set_bypass_invalid_id(void)
{
carla_set_bypass(-1, true);
printf("PASS: carla_set_bypass(-1, true) did not crash\n");
tests_passed++;
}
static void test_carla_disconnect_no_jack(void)
{
int ret = carla_disconnect("from", "to");
ASSERT_EQ(0, ret, "carla_disconnect('from','to') returns 0 when no JACK client");
}
static void test_carla_set_bypass_valid_id_no_handle(void)
{
carla_set_bypass(0, true);
printf("PASS: carla_set_bypass(0, true) did not crash (no handle)\n");
tests_passed++;
}
static void test_carla_unload_valid_id_no_handle(void)
{
int ret = carla_unload(0);
ASSERT_EQ(-1, ret, "carla_unload(0) returns -1 when no handle");
}
int main(void)
{
printf("=== Carla host stub unit tests ===\n");
printf("=== Carla host unit tests ===\n");
test_carla_load_null_binary();
test_carla_unload_invalid_id();
test_carla_connect_invalid_id();
test_carla_get_handle_before_init();
test_carla_set_bypass_invalid_id();
test_carla_disconnect_no_jack();
test_carla_set_bypass_valid_id_no_handle();
test_carla_unload_valid_id_no_handle();
printf("\nResults: %d passed, %d failed\n", tests_passed, tests_failed);
return tests_failed > 0 ? 1 : 0;