feat: establish the bounded production architecture

This commit is contained in:
2026-08-28 22:28:24 +03:00
parent 4ff1718307
commit a957d0defc
21 changed files with 235 additions and 5 deletions
+13
View File
@@ -0,0 +1,13 @@
CC ?= cc
CFLAGS ?= -std=c11 -Wall -Wextra -Werror -I../../include
all: test_command_queue
test_command_queue: test_command_queue.c ../../src/command_queue.c ../../src/application.c
$(CC) $(CFLAGS) $^ -o $@
run: test_command_queue
./test_command_queue
clean:
rm -f test_command_queue
BIN
View File
Binary file not shown.
+24
View File
@@ -0,0 +1,24 @@
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "command_queue.h"
int main(void) {
command_queue_t queue = {0};
app_command_t input = {.type = COMMAND_SHOT, .session_index = 1, .game_id = 7, .version = 3, .coordinate = {4, 5}};
app_command_t output = {0};
assert(!command_queue_pop(&queue, &output));
for (int index = 0; index < kCommandQueueCapacity; ++index) {
input.coordinate.x = (uint8_t)index;
assert(command_queue_push(&queue, &input));
}
assert(!command_queue_push(&queue, &input));
for (int index = 0; index < kCommandQueueCapacity; ++index) {
assert(command_queue_pop(&queue, &output));
assert(output.coordinate.x == (uint8_t)index);
}
assert(!command_queue_pop(&queue, &output));
puts("command queue tests passed");
return 0;
}