From b75d1f831ccc6dff4b0d0b8b19a3e15634237fb4 Mon Sep 17 00:00:00 2001 From: LaEntropiaa Date: Sun, 29 Mar 2026 10:40:09 -0600 Subject: [PATCH] Initial commit --- .gitignore | 54 +++++++++++++++++++++++++++++++++++++++++++++ CMakeLists.txt | 33 +++++++++++++++++++++++++++ include/arena.h | 4 ++++ src/arena.c | 1 + src/main.c | 6 +++++ test/CMakeLists.txt | 10 +++++++++ test/test_arena.c | 6 +++++ 7 files changed, 114 insertions(+) create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 include/arena.h create mode 100644 src/arena.c create mode 100644 src/main.c create mode 100644 test/CMakeLists.txt create mode 100644 test/test_arena.c diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..157dd82 --- /dev/null +++ b/.gitignore @@ -0,0 +1,54 @@ +# Directories +build/ +build-*/ +cmake-build-*/ +.cache/ +out/ +out/Debug/ +out/Release/ + +# Cmake files +CMakeCache.txt +CMakeFiles/ +cmake_install.cmake +CTestTestfile.cmake +Testing/ +compile_commands.json +../compile_commands.json +build/compile_commands.json + +# Make / Ninja +Makefile +*.ninja +*.ninja_deps +*.ninja_log +rules.ninja + +# Object files +*.o +*.obj +*.lo +*.la + +# Binaries +*.out +*.exe +*.dll +*.so +*.so.* +*.dylib +*.a + +# Debug / Sanitizer +*.dSYM/ +*.gcno +*.gcda +*.gcov + +# Editors +.vscode/ +.idea/ +*.swp +*.swo +*~ + diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..3e3f88f --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.20) +project(calculator VERSION 1.0 LANGUAGES C) + +set(CMAKE_C_STANDARD 11) +set(CMAKE_C_STANDARD_REQUIRED ON) + +# Export compile_commands.json (para clangd) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +add_compile_options( + -Wall + -Wextra + -Wpedantic +) + + +include_directories(include) + +add_library(arena_lib + src/arena.c +) + +add_executable(arena_main src/main.c) + +target_link_libraries(arena_main arena_lib) + +# ------------------------ +# Testing +# ------------------------ + +enable_testing() +add_subdirectory(test) + diff --git a/include/arena.h b/include/arena.h new file mode 100644 index 0000000..8933e7b --- /dev/null +++ b/include/arena.h @@ -0,0 +1,4 @@ +#ifndef ARENA_H +#define ARENA_H + +#endif // !ARENA_H diff --git a/src/arena.c b/src/arena.c new file mode 100644 index 0000000..1538103 --- /dev/null +++ b/src/arena.c @@ -0,0 +1 @@ +#include "arena.h" diff --git a/src/main.c b/src/main.c new file mode 100644 index 0000000..02a75d8 --- /dev/null +++ b/src/main.c @@ -0,0 +1,6 @@ +#include "arena.h" +#include + +int main(void) { + return EXIT_SUCCESS; +} diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 0000000..aef968f --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,10 @@ +find_package(cmocka REQUIRED) + +add_executable(test_arena test_arena.c) + +target_link_libraries(test_arena + arena_lib + cmocka::cmocka +) + +add_test(NAME arena_tests COMMAND test_arena) diff --git a/test/test_arena.c b/test/test_arena.c new file mode 100644 index 0000000..02a75d8 --- /dev/null +++ b/test/test_arena.c @@ -0,0 +1,6 @@ +#include "arena.h" +#include + +int main(void) { + return EXIT_SUCCESS; +}