Skip to content

Commit

Permalink
Add error messages to test.sh and taxcalc.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
martinholmer committed Dec 12, 2018
1 parent eb1f6ae commit 50b7940
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 3 deletions.
12 changes: 12 additions & 0 deletions taxcalc/validation/taxsim/taxcalc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,24 @@ fi
L=${LYY_FN:0:1}
YY=${LYY_FN:1:2}
python prepare_taxcalc_input.py $LYY_FN $LYY_FN.csv
if [[ $? -ne 0 ]]; then
echo "ERROR: prepare_taxcalc_input.py failed"
exit 1
fi
# ... calculate Tax-Calculator output
tc $LYY_FN.csv 20$YY --reform taxsim_emulation.json --dump
if [[ $? -ne 0 ]]; then
echo "ERROR: taxcalc package is not available"
exit 1
fi
mv $LYY_FN-$YY-#-taxsim_emulation-#.csv $LYY_FN.out.csv
rm -f $LYY_FN-$YY-#-taxsim_emulation-#-doc.text
# ... convert Tax-Calculator output to Internet-TAXSIM-27-format
python process_taxcalc_output.py $LYY_FN.out.csv $LYY_FN.out-taxcalc
if [[ $? -ne 0 ]]; then
echo "ERROR: process_taxcalc_output.py failed"
exit 1
fi
# ... delete intermediate input and output files if not saving files
if [[ $SAVE == false ]]; then
rm -f $LYY_FN.csv
Expand Down
14 changes: 11 additions & 3 deletions taxcalc/validation/taxsim/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,16 +32,24 @@ fi
L=${LYY:0:1}
YY=${LYY:1:2}
python taxsim_input.py 20$YY $L > $LYY.in
if [[ $? -ne 0 ]]; then
echo "ERROR: taxsim_input.py failed"
exit 1
fi
# (2) generate TAXSIM-27-formatted output using Tax-Calculator tc CLI
./taxcalc.sh $LYY.in $SAVE
if [[ $? -ne 0 ]]; then
echo "ERROR: taxcalc.sh failed"
exit 1
fi
# (3) generate tax differences
# ... unzip TAXSIM-27 OUTPUT for specified INPUT
unzip -oq output-taxsim.zip $LYY.in.out-taxsim
# ... compare Tax-Calculator OUTPUT and TAXSIM-27 OUTPUT files
tclsh taxdiffs.tcl $LYY.in.out-taxcalc $LYY.in.out-taxsim > $LYY.taxdiffs-actual
RC=$?
if [[ $RC -ne 0 ]]; then
exit $RC
if [[ $? -ne 0 ]]; then
echo "ERROR: taxdiffs.tcl failed"
exit 1
fi
# check for difference between LYY.taxdiffs-actual and LYY.taxdiffs-expect
diff --brief $LYY.taxdiffs-actual $LYY.taxdiffs-expect
Expand Down

0 comments on commit 50b7940

Please sign in to comment.