How hadichahine/cest works
Project Type and Purpose
• This is an open-source C library (“cest”) that provides a minimal unit-testing framework for GNU/Linux environments.
• It exposes two APIs: a low-level “inner” API (CUTest/CUTestSuite) and a higher-level test suite constructor. It links against libc and bundles a static dependency (exceptions4c).
High-Level Components
a. Core Library
• src/*.c (cutest.c, cutestsuite.c, cutest_assert.c, linkedlist.c, mem_alloc.c)
• headers/*.h (public API: cutest.h, cutestsuite.h, create_test_suite.h, linkedlist.h, mem_alloc.h, cupcet_assert.h)
b. Static Dependency
• static_dependencies/exceptions4c (e4c.c, e4c.h) – exception handling layer
c. Primitive Testing Harness
• primitive_testing/primitive_testing_environment.c/.h – basic internal tests & scaffolding
d. User Tests
• tests/*.c – test cases that exercise the core library
e. Build & CI
• Makefile – build targets: all, check, install, test-debug
• .travis.yml – continuous integration commands
f. Deployment Packaging
• deployment/archlinux/cest-git – packaging scripts for AUR
g. Meta Information
• version, LICENSE, .gitmodules, .gitignore
Component Relationships & Data Flow
• The Makefile orchestrates compilation of src/*.c + static_dependencies into a shared/static libcest.
• headers/*.h define the public interface used by:
• primitive_testing to validate library internals
• tests/*.c to verify library functionality
• client code (USER) to write their own tests or suites
• Client code or test suite constructors call into libcest via function pointers (hooks) and Assert API.
• The CI pipeline (Travis) runs make check to compile/tests and uses gdb/valgrind for debugging hooks.
• Deployment scripts package the built artifacts for distribution on Arch Linux.
Architectural Patterns & Design Principles
• Modular C design: clear separation between interface (headers) and implementation (src).
• Plugin‐style hooks: before/after suite via function pointers.
• Utility modules: linked list and memory allocator abstract away low-level details.
• Static linking of exceptions4c to avoid external runtime dependencies.
• Convention-driven build (Makefile targets) and configuration (Travis, deployment).