feat: add Carla plugin host stubs and integration plan
This commit is contained in:
committed by
Loic Coenen (aider)
parent
5cffec86e7
commit
dafc7fe46b
46
client/tests/test_carla_host.c
Normal file
46
client/tests/test_carla_host.c
Normal file
@@ -0,0 +1,46 @@
|
||||
#include <stdio.h>
|
||||
#include "carla_host.h"
|
||||
|
||||
static int tests_passed = 0;
|
||||
static int tests_failed = 0;
|
||||
|
||||
#define ASSERT_EQ(expected, actual, msg) do { \
|
||||
if ((expected) != (actual)) { \
|
||||
fprintf(stderr, "FAIL: %s (expected %d, got %d)\n", msg, (int)(expected), (int)(actual)); \
|
||||
tests_failed++; \
|
||||
} else { \
|
||||
printf("PASS: %s\n", msg); \
|
||||
tests_passed++; \
|
||||
} \
|
||||
} while(0)
|
||||
|
||||
static void test_carla_load_null_binary(void)
|
||||
{
|
||||
int id = -999;
|
||||
int ret = carla_load(NULL, "someplugin", &id);
|
||||
ASSERT_EQ(-1, ret, "carla_load(NULL, ...) returns -1");
|
||||
}
|
||||
|
||||
static void test_carla_unload_invalid_id(void)
|
||||
{
|
||||
int ret = carla_unload(-1);
|
||||
ASSERT_EQ(-1, ret, "carla_unload(-1) returns -1");
|
||||
}
|
||||
|
||||
static void test_carla_connect_invalid_id(void)
|
||||
{
|
||||
int ret = carla_connect(-1, "out", "looper:in");
|
||||
ASSERT_EQ(-1, ret, "carla_connect(-1, ...) returns -1");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
printf("=== Carla host stub unit tests ===\n");
|
||||
|
||||
test_carla_load_null_binary();
|
||||
test_carla_unload_invalid_id();
|
||||
test_carla_connect_invalid_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