Project

General

Profile

1 53 aaronmk
#!/bin/bash
2 106 aaronmk
# Tests map on all input/*.csv
3
# Usage: env [n=<num-rows>] self
4 53 aaronmk
5
selfDir="$(dirname -- "$0")"
6
cd "$selfDir"
7
8
test -n "$n" || n=2
9 106 aaronmk
let n++ # include header row
10 53 aaronmk
11 106 aaronmk
# Update generated mappings
12
../../mappings/extract_plot_map
13
../../mappings/join_all_vegbank
14 53 aaronmk
15 106 aaronmk
for in in input/*.csv; do
16
    stem="$(basename -- "${in%.csv}")" # remove extension and dir
17
    src="${stem%.*}" # before last "."
18
    type="${stem##*.}" # after last "."
19
20
    # Test exporting to XML
21
    for fmt in VegX VegBank; do
22
        out="$stem.$fmt.xml"
23 110 aaronmk
        (set -x; head -"$n" "$in"|../map "../../mappings/$src-$fmt.$type.csv" \
24
        >"output/$out" && diff "accepted_output/$out" "output/$out")
25 106 aaronmk
    done
26
27
    # Test exporting to VegBank db
28 110 aaronmk
    (set -x; head -"$n" "$in"|../map2vegbank \
29
    "../../mappings/$src-VegBank.$type.csv")
30 106 aaronmk
done