How mr-youbella/c_craft works
Project type and purpose
• This is an open-source, CLI-based “exercise and testing” tool (called C Craft) for learning and practicing C programming.
• It provides shells scripts as entrypoints, builds and runs C exercises, and executes test suites (functions, levels, exams).
File structure
• Top-level directories:
• Processing/ – Contains Makefile and core build scripts.
• Quizzes/ – Holds individual quiz scripts (e.g., quiz1.sh).
• Tests/ – Organized into Exams, Functions, Level subdirectories; contains test code for each exercise.
• Scripts under Processing/Scripts handle installation, aliases, ANSI formatting, status reporting, and bulk testing.
• README.md describes usage: user runs a single ccraft command.
README for additional insights
• Entrypoint: bash -c "$(curl …)" then ccraft CLI.
• Purpose: deliver C exercises, quizzes, exams; test user solutions.
• No external web or database; purely file-based, script-oriented, shell + C.
a. Main components
• User / Shell: The user’s terminal sending commands.
• CLI Entrypoint (ccraft script): Dispatches subcommands (exercises, tests, quizzes).
• Script Library (Processing/Scripts): install.sh, alias.sh, status.sh, test_all_exercises.sh, ansi.sh.
• Build Engine (Processing/Makefile): compiles C exercises into binaries.
• Exercise Modules (src in Processing?): each C file under Tests/… is compiled and/or tested.
• Test Harness (Tests/{Functions,Level,Exams}): test suites that validate exercise binaries.
• Quizzes (Quizzes/*.sh): stand-alone challenge scripts.
• System Tools: bash, gcc/cc, make.
b. Relationships and data flow
1. User types ccraft → CLI Entrypoint.
2. Entrypoint parses subcommand → invokes one of:
– Script Library for setup/status/tests
– Build Engine (Makefile) to compile exercises
– Quizzes module to run a quiz script
3. Build Engine uses gcc via Makefile → produces exercise binaries.
4. Test Harness runs these binaries with input and compares output.
c. Architectural patterns / design principles
• Modular separation: scripts separated from C code, tests separated by category.
• Conventions: one directory per concern (build, quiz, tests).
• Shell orchestration layer controlling build and test.
d. Key technologies
– Shell scripting (bash)
– GNU Make
– GCC (C compiler)
– File-based test definitions