ref: c383c39d35ee80f1659cf4c5ddde87105acad1e5
parent: 6c20946d1b654f2062d34c47765ddf3ace3e597b
author: sirjofri <sirjofri@sirjofri.de>
date: Thu Dec 18 07:45:35 EST 2025
adds test, fixes balance calculation test checks number of columns per data file tests are now run if they exist balance needs better tax calculation (with and without taxes, ...)
--- a/bin/balance
+++ b/bin/balance
@@ -28,7 +28,7 @@
datafiles=`{ls in/*/data.tsv}cat $datafiles | awk -F '\t' '
-!/^#/ && NF >= 4 {+!/^#/ && NF >= 5 {number = $1
total = $2
vat = $3
@@ -117,7 +117,7 @@
_'
# Ergebnis
-cat /tmp/in /tmp/outinv | awk -F '\t' '
+cat /tmp/invoices /tmp/in /tmp/outinv | awk -F '\t' '
{if ($2 < 0)
totalout += $2
--- /dev/null
+++ b/bin/test/vinvaliddata
@@ -1,0 +1,24 @@
+#!/bin/rc
+
+rfork en
+
+fn testfile{+ numcols = $1
+ fname = $2
+ awk -F '\t' '
+/^#/ { next }+NF < ENVIRON["numcols"] {+ gsub(/\t/, "—→")
+ printf "invalid number rows in %s:%d: %s\n", FILENAME, NR, $0
+}
+' $f
+}
+
+for (f in out/*/*/data.tsv)
+ testfile 2 $f >[1=2]
+
+for (f in in/*/data.tsv)
+ testfile 5 $f >[1=2]
+
+for (f in invoice/*/data.tsv)
+ testfile 5 $f >[1=2]
--- a/mkfile
+++ b/mkfile
@@ -5,8 +5,8 @@
test:VQ:
# run tests for data integrity
- bin/test/vmissingfiles
- bin/test/vvariables
+ for (t in bin/test/v*)
+ test -x $t && $t
balance:VQ: balance.pdf
--
⑨