PKGBUILD/test/goldenfiles/testdata.sh

33 lines
1.4 KiB
Bash
Raw Normal View History

#!/bin/bash
measuredValueTypes=("temperature" "humidity" "pressure")
fileExtentions=("csv" "json" "xml")
for t in ${measuredValueTypes[@]}; do
for i in $(seq 1 20); do
flucky ${t} read --compression=false --round=0
sleep $(shuf -i 0-1 -n 1)
done
for extension in ${fileExtentions[@]}; do
flucky convert --compression=false --round=0 logfile.csv golden${t}UncompressedNotRounded.${extension}
flucky convert --compression=true --round=0 logfile.csv golden${t}CompressedNotRounded.${extension}
flucky convert --compression=false --round=0.5 logfile.csv golden${t}UncompressedRounded.${extension}
flucky convert --compression=true --round=0.5 logfile.csv golden${t}CompressedRounded.${extension}
done;
rm logfile.csv
done
for extension in ${fileExtentions[@]}; do
for t in ${measuredValueTypes[@]}; do
cat golden${t}UncompressedNotRounded.${extension} >> goldenMeasuredValuesUncompressedNotRounded.${extension}
cat golden${t}CompressedNotRounded.${extension} >> goldenMeasuredValuesCompressedNotRounded.${extension}
cat golden${t}UncompressedRounded.${extension} >> goldenMeasuredValuesUncompressedRounded.${extension}
cat golden${t}CompressedRounded.${extension} >> goldenMeasuredValuesCompressedRounded.${extension}
done
done;
perl-rename 's/humidity/Humidities/g' *
perl-rename 's/pressure/Pressures/g' *
perl-rename 's/temperature/Temperatures/g' *