testing: add comprehensive test suite for test-driven development #25

Merged
TapTap merged 9 commits from testing/comprehensive-test-suite into main 2026-07-20 17:05:44 +02:00
3 changed files with 18 additions and 21 deletions
Showing only changes of commit 44d0f99de9 - Show all commits
+2 -2
View File
@@ -153,8 +153,8 @@ static void test_file_send_receive() {
memcpy(file->data->data, content, len); memcpy(file->data->data, content, len);
file->data->size = len; file->data->size = len;
Config* cfg = config_create(str_dup(PROTOCOL_VERSION), str_dup("/tmp"), str_dup("/tmp"), Config* cfg = config_create(str_dup(PROTOCOL_VERSION), str_dup("/tmp"), str_dup("/tmp"), false,
false, false, false, false, false, 0, false, 0); false, false, false, false, 0, false, 0);
int p[2]; int p[2];
EXPECT_EQ_INT(pipe(p), 0); EXPECT_EQ_INT(pipe(p), 0);
+2 -5
View File
@@ -88,11 +88,8 @@ static void test_queue_mpmc_stress() {
ProducerCtx pctxs[NUM_PRODUCERS]; ProducerCtx pctxs[NUM_PRODUCERS];
thrd_t producers[NUM_PRODUCERS]; thrd_t producers[NUM_PRODUCERS];
for (int i = 0; i < NUM_PRODUCERS; i++) { for (int i = 0; i < NUM_PRODUCERS; i++) {
pctxs[i] = (ProducerCtx){.q = q, pctxs[i] = (ProducerCtx){
.mutex = &mutex, .q = q, .mutex = &mutex, .cnd_empty = &cnd_empty, .cnd_full = &cnd_full, .producer_id = i};
.cnd_empty = &cnd_empty,
.cnd_full = &cnd_full,
.producer_id = i};
int res = thrd_create(&producers[i], mpmc_producer_func, &pctxs[i]); int res = thrd_create(&producers[i], mpmc_producer_func, &pctxs[i]);
EXPECT_EQ_INT(res, thrd_success); EXPECT_EQ_INT(res, thrd_success);
} }