From f1998acfe34c9d12d90e7921f1b53c18c6c4b912 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Katariina=20J=C3=A4rvenm=C3=A4ki?= Date: Sun, 5 Apr 2026 09:35:17 +0300 Subject: [PATCH] Add testing guide and update README with testing section --- README.md | 4 ++ docs/testing.md | 97 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 101 insertions(+) create mode 100644 docs/testing.md diff --git a/README.md b/README.md index fc7d992..581aa46 100644 --- a/README.md +++ b/README.md @@ -58,6 +58,10 @@ See [`docs/cheatsheet.md`](docs/cheatsheet.md) for a map of Finnish grammatical | `examples/async/` | DOM click handlers, mutable state | | `examples/program/` | Capstone combining recursion and list iteration | +## Testing + +See [`docs/testing.md`](docs/testing.md) for a step-by-step guide to verifying each example. + ## Local Setup (without Docker) See [`docs/install.md`](docs/install.md) for instructions on installing `libvoikko` and `tampio` natively. diff --git a/docs/testing.md b/docs/testing.md new file mode 100644 index 0000000..ad3cb48 --- /dev/null +++ b/docs/testing.md @@ -0,0 +1,97 @@ +# Testing the Examples + +## Build and serve + +```sh +make +python3 -m http.server 9994 --directory examples +``` + +Open `http://localhost:9994/basics/index.html` for the full index, or test each example directly below. + +--- + +## basics/hello.html + +`http://localhost:9994/basics/hello.html` + +- Page loads → browser alert says **Hei maailma!** + +--- + +## basics/factorial.html + +`http://localhost:9994/basics/factorial.html` + +- Page loads → prompt appears +- Enter `5` → alert shows **120** +- Enter `0` → alert shows **1** + +--- + +## basics/fibonacci.html + +`http://localhost:9994/basics/fibonacci.html` + +- Page loads → prompt appears +- Enter `10` → alert shows **55** +- Enter `1` → alert shows **1** + +--- + +## data-structures/lista.html + +`http://localhost:9994/data-structures/lista.html` + +- Right panel shows the list `[3, 1, 4, 1, 5]` +- Size: **5**, first element: **3** +- Ascending sort: **1 1 3 4 5** +- Descending sort: **5 4 3 1 1** + +--- + +## data-structures/vektori.html + +`http://localhost:9994/data-structures/vektori.html` + +- Dimension: **2** +- Sum: **7** +- Length (3-4-5 triangle): **5** + +--- + +## strings/merkkijono.html + +`http://localhost:9994/strings/merkkijono.html` + +- Merkkijono: **Hei, Tampio!** +- Pituus: **12** +- Yhdistetty: **Hei, Tampio! Vuosi 2026.** +- Siistitty: **'välilyönnit poistuvat'** +- Hedelmät: **omena banaani kiivi** + +--- + +## async/nappi.html + +`http://localhost:9994/async/nappi.html` + +- Two buttons visible: **+1** and **+10** +- Click **+1** → one `▪` dot appears +- Click **+10** → ten `▪` dots appear +- Dots accumulate across clicks + +--- + +## program/kasvutaulukko.html + +`http://localhost:9994/program/kasvutaulukko.html` + +- **Kertoma (n!)** section shows: `1 1 2 6 24 120 720` +- **Fibonacci-kani (fib(n))** section shows: `1 1 2 3 5 8 13` + +--- + +## Checking for errors + +Open browser DevTools (`F12` → Console) on any page and verify no red errors appear. The only expected output is from the examples themselves.