#!/bin/bash

# Run FASB DQCRT taxonomy tests 
#
# Tests DQCRT/2024 against XBRL-US filings
#
# Assumes 8 core cpu to run in 5 hrs
#
# Results have been verified by XBRL-US against their databasee of results
#
# Requires arelle disclosure system efm-preview-dqcrt-testing
#
# Result report files merged by script mergeEFMDQC2020TestsOut.sh

ARELLECMDLINESRC=<Arelle-dir>/arelleCmdLine.py
PYTHON=python3.11
PLUGINS='EDGAR/render'
EFM_VAL=efm-pragmatic-nonblocking

rm -f out/DQCRT-2024-more-*

for f in $(seq 1 `ls DQCRT-2024-test-more-*.xml|wc -l`)
do
	TESTCASESROOT=DQCRT-2024-test-more-${f}.xml
	f2dig=$(printf "%02d" ${f})
	OUTPUTLOGFILE=out/DQCRT-2024-more-log-${f2dig}.log
	OUTPUTERRFILE=out/DQCRT-2024-more-err-${f2dig}.txt
	OUTPUTCSVFILE=out/DQCRT-2024-more-report-${f2dig}.csv
	TESTCASESINDEXFILE=$TESTCASESROOT

	$PYTHON $ARELLECMDLINESRC --file "$TESTCASESINDEXFILE" --noCertificateCheck --plugins $PLUGINS --disclosureSystem $EFM_VAL --validate --testcaseResultOptions match-any --csvTestReport "$OUTPUTCSVFILE" --testcaseResultsCaptureWarnings --logFile "$OUTPUTLOGFILE" &>  "$OUTPUTERRFILE" &
	echo "$! " >> out/DQCRT-2024-more-PIDs
done
