#!/bin/sh # Public test: the example from the task statement. cargo build -q --offline || { echo "FAIL: build"; exit 1; } got=$(printf '%s' 'capacity 2 put a 1 put b 2 get a put c 3 peek b dump get b stats put a 9 get a del zz ' | ./target/debug/lru) || { echo "FAIL: the program exited with an error"; exit 1; } expected=$(printf "%s" 'ok ok 1 evict b miss c a miss size 2 hits 1 misses 1 evictions 1 ok 9 miss ') if [ "$got" = "$expected" ]; then echo PASS; else echo "FAIL"; echo "--- expected"; printf '%s' "$expected"; echo "--- got"; printf '%s' "$got"; exit 1; fi