owenrusk.dev

casebench

test cases straight onto the board.

git clone https://owenrusk.dev/casebench.git

casebench / README.md -rw-r--r-- · 1972 bytes

 1 # casebench
 2 
 3 Test cases go straight to the board. The runtime never sees them. Reaches the board and nothing else.
 4 
 5 ## commands
 6 
 7     casebench put FOLDER --player HANDLE
 8     casebench note CASE "text" [--item ITEM] --player HANDLE
 9     casebench note CASE -f note.md [--item ITEM] --player HANDLE
10     casebench lock CASE [--answer A ...] [--rest 3/60] [--text locked.] --player HANDLE
11     casebench unlock CASE --player HANDLE
12     casebench list [--player HANDLE]
13     casebench pull CASE --player HANDLE
14 
15 every command that writes takes `--player` (more than once is fine) or `--all`, for every board. `list` without `--player` lists every board.
16 
17 - `put` puts the case on the board, or replaces its title and items if it's there already. notes and a lock stay. it won't put a case over one the runtime put there.
18 - `note` writes under the case's title, or on an item with `--item`. `-f -` reads stdin.
19 - `lock` takes one `--answer` per line of the lock, or asks for them if there's none. `a|b` takes either. lines are checked together, so a wrong try never says which line was right. only salted hashes are stored.
20 - `--rest 3/60`: after 3 wrong tries in a row the lock takes nothing for 60 minutes.
21 - `pull` only pulls what the bench put there.
22 
23 ## configuration
24 
25 - `CASEBENCH_DSN`: the hub's postgres.
26 - `CASEBENCH_REST`: the default for `--rest`. 3/60 if unset.
27 
28 `schema.sql` has the board tables as the bench expects them, for a local database.
29 
30 ## a case folder
31 
32     case.yaml
33     items/ticket.md
34     items/umbrella.md
35     items/umbrella.svg
36 
37 ```yaml
38 id: test-lost-umbrella
39 title: The lost umbrella
40 items:
41   - id: ticket
42     title: Cloakroom ticket
43     text: items/ticket.md
44   - id: umbrella
45     title: The umbrella
46     text: items/umbrella.md
47     images: [items/umbrella.svg]
48 ```
49 
50 ids are lowercase, digits and dashes. images: png, jpg, webp, svg. `examples/lost-umbrella` is a whole one.
51 
52 ## tests
53 
54     python -m unittest
55 
56 against the memstore. no database needed.