summaryrefslogtreecommitdiff
path: root/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests
diff options
context:
space:
mode:
authorjoshua <joshua@joshuayun.com>2023-12-30 23:54:31 -0500
committerjoshua <joshua@joshuayun.com>2023-12-30 23:54:31 -0500
commit86608c6770cf08c138a2bdab5855072f64be09ef (patch)
tree494a61b3ef37e76f9235a0d10f5c93d97290a35f /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests
downloadsdr-software-master.tar.gz
initial commitHEADmaster
Diffstat (limited to 'Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests')
-rw-r--r--Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/copy_tests.c33
-rw-r--r--Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/fill_tests.c36
-rw-r--r--Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/support_test_common_data.c85
-rw-r--r--Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/support_test_group.c10
-rw-r--r--Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/x_to_y_tests.c80
5 files changed, 244 insertions, 0 deletions
diff --git a/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/copy_tests.c b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/copy_tests.c
new file mode 100644
index 0000000..3804f63
--- /dev/null
+++ b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/copy_tests.c
@@ -0,0 +1,33 @@
+#include "jtest.h"
+#include "support_test_data.h"
+#include "arr_desc.h"
+#include "arm_math.h" /* FUTs */
+#include "ref.h" /* Reference Functions */
+#include "test_templates.h"
+#include "support_templates.h"
+#include "type_abbrev.h"
+
+#define JTEST_ARM_COPY_TEST(suffix) \
+ SUPPORT_DEFINE_TEST_TEMPLATE_BUF1_BLK( \
+ copy, \
+ suffix, \
+ TYPE_FROM_ABBREV(suffix), \
+ TYPE_FROM_ABBREV(suffix), \
+ SUPPORT_COMPARE_INTERFACE)
+
+JTEST_ARM_COPY_TEST(f32);
+JTEST_ARM_COPY_TEST(q31);
+JTEST_ARM_COPY_TEST(q15);
+JTEST_ARM_COPY_TEST(q7);
+
+/*--------------------------------------------------------------------------------*/
+/* Collect all tests in a group. */
+/*--------------------------------------------------------------------------------*/
+
+JTEST_DEFINE_GROUP(copy_tests)
+{
+ JTEST_TEST_CALL(arm_copy_f32_test);
+ JTEST_TEST_CALL(arm_copy_q31_test);
+ JTEST_TEST_CALL(arm_copy_q15_test);
+ JTEST_TEST_CALL(arm_copy_q7_test);
+}
diff --git a/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/fill_tests.c b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/fill_tests.c
new file mode 100644
index 0000000..fc5892d
--- /dev/null
+++ b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/fill_tests.c
@@ -0,0 +1,36 @@
+#include "jtest.h"
+#include "support_test_data.h"
+#include "arr_desc.h"
+#include "arm_math.h" /* FUTs */
+#include "ref.h" /* Reference Functions */
+#include "test_templates.h"
+#include "support_templates.h"
+#include "type_abbrev.h"
+
+#define JTEST_ARM_FILL_TEST(suffix) \
+ SUPPORT_DEFINE_TEST_TEMPLATE_ELT1_BLK( \
+ fill, \
+ suffix, \
+ TYPE_FROM_ABBREV(suffix), \
+ TYPE_FROM_ABBREV(suffix), \
+ SUPPORT_COMPARE_INTERFACE)
+
+JTEST_ARM_FILL_TEST(f32);
+JTEST_ARM_FILL_TEST(q31);
+JTEST_ARM_FILL_TEST(q15);
+JTEST_ARM_FILL_TEST(q7);
+
+/*--------------------------------------------------------------------------------*/
+/* Collect all tests in a group. */
+/*--------------------------------------------------------------------------------*/
+
+JTEST_DEFINE_GROUP(fill_tests)
+{
+ /*
+ To skip a test, comment it out.
+ */
+ JTEST_TEST_CALL(arm_fill_f32_test);
+ JTEST_TEST_CALL(arm_fill_q31_test);
+ JTEST_TEST_CALL(arm_fill_q15_test);
+ JTEST_TEST_CALL(arm_fill_q7_test);
+}
diff --git a/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/support_test_common_data.c b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/support_test_common_data.c
new file mode 100644
index 0000000..f4b5911
--- /dev/null
+++ b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/support_test_common_data.c
@@ -0,0 +1,85 @@
+#include "arm_math.h"
+#include "support_test_data.h"
+
+#define MAX_INPUT_ELEMENTS 32
+#define BIGGEST_INPUT_TYPE float32_t
+
+/*--------------------------------------------------------------------------------*/
+/* Input/Output Buffers */
+/*--------------------------------------------------------------------------------*/
+
+ARR_DESC_DEFINE(BIGGEST_INPUT_TYPE,
+ support_output_fut,
+ MAX_INPUT_ELEMENTS,
+ CURLY(0));
+
+ARR_DESC_DEFINE(BIGGEST_INPUT_TYPE,
+ support_output_ref,
+ MAX_INPUT_ELEMENTS,
+ CURLY(0));
+
+/*--------------------------------------------------------------------------------*/
+/* Block Sizes */
+/*--------------------------------------------------------------------------------*/
+
+/*
+ To change test parameter values add/remove values inside CURLY and update
+ the preceeding parameter to reflect the number of values inside CURLY.
+*/
+
+ARR_DESC_DEFINE(uint32_t,
+ support_block_sizes,
+ 4,
+ CURLY( 2, 7, 15, 32));
+
+/*--------------------------------------------------------------------------------*/
+/* Numbers */
+/*--------------------------------------------------------------------------------*/
+
+ARR_DESC_DEFINE(uint32_t,
+ support_elts,
+ 4,
+ CURLY( 0, 1, 0x80000000, 0x7fffffff));
+
+/*--------------------------------------------------------------------------------*/
+/* Test Data */
+/*--------------------------------------------------------------------------------*/
+
+ARR_DESC_DEFINE(float32_t,
+ support_f_32,
+ 32,
+ CURLY(
+ 0.24865986 , -0.13364227, -0.27233250 , -7.33488200,
+ 0.42190653 , 1.17435880 , -0.49824914 , 0.87883663,
+ 0.63066370 , 1.80275680 , -84.83916000, -2.06773800,
+ 7.63452500 , 1.01487610 , -0.65785825 , 1.78019030,
+ -0.34160388, 0.68546050 , -1.81721590 , -0.10340453,
+ -4.48600340, -1.69763480, -1.26022340 , -1.58457480,
+ 0.51993870 , 2.83526470 , -0.21502694 , -0.57690346,
+ -0.22945681, 0.79509383 , 0.07275216 , -2.16279080
+ ));
+
+/* Alias the 32 element array with wrappers that end sooner. */
+ARR_DESC_DEFINE_SUBSET(support_f_15,
+ support_f_32,
+ 15);
+
+ARR_DESC_DEFINE_SUBSET(support_f_2,
+ support_f_32,
+ 2);
+
+ARR_DESC_DEFINE(float32_t,
+ support_zeros,
+ 32,
+ CURLY(0));
+
+/* Aggregate all float datasets. */
+ARR_DESC_DEFINE(ARR_DESC_t *,
+ support_f_all,
+ 4,
+ CURLY(
+ &support_zeros,
+ &support_f_2,
+ &support_f_15,
+ &support_f_32
+ ));
diff --git a/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/support_test_group.c b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/support_test_group.c
new file mode 100644
index 0000000..7cc2732
--- /dev/null
+++ b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/support_test_group.c
@@ -0,0 +1,10 @@
+#include "jtest.h"
+#include "support_tests.h"
+
+JTEST_DEFINE_GROUP(support_tests)
+{
+ JTEST_GROUP_CALL(copy_tests);
+ JTEST_GROUP_CALL(fill_tests);
+ JTEST_GROUP_CALL(x_to_y_tests);
+ return;
+}
diff --git a/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/x_to_y_tests.c b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/x_to_y_tests.c
new file mode 100644
index 0000000..4667031
--- /dev/null
+++ b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/support_tests/x_to_y_tests.c
@@ -0,0 +1,80 @@
+#include "jtest.h"
+#include "support_test_data.h"
+#include "arr_desc.h"
+#include "arm_math.h" /* FUTs */
+#include "ref.h" /* Reference Functions */
+#include "test_templates.h"
+#include "support_templates.h"
+#include "type_abbrev.h"
+
+/* Aliases to play nicely with templates. */
+#define arm_f32_to_q31 arm_float_to_q31
+#define arm_f32_to_q15 arm_float_to_q15
+#define arm_f32_to_q7 arm_float_to_q7
+#define arm_q31_to_f32 arm_q31_to_float
+#define arm_q15_to_f32 arm_q15_to_float
+#define arm_q7_to_f32 arm_q7_to_float
+#define ref_f32_to_q31 ref_float_to_q31
+#define ref_f32_to_q15 ref_float_to_q15
+#define ref_f32_to_q7 ref_float_to_q7
+#define ref_q31_to_f32 ref_q31_to_float
+#define ref_q15_to_f32 ref_q15_to_float
+#define ref_q7_to_f32 ref_q7_to_float
+
+#define JTEST_ARM_X_TO_Y_TEST(prefix, suffix) \
+ JTEST_DEFINE_TEST(arm_##prefix##_to_##suffix##_test, \
+ arm_##prefix##_to_##suffix) \
+ { \
+ TEST_TEMPLATE_BUF1_BLK( \
+ support_f_all, \
+ support_block_sizes, \
+ TYPE_FROM_ABBREV(prefix), \
+ TYPE_FROM_ABBREV(suffix), \
+ arm_##prefix##_to_##suffix, \
+ ARM_x_to_y_INPUT_INTERFACE, \
+ ref_##prefix##_to_##suffix, \
+ REF_x_to_y_INPUT_INTERFACE, \
+ SUPPORT_COMPARE_INTERFACE); \
+ }
+
+JTEST_ARM_X_TO_Y_TEST(f32, q31);
+JTEST_ARM_X_TO_Y_TEST(f32, q15);
+JTEST_ARM_X_TO_Y_TEST(f32, q7);
+
+JTEST_ARM_X_TO_Y_TEST(q31, f32);
+JTEST_ARM_X_TO_Y_TEST(q31, q15);
+JTEST_ARM_X_TO_Y_TEST(q31, q7);
+
+JTEST_ARM_X_TO_Y_TEST(q15, f32);
+JTEST_ARM_X_TO_Y_TEST(q15, q31);
+JTEST_ARM_X_TO_Y_TEST(q15, q7);
+
+JTEST_ARM_X_TO_Y_TEST(q7, f32);
+JTEST_ARM_X_TO_Y_TEST(q7, q31);
+JTEST_ARM_X_TO_Y_TEST(q7, q15);
+
+/*--------------------------------------------------------------------------------*/
+/* Collect all tests in a group. */
+/*--------------------------------------------------------------------------------*/
+
+JTEST_DEFINE_GROUP(x_to_y_tests)
+{
+ /*
+ To skip a test, comment it out.
+ */
+ JTEST_TEST_CALL(arm_f32_to_q31_test);
+ JTEST_TEST_CALL(arm_f32_to_q15_test);
+ JTEST_TEST_CALL(arm_f32_to_q7_test);
+
+ JTEST_TEST_CALL(arm_q31_to_f32_test);
+ JTEST_TEST_CALL(arm_q31_to_q15_test);
+ JTEST_TEST_CALL(arm_q31_to_q7_test);
+
+ JTEST_TEST_CALL(arm_q15_to_f32_test);
+ JTEST_TEST_CALL(arm_q15_to_q31_test);
+ JTEST_TEST_CALL(arm_q15_to_q7_test);
+
+ JTEST_TEST_CALL(arm_q7_to_f32_test);
+ JTEST_TEST_CALL(arm_q7_to_q31_test);
+ JTEST_TEST_CALL(arm_q7_to_q15_test);
+}