#!/bin/bash
# Reruns every measurement on the Word counter and Hashtag counter of the Koldflux tools and writes test-results.txt.
# Needs: node 20+ with playwright (set PW to its path if it is not installed here), python3.
cd "$(dirname "$0")" && W=$(mktemp -d)
{
echo "== date: $(date -u +%F) =="
echo "== python: $(python3 --version 2>&1), node: $(node --version) (ICU $(node -p process.versions.icu), Unicode $(node -p process.versions.unicode)) =="
python3 gen_inputs.py
node tool.cjs inputs.json "$W/wc.json" tool-shot.png && echo "word counter run: ok"
node hashtag.cjs tags.json "$W/ht.json" hashtag-shot.png && echo "hashtag counter run: ok"
node count.mjs inputs.json > "$W/counts.jsonl"
python3 analyze.py inputs.json "$W/wc.json" "$W/counts.jsonl" tags.json "$W/ht.json"
} 2>&1 | tee test-results.txt
cp "$W/wc.json" wordcounter.json; cp "$W/ht.json" hashtagcounter.json
