aboutsummaryrefslogtreecommitdiff
path: root/unittest/check_real_comp.sh
diff options
context:
space:
mode:
Diffstat (limited to 'unittest/check_real_comp.sh')
-rwxr-xr-xunittest/check_real_comp.sh15
1 files changed, 15 insertions, 0 deletions
diff --git a/unittest/check_real_comp.sh b/unittest/check_real_comp.sh
new file mode 100755
index 0000000..a7b57db
--- /dev/null
+++ b/unittest/check_real_comp.sh
@@ -0,0 +1,15 @@
+#!/usr/bin/env bash
+# check_real_comp.sh
+# Check the output of freedv_tx() and the real part of freedv_comptx() match,
+# as they use different code paths. Run from codec2/unittest, set path to
+# include codec2/build/misc and codec2/build/unittest
+
+set -x
+cat ../raw/ve9qrp_10s.raw | freedv_700d_tx > tx_700d.int16
+cat ../raw/ve9qrp_10s.raw | freedv_700d_comptx > tx_700d.iq16
+
+echo "tx_real=load_raw('tx_700d.int16'); tx_comp=load_raw('tx_700d.iq16'); \
+ tx_comp=tx_comp(1:2:end)+j*tx_comp(2:2:end); \
+ diff = sum(real(tx_comp)-tx_real); printf('diff: %f\n', diff); \
+ if diff < 1, quit(0), end; \
+ quit(1)" | octave-cli -p ../octave -qf