feat: establish the bounded production architecture
This commit is contained in:
@@ -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
|
||||
Executable
BIN
Binary file not shown.
@@ -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;
|
||||
}
|
||||
Reference in New Issue
Block a user