commit 0c40ea3e9e32b2701ef21ea4b7c9e9f290c8901d Author: Jason Pochanke Date: Sat Oct 3 20:32:17 2026 +0200 init diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..2a62d71 --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +.prog +*.class +__pycache__/ +node_modules/ diff --git a/.shipthatcode.json b/.shipthatcode.json new file mode 100644 index 0000000..e30f283 --- /dev/null +++ b/.shipthatcode.json @@ -0,0 +1,62 @@ +{ + "course": "c-fundamentals", + "language": "c", + "language_id": 50, + "entrypoint": "main.c", + "version": 1, + "content_hash": "c3a2ddbd275f2184", + "lessons": [ + { + "slug": "hello-world", + "tests_hash": "f24145703f18" + }, + { + "slug": "variables-and-types", + "tests_hash": "06e6334af07b" + }, + { + "slug": "numbers-and-printf", + "tests_hash": "790ecc50aa50" + }, + { + "slug": "arrays", + "tests_hash": "ef2fe36012bc" + }, + { + "slug": "strings", + "tests_hash": "d38d1bcf0ee0" + }, + { + "slug": "conditionals", + "tests_hash": "2f96f655f1c0" + }, + { + "slug": "loops", + "tests_hash": "e016ae68115f" + }, + { + "slug": "functions", + "tests_hash": "d853d5b83122" + }, + { + "slug": "pointers-basics", + "tests_hash": "6091501c7abf" + }, + { + "slug": "structs", + "tests_hash": "21f1c690513f" + }, + { + "slug": "malloc-and-free", + "tests_hash": "3f9bf1bd5581" + }, + { + "slug": "file-io", + "tests_hash": "63e1c6d72ca6" + }, + { + "slug": "preprocessor", + "tests_hash": "71bf76be2d68" + } + ] +} \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..0d7171c --- /dev/null +++ b/README.md @@ -0,0 +1,61 @@ +# C Fundamentals + +[![shipthatcode — C Fundamentals](https://api.shipthatcode.com/cert/c703339228681dd0cb682d35a4223608.svg)](https://shipthatcode.com/courses/c-fundamentals) + +My working repo for [C Fundamentals](https://shipthatcode.com/courses/c-fundamentals) on [shipthatcode.com](https://shipthatcode.com) — built lesson by lesson in my own editor. + +## What you need + +- **git** and a terminal (macOS/Linux: the built-in one; Windows: see below) +- a C compiler — `gcc` or `clang` (macOS: `xcode-select --install`, Ubuntu: `sudo apt install build-essential`, Windows: MinGW via Git Bash or WSL). Single-file, standard library only — no OpenSSL or other external libraries, same as the grader +- any editor you like — VS Code, Vim, JetBrains, anything + +### On Windows + +Use **WSL** if you can: run `wsl --install` in an admin PowerShell once, then do everything (git, editing, `./run_tests.sh`) inside the Ubuntu terminal — it behaves exactly like the grader. + +[Git Bash](https://git-scm.com/downloads) (installs with git) also runs `./run_tests.sh`. One caveat: native Windows compilers and runtimes write Windows line endings (`\r\n`), so on byte-exact tests you can see local FAILs where the diff looks identical — your logic is fine, the invisible line endings differ. If that happens, trust **Check my solution** on the lesson page (graded on Linux), or switch to WSL. + +## Getting started (one-time setup) + +1. Unzip this download and open the folder in your editor. +2. Create a new **empty, public** repo at [github.com/new](https://github.com/new) — leave "Add a README" and ".gitignore" **unchecked** (this folder already has both). +3. In your terminal, inside the unzipped folder, push it to GitHub: + + ```sh + git init + git add . + git commit -m "start C Fundamentals" + git branch -M main + git remote add origin https://github.com/YOUR-USERNAME/YOUR-REPO.git + git push -u origin main + ``` + +4. Paste your repo link on the [course page](https://shipthatcode.com/courses/c-fundamentals) ("Work in your own editor" → **Link repo**). Done — you never do this again. + +## The lesson loop + +1. Read the lesson on shipthatcode, write your code in `main.c` here. +2. Test locally against **the lesson you're on**: `./run_tests.sh 01`, `./run_tests.sh 02`, and so on. On Windows, run this inside Git Bash. (A bare `./run_tests.sh` runs every lesson's tests, which is only useful on courses where one program answers all of them — see below.) +3. When it passes: `git add -A && git commit -m "lesson 01" && git push` +4. Hit **Check my solution** on the lesson page — shipthatcode pulls this repo and grades it against the full suite, including hidden tests. + +## How this repo is laid out + +- `main.c` — the program you're grading right now. +- `tests/` — the public test cases per lesson (`tests/01-…/1.in` → expected `1.out`). +- `run_tests.sh` — the local runner. `.shipthatcode.json` tells the grader what this repo is; don't delete either. + +### One lesson at a time + +Each lesson states its own input and output format, and **most lessons are a separate exercise rather than a bigger version of the last one**. Two lessons can be handed the same input line and correctly want different output — a tokenizer prints `[ls] [-la]`, while the next lesson, which receives already-tokenized input, prints `ls -la`. No single program can satisfy both, and it isn't supposed to. + +So treat `main.c` as the file for the lesson you're grading: when you move on, change what it does. Nothing is lost — every earlier lesson is in your git history (`git log`, `git show`), and shipthatcode remembers each lesson you passed, so a lesson stays completed even after you replace the code that passed it. If you'd rather keep the code visible, copy it aside first (`cp main.c solutions/01-.c`) — extra files are ignored by the grader. + +When a lesson genuinely does build on the previous one, its own text says so and its tests will pass with the earlier behaviour still in place. + +## If the course gets updated + +Courses improve over time — exercises get added, tests get fixed. If the [course page](https://shipthatcode.com/courses/c-fundamentals) says your starter is out of date: download a fresh zip, **delete this repo's `tests/` folder entirely**, copy in the fresh `tests/` and `.shipthatcode.json`, and keep your own code exactly as it is. (Don't merge test folders — lesson numbering can shift between versions.) Lessons you've already completed stay completed either way. + +Repo topic suggestion: `shipthatcode` · Starter generated by [shipthatcode.com](https://shipthatcode.com) diff --git a/main.c b/main.c new file mode 100644 index 0000000..0578a61 --- /dev/null +++ b/main.c @@ -0,0 +1,17 @@ +#include +#include + +int main(void) { + /* Already done for you: read one line of text into name and drop the + Enter key from its end. The Strings lesson explains how this works. */ + char name[256] = ""; + if (fgets(name, sizeof name, stdin) == NULL) { + name[0] = '\0'; + } + name[strcspn(name, "\r\n")] = '\0'; + + /* TODO: print the two lines described in the exercise. + Use a %s placeholder for name; do not type any name yourself. */ + + return 0; +} diff --git a/run_tests.sh b/run_tests.sh new file mode 100755 index 0000000..ecfdd03 --- /dev/null +++ b/run_tests.sh @@ -0,0 +1,109 @@ +#!/usr/bin/env bash +# Local test runner for "C Fundamentals" (shipthatcode.com). +# Usage: +# ./run_tests.sh run every lesson's tests +# ./run_tests.sh 03 run only tests/03-*'s tests +set -u +LANG_SLUG="c" +ENTRY="main.c" +FILTER="${1:-}" +# Test dirs are zero-padded (01-, 02-, …) — accept "./run_tests.sh 3" too. +case "$FILTER" in [1-9]) FILTER="0$FILTER" ;; esac + +# Languages the grader supports but this local runner can't fake reliably +# yet. The website's Check is the official grade either way. +case "$LANG_SLUG" in + sql|prolog) + echo "The local runner doesn't support $LANG_SLUG yet." + echo "Write your code here, push, and grade with 'Check my solution' on the lesson page." + exit 2 ;; +esac + +# Prefer gcc/g++ (Linux, MinGW on Windows) but fall back to cc/c++ (macOS). +CC_BIN=cc; command -v gcc >/dev/null 2>&1 && CC_BIN=gcc +CXX_BIN=c++; command -v g++ >/dev/null 2>&1 && CXX_BIN=g++ +# Windows installs often have "python", not "python3". +PY_BIN=python3; command -v python3 >/dev/null 2>&1 || PY_BIN=python + +compile() { + case "$LANG_SLUG" in + c) "$CC_BIN" -O2 -o .prog "$ENTRY" ;; + cpp) "$CXX_BIN" -std=c++17 -O2 -o .prog "$ENTRY" ;; + rust) rustc -O -o .prog "$ENTRY" ;; + java) javac "$ENTRY" ;; + assembly) nasm -felf64 "$ENTRY" -o .prog.o && ld .prog.o -o .prog ;; + basic) fbc -x .prog "$ENTRY" ;; + cobol) cobc -xF -o .prog "$ENTRY" ;; + csharp) mcs -out:.prog.exe "$ENTRY" ;; + d) dmd -of=.prog "$ENTRY" ;; + fortran) gfortran -O2 -o .prog "$ENTRY" ;; + kotlin) kotlinc "$ENTRY" -include-runtime -d .prog.jar ;; + objc) + if [ "$(uname)" = "Darwin" ]; then + "$CC_BIN" -framework Foundation -o .prog "$ENTRY" + else + "$CC_BIN" -o .prog "$ENTRY" + fi ;; + pascal) fpc -o.prog "$ENTRY" > /dev/null ;; + vbnet) vbnc -out:.prog.exe "$ENTRY" ;; + *) return 0 ;; + esac +} + +run_one() { # $1 = input file + case "$LANG_SLUG" in + c|cpp|rust|assembly|basic|cobol|d|fortran|pascal) ./.prog < "$1" ;; + csharp|vbnet) mono .prog.exe < "$1" ;; + kotlin) java -jar .prog.jar < "$1" ;; + python) "$PY_BIN" "$ENTRY" < "$1" ;; + javascript) node "$ENTRY" < "$1" ;; + typescript) npx -y tsx "$ENTRY" < "$1" ;; + go) go run "$ENTRY" < "$1" ;; + java) java "${ENTRY%.java}" < "$1" ;; + bash) bash "$ENTRY" < "$1" ;; + clojure) clojure -M "$ENTRY" < "$1" ;; + elixir) elixir "$ENTRY" < "$1" ;; + erlang) escript "$ENTRY" < "$1" ;; + fsharp) dotnet fsi "$ENTRY" < "$1" ;; + groovy) groovy "$ENTRY" < "$1" ;; + haskell) runghc "$ENTRY" < "$1" ;; + lisp) sbcl --script "$ENTRY" < "$1" ;; + lua) lua "$ENTRY" < "$1" ;; + objc) ./.prog < "$1" ;; + ocaml) ocaml "$ENTRY" < "$1" ;; + octave) octave -qf "$ENTRY" < "$1" ;; + perl) perl "$ENTRY" < "$1" ;; + php) php "$ENTRY" < "$1" ;; + r) Rscript "$ENTRY" < "$1" ;; + ruby) ruby "$ENTRY" < "$1" ;; + scala) scala "$ENTRY" < "$1" ;; + swift) swift "$ENTRY" < "$1" ;; + *) echo "unsupported language: $LANG_SLUG" >&2; exit 1 ;; + esac +} + +if ! compile; then + echo "COMPILE FAILED" + exit 1 +fi + +pass=0; fail=0 +for dir in tests/${FILTER}*/; do + [ -d "$dir" ] || continue + for input in "$dir"*.in; do + [ -f "$input" ] || continue + expected="${input%.in}.out" + actual="$(run_one "$input")" + if [ "$actual" = "$(cat "$expected")" ]; then + pass=$((pass+1)); echo "PASS $input" + else + fail=$((fail+1)); echo "FAIL $input" + echo " expected: $(head -c 200 "$expected")" + echo " got: $(printf '%s' "$actual" | head -c 200)" + fi + done +done + +echo +echo "$pass passed, $fail failed" +[ "$fail" -eq 0 ] diff --git a/tests/01-hello-world/1.in b/tests/01-hello-world/1.in new file mode 100644 index 0000000..a341e20 --- /dev/null +++ b/tests/01-hello-world/1.in @@ -0,0 +1 @@ +Ada diff --git a/tests/01-hello-world/1.out b/tests/01-hello-world/1.out new file mode 100644 index 0000000..d8bf2f0 --- /dev/null +++ b/tests/01-hello-world/1.out @@ -0,0 +1,2 @@ +Hello, Ada! +Welcome to C. \ No newline at end of file diff --git a/tests/01-hello-world/2.in b/tests/01-hello-world/2.in new file mode 100644 index 0000000..3ba160b --- /dev/null +++ b/tests/01-hello-world/2.in @@ -0,0 +1 @@ +Linus diff --git a/tests/01-hello-world/2.out b/tests/01-hello-world/2.out new file mode 100644 index 0000000..039fbb4 --- /dev/null +++ b/tests/01-hello-world/2.out @@ -0,0 +1,2 @@ +Hello, Linus! +Welcome to C. \ No newline at end of file diff --git a/tests/01-hello-world/3.in b/tests/01-hello-world/3.in new file mode 100644 index 0000000..bc272cd --- /dev/null +++ b/tests/01-hello-world/3.in @@ -0,0 +1 @@ +Grace Hopper diff --git a/tests/01-hello-world/3.out b/tests/01-hello-world/3.out new file mode 100644 index 0000000..c99790d --- /dev/null +++ b/tests/01-hello-world/3.out @@ -0,0 +1,2 @@ +Hello, Grace Hopper! +Welcome to C. \ No newline at end of file diff --git a/tests/02-variables-and-types/1.in b/tests/02-variables-and-types/1.in new file mode 100644 index 0000000..f1f3289 --- /dev/null +++ b/tests/02-variables-and-types/1.in @@ -0,0 +1,2 @@ +7.5 +2.25 diff --git a/tests/02-variables-and-types/1.out b/tests/02-variables-and-types/1.out new file mode 100644 index 0000000..27bf70d --- /dev/null +++ b/tests/02-variables-and-types/1.out @@ -0,0 +1,2 @@ +9.750000 +9 \ No newline at end of file diff --git a/tests/02-variables-and-types/2.in b/tests/02-variables-and-types/2.in new file mode 100644 index 0000000..0f1893a --- /dev/null +++ b/tests/02-variables-and-types/2.in @@ -0,0 +1,2 @@ +10 +5 diff --git a/tests/02-variables-and-types/2.out b/tests/02-variables-and-types/2.out new file mode 100644 index 0000000..e34ef69 --- /dev/null +++ b/tests/02-variables-and-types/2.out @@ -0,0 +1,2 @@ +15.000000 +15 \ No newline at end of file diff --git a/tests/02-variables-and-types/3.in b/tests/02-variables-and-types/3.in new file mode 100644 index 0000000..45aa6ad --- /dev/null +++ b/tests/02-variables-and-types/3.in @@ -0,0 +1 @@ +4.5 4.5 diff --git a/tests/02-variables-and-types/3.out b/tests/02-variables-and-types/3.out new file mode 100644 index 0000000..c1a176d --- /dev/null +++ b/tests/02-variables-and-types/3.out @@ -0,0 +1,2 @@ +9.000000 +9 \ No newline at end of file diff --git a/tests/03-numbers-and-printf/1.in b/tests/03-numbers-and-printf/1.in new file mode 100644 index 0000000..7c1a169 --- /dev/null +++ b/tests/03-numbers-and-printf/1.in @@ -0,0 +1,2 @@ +5 +3 diff --git a/tests/03-numbers-and-printf/1.out b/tests/03-numbers-and-printf/1.out new file mode 100644 index 0000000..edfe2ad --- /dev/null +++ b/tests/03-numbers-and-printf/1.out @@ -0,0 +1,2 @@ +15 +1.67 \ No newline at end of file diff --git a/tests/03-numbers-and-printf/2.in b/tests/03-numbers-and-printf/2.in new file mode 100644 index 0000000..b2f7f08 --- /dev/null +++ b/tests/03-numbers-and-printf/2.in @@ -0,0 +1,2 @@ +10 +10 diff --git a/tests/03-numbers-and-printf/2.out b/tests/03-numbers-and-printf/2.out new file mode 100644 index 0000000..45969eb --- /dev/null +++ b/tests/03-numbers-and-printf/2.out @@ -0,0 +1,2 @@ +100 +1.00 \ No newline at end of file diff --git a/tests/03-numbers-and-printf/3.in b/tests/03-numbers-and-printf/3.in new file mode 100644 index 0000000..b4cddc5 --- /dev/null +++ b/tests/03-numbers-and-printf/3.in @@ -0,0 +1,2 @@ +7 +2 diff --git a/tests/03-numbers-and-printf/3.out b/tests/03-numbers-and-printf/3.out new file mode 100644 index 0000000..59e3a15 --- /dev/null +++ b/tests/03-numbers-and-printf/3.out @@ -0,0 +1,2 @@ +14 +3.50 \ No newline at end of file diff --git a/tests/04-arrays/1.in b/tests/04-arrays/1.in new file mode 100644 index 0000000..7f8ac4c --- /dev/null +++ b/tests/04-arrays/1.in @@ -0,0 +1,5 @@ +3 +8 +2 +9 +1 diff --git a/tests/04-arrays/1.out b/tests/04-arrays/1.out new file mode 100644 index 0000000..f11c82a --- /dev/null +++ b/tests/04-arrays/1.out @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git a/tests/04-arrays/2.in b/tests/04-arrays/2.in new file mode 100644 index 0000000..9fecd6b --- /dev/null +++ b/tests/04-arrays/2.in @@ -0,0 +1,5 @@ +5 +5 +5 +5 +5 diff --git a/tests/04-arrays/2.out b/tests/04-arrays/2.out new file mode 100644 index 0000000..7813681 --- /dev/null +++ b/tests/04-arrays/2.out @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git a/tests/04-arrays/3.in b/tests/04-arrays/3.in new file mode 100644 index 0000000..7ee9977 --- /dev/null +++ b/tests/04-arrays/3.in @@ -0,0 +1,5 @@ +4 +1 +7 +3 +5 diff --git a/tests/04-arrays/3.out b/tests/04-arrays/3.out new file mode 100644 index 0000000..c793025 --- /dev/null +++ b/tests/04-arrays/3.out @@ -0,0 +1 @@ +7 \ No newline at end of file diff --git a/tests/05-strings/1.in b/tests/05-strings/1.in new file mode 100644 index 0000000..ce01362 --- /dev/null +++ b/tests/05-strings/1.in @@ -0,0 +1 @@ +hello diff --git a/tests/05-strings/1.out b/tests/05-strings/1.out new file mode 100644 index 0000000..7813681 --- /dev/null +++ b/tests/05-strings/1.out @@ -0,0 +1 @@ +5 \ No newline at end of file diff --git a/tests/05-strings/2.in b/tests/05-strings/2.in new file mode 100644 index 0000000..3b18e51 --- /dev/null +++ b/tests/05-strings/2.in @@ -0,0 +1 @@ +hello world diff --git a/tests/05-strings/2.out b/tests/05-strings/2.out new file mode 100644 index 0000000..9d60796 --- /dev/null +++ b/tests/05-strings/2.out @@ -0,0 +1 @@ +11 \ No newline at end of file diff --git a/tests/05-strings/3.in b/tests/05-strings/3.in new file mode 100644 index 0000000..7898192 --- /dev/null +++ b/tests/05-strings/3.in @@ -0,0 +1 @@ +a diff --git a/tests/05-strings/3.out b/tests/05-strings/3.out new file mode 100644 index 0000000..56a6051 --- /dev/null +++ b/tests/05-strings/3.out @@ -0,0 +1 @@ +1 \ No newline at end of file diff --git a/tests/06-conditionals/1.in b/tests/06-conditionals/1.in new file mode 100644 index 0000000..ec63514 --- /dev/null +++ b/tests/06-conditionals/1.in @@ -0,0 +1 @@ +9 diff --git a/tests/06-conditionals/1.out b/tests/06-conditionals/1.out new file mode 100644 index 0000000..97e26a6 --- /dev/null +++ b/tests/06-conditionals/1.out @@ -0,0 +1 @@ +Fizz \ No newline at end of file diff --git a/tests/06-conditionals/2.in b/tests/06-conditionals/2.in new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/tests/06-conditionals/2.in @@ -0,0 +1 @@ +10 diff --git a/tests/06-conditionals/2.out b/tests/06-conditionals/2.out new file mode 100644 index 0000000..4e0d905 --- /dev/null +++ b/tests/06-conditionals/2.out @@ -0,0 +1 @@ +Buzz \ No newline at end of file diff --git a/tests/06-conditionals/3.in b/tests/06-conditionals/3.in new file mode 100644 index 0000000..60d3b2f --- /dev/null +++ b/tests/06-conditionals/3.in @@ -0,0 +1 @@ +15 diff --git a/tests/06-conditionals/3.out b/tests/06-conditionals/3.out new file mode 100644 index 0000000..de4e1b7 --- /dev/null +++ b/tests/06-conditionals/3.out @@ -0,0 +1 @@ +FizzBuzz \ No newline at end of file diff --git a/tests/06-conditionals/4.in b/tests/06-conditionals/4.in new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/tests/06-conditionals/4.in @@ -0,0 +1 @@ +7 diff --git a/tests/06-conditionals/4.out b/tests/06-conditionals/4.out new file mode 100644 index 0000000..c793025 --- /dev/null +++ b/tests/06-conditionals/4.out @@ -0,0 +1 @@ +7 \ No newline at end of file diff --git a/tests/07-loops/1.in b/tests/07-loops/1.in new file mode 100644 index 0000000..7f8f011 --- /dev/null +++ b/tests/07-loops/1.in @@ -0,0 +1 @@ +7 diff --git a/tests/07-loops/1.out b/tests/07-loops/1.out new file mode 100644 index 0000000..19c7bdb --- /dev/null +++ b/tests/07-loops/1.out @@ -0,0 +1 @@ +16 \ No newline at end of file diff --git a/tests/07-loops/2.in b/tests/07-loops/2.in new file mode 100644 index 0000000..7ed6ff8 --- /dev/null +++ b/tests/07-loops/2.in @@ -0,0 +1 @@ +5 diff --git a/tests/07-loops/2.out b/tests/07-loops/2.out new file mode 100644 index 0000000..f11c82a --- /dev/null +++ b/tests/07-loops/2.out @@ -0,0 +1 @@ +9 \ No newline at end of file diff --git a/tests/07-loops/3.in b/tests/07-loops/3.in new file mode 100644 index 0000000..f599e28 --- /dev/null +++ b/tests/07-loops/3.in @@ -0,0 +1 @@ +10 diff --git a/tests/07-loops/3.out b/tests/07-loops/3.out new file mode 100644 index 0000000..410b14d --- /dev/null +++ b/tests/07-loops/3.out @@ -0,0 +1 @@ +25 \ No newline at end of file diff --git a/tests/08-functions/1.in b/tests/08-functions/1.in new file mode 100644 index 0000000..a011502 --- /dev/null +++ b/tests/08-functions/1.in @@ -0,0 +1,3 @@ +0 10 +5 +-3 0 7 10 15 diff --git a/tests/08-functions/1.out b/tests/08-functions/1.out new file mode 100644 index 0000000..eed6ea9 --- /dev/null +++ b/tests/08-functions/1.out @@ -0,0 +1,5 @@ +0 +0 +7 +10 +10 \ No newline at end of file diff --git a/tests/08-functions/2.in b/tests/08-functions/2.in new file mode 100644 index 0000000..b1abf44 --- /dev/null +++ b/tests/08-functions/2.in @@ -0,0 +1,3 @@ +1 6 +3 +4 9 -2 diff --git a/tests/08-functions/2.out b/tests/08-functions/2.out new file mode 100644 index 0000000..e5f01c3 --- /dev/null +++ b/tests/08-functions/2.out @@ -0,0 +1,3 @@ +4 +6 +1 \ No newline at end of file diff --git a/tests/08-functions/3.in b/tests/08-functions/3.in new file mode 100644 index 0000000..a90c15a --- /dev/null +++ b/tests/08-functions/3.in @@ -0,0 +1,3 @@ +-10 -3 +4 +-20 -5 0 -3 diff --git a/tests/08-functions/3.out b/tests/08-functions/3.out new file mode 100644 index 0000000..a39c075 --- /dev/null +++ b/tests/08-functions/3.out @@ -0,0 +1,4 @@ +-10 +-5 +-3 +-3 \ No newline at end of file diff --git a/tests/09-pointers-basics/1.in b/tests/09-pointers-basics/1.in new file mode 100644 index 0000000..0871b0b --- /dev/null +++ b/tests/09-pointers-basics/1.in @@ -0,0 +1 @@ +3 7 diff --git a/tests/09-pointers-basics/1.out b/tests/09-pointers-basics/1.out new file mode 100644 index 0000000..7f036e7 --- /dev/null +++ b/tests/09-pointers-basics/1.out @@ -0,0 +1 @@ +7 3 diff --git a/tests/09-pointers-basics/2.in b/tests/09-pointers-basics/2.in new file mode 100644 index 0000000..9065763 --- /dev/null +++ b/tests/09-pointers-basics/2.in @@ -0,0 +1 @@ +10 -4 diff --git a/tests/09-pointers-basics/2.out b/tests/09-pointers-basics/2.out new file mode 100644 index 0000000..88938f3 --- /dev/null +++ b/tests/09-pointers-basics/2.out @@ -0,0 +1 @@ +-4 10 diff --git a/tests/09-pointers-basics/3.in b/tests/09-pointers-basics/3.in new file mode 100644 index 0000000..299a71f --- /dev/null +++ b/tests/09-pointers-basics/3.in @@ -0,0 +1 @@ +5 5 diff --git a/tests/09-pointers-basics/3.out b/tests/09-pointers-basics/3.out new file mode 100644 index 0000000..299a71f --- /dev/null +++ b/tests/09-pointers-basics/3.out @@ -0,0 +1 @@ +5 5 diff --git a/tests/10-structs/1.in b/tests/10-structs/1.in new file mode 100644 index 0000000..f01ca7c --- /dev/null +++ b/tests/10-structs/1.in @@ -0,0 +1,4 @@ +0 +0 +3 +4 diff --git a/tests/10-structs/1.out b/tests/10-structs/1.out new file mode 100644 index 0000000..7273c0f --- /dev/null +++ b/tests/10-structs/1.out @@ -0,0 +1 @@ +25 diff --git a/tests/10-structs/2.in b/tests/10-structs/2.in new file mode 100644 index 0000000..98fb6a6 --- /dev/null +++ b/tests/10-structs/2.in @@ -0,0 +1,4 @@ +1 +1 +1 +1 diff --git a/tests/10-structs/2.out b/tests/10-structs/2.out new file mode 100644 index 0000000..573541a --- /dev/null +++ b/tests/10-structs/2.out @@ -0,0 +1 @@ +0 diff --git a/tests/10-structs/3.in b/tests/10-structs/3.in new file mode 100644 index 0000000..95aae75 --- /dev/null +++ b/tests/10-structs/3.in @@ -0,0 +1,4 @@ +2 +5 +7 +1 diff --git a/tests/10-structs/3.out b/tests/10-structs/3.out new file mode 100644 index 0000000..87523dd --- /dev/null +++ b/tests/10-structs/3.out @@ -0,0 +1 @@ +41 diff --git a/tests/11-malloc-and-free/1.in b/tests/11-malloc-and-free/1.in new file mode 100644 index 0000000..9873ee0 --- /dev/null +++ b/tests/11-malloc-and-free/1.in @@ -0,0 +1,4 @@ +3 +1 +2 +3 diff --git a/tests/11-malloc-and-free/1.out b/tests/11-malloc-and-free/1.out new file mode 100644 index 0000000..ac7a0b1 --- /dev/null +++ b/tests/11-malloc-and-free/1.out @@ -0,0 +1,2 @@ +3 2 1 +6 diff --git a/tests/11-malloc-and-free/2.in b/tests/11-malloc-and-free/2.in new file mode 100644 index 0000000..192e9d9 --- /dev/null +++ b/tests/11-malloc-and-free/2.in @@ -0,0 +1,2 @@ +1 +42 diff --git a/tests/11-malloc-and-free/2.out b/tests/11-malloc-and-free/2.out new file mode 100644 index 0000000..daaac9e --- /dev/null +++ b/tests/11-malloc-and-free/2.out @@ -0,0 +1,2 @@ +42 +42 diff --git a/tests/11-malloc-and-free/3.in b/tests/11-malloc-and-free/3.in new file mode 100644 index 0000000..f7a7dd0 --- /dev/null +++ b/tests/11-malloc-and-free/3.in @@ -0,0 +1,6 @@ +5 +7 +-2 +15 +0 +4 diff --git a/tests/11-malloc-and-free/3.out b/tests/11-malloc-and-free/3.out new file mode 100644 index 0000000..eedd978 --- /dev/null +++ b/tests/11-malloc-and-free/3.out @@ -0,0 +1,2 @@ +4 0 15 -2 7 +24 diff --git a/tests/12-file-io/1.in b/tests/12-file-io/1.in new file mode 100644 index 0000000..398ea5f --- /dev/null +++ b/tests/12-file-io/1.in @@ -0,0 +1,5 @@ +2 +woke up +coffee +1 +read a book diff --git a/tests/12-file-io/1.out b/tests/12-file-io/1.out new file mode 100644 index 0000000..8eaa736 --- /dev/null +++ b/tests/12-file-io/1.out @@ -0,0 +1,4 @@ +1:woke up +2:coffee +3:read a book +lines: 3 \ No newline at end of file diff --git a/tests/12-file-io/2.in b/tests/12-file-io/2.in new file mode 100644 index 0000000..5ca9774 --- /dev/null +++ b/tests/12-file-io/2.in @@ -0,0 +1,5 @@ +1 +first entry +2 +second entry +third entry diff --git a/tests/12-file-io/2.out b/tests/12-file-io/2.out new file mode 100644 index 0000000..1441b9c --- /dev/null +++ b/tests/12-file-io/2.out @@ -0,0 +1,4 @@ +1:first entry +2:second entry +3:third entry +lines: 3 \ No newline at end of file diff --git a/tests/12-file-io/3.in b/tests/12-file-io/3.in new file mode 100644 index 0000000..88508ad --- /dev/null +++ b/tests/12-file-io/3.in @@ -0,0 +1,4 @@ +0 +2 +late start +still tired diff --git a/tests/12-file-io/3.out b/tests/12-file-io/3.out new file mode 100644 index 0000000..8b54363 --- /dev/null +++ b/tests/12-file-io/3.out @@ -0,0 +1,3 @@ +1:late start +2:still tired +lines: 2 \ No newline at end of file diff --git a/tests/13-preprocessor/1.in b/tests/13-preprocessor/1.in new file mode 100644 index 0000000..606c19a --- /dev/null +++ b/tests/13-preprocessor/1.in @@ -0,0 +1 @@ +3 1 diff --git a/tests/13-preprocessor/1.out b/tests/13-preprocessor/1.out new file mode 100644 index 0000000..09a76e1 --- /dev/null +++ b/tests/13-preprocessor/1.out @@ -0,0 +1,4 @@ +3 cubed is 27 +4 cubed is 64 +1 cubed mod 7 is 1 +larger plus one is 4 diff --git a/tests/13-preprocessor/2.in b/tests/13-preprocessor/2.in new file mode 100644 index 0000000..a57b07e --- /dev/null +++ b/tests/13-preprocessor/2.in @@ -0,0 +1 @@ +2 5 diff --git a/tests/13-preprocessor/2.out b/tests/13-preprocessor/2.out new file mode 100644 index 0000000..762b35a --- /dev/null +++ b/tests/13-preprocessor/2.out @@ -0,0 +1,4 @@ +2 cubed is 8 +7 cubed is 343 +5 cubed mod 7 is 6 +larger plus one is 6