From d7813e83727fa1f1969e9789b4b1f7707c1a1ed7 Mon Sep 17 00:00:00 2001 From: Sebastian Kuzminsky Date: Wed, 5 Apr 2017 13:14:33 -0600 Subject: [PATCH] tests: add a test of ilowpass with low gain This test replicates an ilowpass off-by-one error reported by Stuart Stevenson: https://sourceforge.net/p/emc/mailman/message/35761624/ Signed-off-by: Sebastian Kuzminsky --- tests/ilowpass/low-gain/README | 2 ++ tests/ilowpass/low-gain/expected | 3 +++ tests/ilowpass/low-gain/test.hal | 20 ++++++++++++++++++++ 3 files changed, 25 insertions(+) create mode 100644 tests/ilowpass/low-gain/README create mode 100644 tests/ilowpass/low-gain/expected create mode 100644 tests/ilowpass/low-gain/test.hal diff --git a/tests/ilowpass/low-gain/README b/tests/ilowpass/low-gain/README new file mode 100644 index 00000000000..7bc24878cdc --- /dev/null +++ b/tests/ilowpass/low-gain/README @@ -0,0 +1,2 @@ +Test that ilowpass's output gets all the way to its target, even with +low gain. diff --git a/tests/ilowpass/low-gain/expected b/tests/ilowpass/low-gain/expected new file mode 100644 index 00000000000..b5ff9099284 --- /dev/null +++ b/tests/ilowpass/low-gain/expected @@ -0,0 +1,3 @@ +4 +0 +-5 diff --git a/tests/ilowpass/low-gain/test.hal b/tests/ilowpass/low-gain/test.hal new file mode 100644 index 00000000000..633c28c48d2 --- /dev/null +++ b/tests/ilowpass/low-gain/test.hal @@ -0,0 +1,20 @@ +loadrt threads +loadrt ilowpass +addf ilowpass.0 thread1 + +setp ilowpass.0.scale 1 +setp ilowpass.0.gain 0.1 + +start + +setp ilowpass.0.in 4 +loadusr -w sleep 1 +getp ilowpass.0.out + +setp ilowpass.0.in 0 +loadusr -w sleep 1 +getp ilowpass.0.out + +setp ilowpass.0.in -5 +loadusr -w sleep 1 +getp ilowpass.0.out