#!/bin/sh # Public test: the example from the task statement. rec=$(aji run --fuel 800000000 --grant input=io.read --grant out=io.write --grant heap=mem.alloc:16777216 --stdin 'workers 2 The cat sat. the CAT, the hat a-b-c ' main.aji) got=$(printf '%s' "$rec" | python3 -c 'import json,sys; r=json.load(sys.stdin); print(r.get("stdout","") if r.get("status")=="returned" else "", end="")') || { echo "FAIL: no run record"; echo "$rec"; exit 1; } expected=$(printf "%s" 'worker 0 lines 2 words 6 worker 1 lines 1 words 4 distinct 7 the 3 cat 2 a 1 b 1 c 1 hat 1 sat 1 ') if [ "$got" = "$expected" ]; then echo PASS; else echo "FAIL"; echo "--- expected"; printf '%s' "$expected"; echo "--- got"; printf '%s' "$got"; exit 1; fi