mirror of
https://git.rwth-aachen.de/acs/public/villas/node/
synced 2025-03-09 00:00:00 +01:00
tests: add integration test for averaging hook
This commit is contained in:
parent
6ff4c838b4
commit
2ff86fed25
1 changed files with 65 additions and 0 deletions
65
tests/integration/hook-average.sh
Executable file
65
tests/integration/hook-average.sh
Executable file
|
@ -0,0 +1,65 @@
|
|||
#!/bin/bash
|
||||
#
|
||||
# Integration test for average hook.
|
||||
#
|
||||
# @author Steffen Vogel <stvogel@eonerc.rwth-aachen.de>
|
||||
# @copyright 2014-2019, Institute for Automation of Complex Power Systems, EONERC
|
||||
# @license GNU General Public License (version 3)
|
||||
#
|
||||
# VILLASnode
|
||||
#
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
##################################################################################
|
||||
|
||||
INPUT_FILE=$(mktemp)
|
||||
OUTPUT_FILE=$(mktemp)
|
||||
EXPECT_FILE=$(mktemp)
|
||||
|
||||
cat <<EOF > ${INPUT_FILE}
|
||||
1548104309.033621000(0) 0.022245 0.590769 -1.000000 0.597649 0.100588
|
||||
1548104309.133998900(1) 0.015339 0.952914 -1.000000 0.196137 0.200966
|
||||
1548104309.233542500(2) 0.027500 0.950063 -1.000000 -0.202037 0.300509
|
||||
1548104309.334019400(3) 0.040320 0.582761 -1.000000 -0.603945 0.400986
|
||||
1548104309.433952200(4) 0.026079 -0.005774 1.000000 -0.996324 0.500919
|
||||
1548104309.533756400(5) 0.049262 -0.591455 1.000000 -0.597107 0.600723
|
||||
1548104309.637440300(6) 0.014883 -0.959248 1.000000 -0.182372 0.704407
|
||||
1548104309.736158700(7) 0.023232 -0.944805 1.000000 0.212502 0.803126
|
||||
1548104309.833614900(8) 0.015231 -0.584824 1.000000 0.602327 0.900582
|
||||
1548104309.934288200(9) 0.060849 0.007885 -1.000000 0.994980 0.001255
|
||||
EOF
|
||||
|
||||
cat <<EOF > ${EXPECT_FILE}
|
||||
1548104309.033621000(0) -0.488878 0.590769 -1.000000 0.597649 0.100588
|
||||
1548104309.133998900(1) -0.492331 0.952914 -1.000000 0.196137 0.200966
|
||||
1548104309.233542500(2) -0.486250 0.950063 -1.000000 -0.202037 0.300509
|
||||
1548104309.334019400(3) -0.479840 0.582761 -1.000000 -0.603945 0.400986
|
||||
1548104309.433952200(4) 0.513039 -0.005774 1.000000 -0.996324 0.500919
|
||||
1548104309.533756400(5) 0.524631 -0.591455 1.000000 -0.597107 0.600723
|
||||
1548104309.637440300(6) 0.507441 -0.959248 1.000000 -0.182372 0.704407
|
||||
1548104309.736158700(7) 0.511616 -0.944805 1.000000 0.212502 0.803126
|
||||
1548104309.833614900(8) 0.507615 -0.584824 1.000000 0.602327 0.900582
|
||||
1548104309.934288200(9) -0.469575 0.007885 -1.000000 0.994980 0.001255
|
||||
EOF
|
||||
|
||||
# Average over first and third signal (mask = 0b101 = 5)
|
||||
villas-hook -o mask=5 -o offset=0 average < ${INPUT_FILE} > ${OUTPUT_FILE}
|
||||
|
||||
# Compare only the data values
|
||||
villas-test-cmp ${OUTPUT_FILE} ${EXPECT_FILE}
|
||||
|
||||
RC=$?
|
||||
|
||||
rm -f ${INPUT_FILE} ${OUTPUT_FILE} ${EXPECT_FILE}
|
||||
|
||||
exit $RC
|
Loading…
Add table
Reference in a new issue