diff options
author | joshua <joshua@joshuayun.com> | 2023-12-30 23:54:31 -0500 |
---|---|---|
committer | joshua <joshua@joshuayun.com> | 2023-12-30 23:54:31 -0500 |
commit | 86608c6770cf08c138a2bdab5855072f64be09ef (patch) | |
tree | 494a61b3ef37e76f9235a0d10f5c93d97290a35f /Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests | |
download | sdr-software-86608c6770cf08c138a2bdab5855072f64be09ef.tar.gz |
Diffstat (limited to 'Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests')
9 files changed, 354 insertions, 0 deletions
diff --git a/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/max_tests.c b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/max_tests.c new file mode 100644 index 0000000..d60973b --- /dev/null +++ b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/max_tests.c @@ -0,0 +1,36 @@ +#include "jtest.h"
+#include "statistics_test_data.h"
+#include "arr_desc.h"
+#include "arm_math.h" /* FUTs */
+#include "ref.h" /* Reference Functions */
+#include "test_templates.h"
+#include "statistics_templates.h"
+#include "type_abbrev.h"
+
+#define JTEST_ARM_MAX_TEST(suffix) \
+ STATISTICS_DEFINE_TEST_TEMPLATE_BUF1_BLK( \
+ max, \
+ suffix, \
+ TYPE_FROM_ABBREV(suffix), \
+ TYPE_FROM_ABBREV(suffix), \
+ STATISTICS_COMPARE_INTERFACE)
+
+JTEST_ARM_MAX_TEST(f32);
+JTEST_ARM_MAX_TEST(q31);
+JTEST_ARM_MAX_TEST(q15);
+JTEST_ARM_MAX_TEST(q7);
+
+/*--------------------------------------------------------------------------------*/
+/* Collect all tests in a group. */
+/*--------------------------------------------------------------------------------*/
+
+JTEST_DEFINE_GROUP(max_tests)
+{
+ /*
+ To skip a test, comment it out.
+ */
+ JTEST_TEST_CALL(arm_max_f32_test);
+ JTEST_TEST_CALL(arm_max_q31_test);
+ JTEST_TEST_CALL(arm_max_q15_test);
+ JTEST_TEST_CALL(arm_max_q7_test);
+}
diff --git a/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/mean_tests.c b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/mean_tests.c new file mode 100644 index 0000000..291c10a --- /dev/null +++ b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/mean_tests.c @@ -0,0 +1,36 @@ +#include "jtest.h"
+#include "statistics_test_data.h"
+#include "arr_desc.h"
+#include "arm_math.h" /* FUTs */
+#include "ref.h" /* Reference Functions */
+#include "test_templates.h"
+#include "statistics_templates.h"
+#include "type_abbrev.h"
+
+#define JTEST_ARM_MEAN_TEST(suffix) \
+ STATISTICS_DEFINE_TEST_TEMPLATE_BUF1_BLK( \
+ mean, \
+ suffix, \
+ TYPE_FROM_ABBREV(suffix), \
+ TYPE_FROM_ABBREV(suffix), \
+ STATISTICS_COMPARE_INTERFACE)
+
+JTEST_ARM_MEAN_TEST(f32);
+JTEST_ARM_MEAN_TEST(q31);
+JTEST_ARM_MEAN_TEST(q15);
+JTEST_ARM_MEAN_TEST(q7);
+
+/*--------------------------------------------------------------------------------*/
+/* Collect all tests in a group. */
+/*--------------------------------------------------------------------------------*/
+
+JTEST_DEFINE_GROUP(mean_tests)
+{
+ /*
+ To skip a test, comment it out.
+ */
+ JTEST_TEST_CALL(arm_mean_f32_test);
+ JTEST_TEST_CALL(arm_mean_q31_test);
+ JTEST_TEST_CALL(arm_mean_q15_test);
+ JTEST_TEST_CALL(arm_mean_q7_test);
+}
diff --git a/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/min_tests.c b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/min_tests.c new file mode 100644 index 0000000..9d831d0 --- /dev/null +++ b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/min_tests.c @@ -0,0 +1,36 @@ +#include "jtest.h"
+#include "statistics_test_data.h"
+#include "arr_desc.h"
+#include "arm_math.h" /* FUTs */
+#include "ref.h" /* Reference Functions */
+#include "test_templates.h"
+#include "statistics_templates.h"
+#include "type_abbrev.h"
+
+#define JTEST_ARM_MIN_TEST(suffix) \
+ STATISTICS_DEFINE_TEST_TEMPLATE_BUF1_BLK( \
+ min, \
+ suffix, \
+ TYPE_FROM_ABBREV(suffix), \
+ TYPE_FROM_ABBREV(suffix), \
+ STATISTICS_COMPARE_INTERFACE)
+
+JTEST_ARM_MIN_TEST(f32);
+JTEST_ARM_MIN_TEST(q31);
+JTEST_ARM_MIN_TEST(q15);
+JTEST_ARM_MIN_TEST(q7);
+
+/*--------------------------------------------------------------------------------*/
+/* Collect all tests in a group. */
+/*--------------------------------------------------------------------------------*/
+
+JTEST_DEFINE_GROUP(min_tests)
+{
+ /*
+ To skip a test, comment it out.
+ */
+ JTEST_TEST_CALL(arm_min_f32_test);
+ JTEST_TEST_CALL(arm_min_q31_test);
+ JTEST_TEST_CALL(arm_min_q15_test);
+ JTEST_TEST_CALL(arm_min_q7_test);
+}
diff --git a/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/power_tests.c b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/power_tests.c new file mode 100644 index 0000000..12c30ea --- /dev/null +++ b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/power_tests.c @@ -0,0 +1,36 @@ +#include "jtest.h"
+#include "statistics_test_data.h"
+#include "arr_desc.h"
+#include "arm_math.h" /* FUTs */
+#include "ref.h" /* Reference Functions */
+#include "test_templates.h"
+#include "statistics_templates.h"
+#include "type_abbrev.h"
+
+#define JTEST_ARM_POWER_TEST(suffix, output_type) \
+ STATISTICS_DEFINE_TEST_TEMPLATE_BUF1_BLK( \
+ power, \
+ suffix, \
+ TYPE_FROM_ABBREV(suffix), \
+ TYPE_FROM_ABBREV(suffix), \
+ STATISTICS_SNR_COMPARE_INTERFACE)
+
+JTEST_ARM_POWER_TEST(f32, float32_t);
+JTEST_ARM_POWER_TEST(q31, q63_t);
+JTEST_ARM_POWER_TEST(q15, q63_t);
+JTEST_ARM_POWER_TEST(q7, q31_t);
+
+/*--------------------------------------------------------------------------------*/
+/* Collect all tests in a group. */
+/*--------------------------------------------------------------------------------*/
+
+JTEST_DEFINE_GROUP(power_tests)
+{
+ /*
+ To skip a test, comment it out.
+ */
+ JTEST_TEST_CALL(arm_power_f32_test);
+ JTEST_TEST_CALL(arm_power_q31_test);
+ JTEST_TEST_CALL(arm_power_q15_test);
+ JTEST_TEST_CALL(arm_power_q7_test);
+}
diff --git a/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/rms_tests.c b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/rms_tests.c new file mode 100644 index 0000000..d9b1a24 --- /dev/null +++ b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/rms_tests.c @@ -0,0 +1,34 @@ +#include "jtest.h"
+#include "statistics_test_data.h"
+#include "arr_desc.h"
+#include "arm_math.h" /* FUTs */
+#include "ref.h" /* Reference Functions */
+#include "test_templates.h"
+#include "statistics_templates.h"
+#include "type_abbrev.h"
+
+#define JTEST_ARM_RMS_TEST(suffix) \
+ STATISTICS_DEFINE_TEST_TEMPLATE_BUF1_BLK( \
+ rms, \
+ suffix, \
+ TYPE_FROM_ABBREV(suffix), \
+ TYPE_FROM_ABBREV(suffix), \
+ STATISTICS_SNR_COMPARE_INTERFACE)
+
+JTEST_ARM_RMS_TEST(f32);
+JTEST_ARM_RMS_TEST(q31);
+JTEST_ARM_RMS_TEST(q15);
+
+/*--------------------------------------------------------------------------------*/
+/* Collect all tests in a group. */
+/*--------------------------------------------------------------------------------*/
+
+JTEST_DEFINE_GROUP(rms_tests)
+{
+ /*
+ To skip a test, comment it out.
+ */
+ JTEST_TEST_CALL(arm_rms_f32_test);
+ JTEST_TEST_CALL(arm_rms_q31_test);
+ JTEST_TEST_CALL(arm_rms_q15_test);
+}
diff --git a/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/statistics_test_common_data.c b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/statistics_test_common_data.c new file mode 100644 index 0000000..ebf4580 --- /dev/null +++ b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/statistics_test_common_data.c @@ -0,0 +1,94 @@ +#include "statistics_test_data.h"
+
+/*--------------------------------------------------------------------------------*/
+/* Input/Output Buffers */
+/*--------------------------------------------------------------------------------*/
+
+
+ARR_DESC_DEFINE(STATISTICS_BIGGEST_INPUT_TYPE,
+ statistics_output_fut,
+ STATISTICS_MAX_INPUT_ELEMENTS,
+ CURLY(0));
+
+ARR_DESC_DEFINE(STATISTICS_BIGGEST_INPUT_TYPE,
+ statistics_output_ref,
+ STATISTICS_MAX_INPUT_ELEMENTS,
+ CURLY(0));
+
+uint32_t statistics_idx_fut = 0;
+uint32_t statistics_idx_ref = 0;
+
+STATISTICS_BIGGEST_INPUT_TYPE
+statistics_output_f32_ref[STATISTICS_MAX_INPUT_ELEMENTS];
+
+STATISTICS_BIGGEST_INPUT_TYPE
+statistics_output_f32_fut[STATISTICS_MAX_INPUT_ELEMENTS];
+
+/*--------------------------------------------------------------------------------*/
+/* 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,
+ statistics_block_sizes,
+ 4,
+ CURLY(1, 2, 15, 32));
+
+/*--------------------------------------------------------------------------------*/
+/* Test Data */
+/*--------------------------------------------------------------------------------*/
+
+ARR_DESC_DEFINE(float32_t,
+ statistics_f_32,
+ 32,
+ CURLY(
+ -0.0865129623056441 , -0.3331168756476194,
+ 0.0250664612949661 , 0.0575352840717098,
+ -0.2292942701362928 , 0.2381830931285998,
+ 0.2378328403304206 , -0.0075266553186635,
+ 0.0654584722817308 , 0.0349278285641849,
+ -0.0373417155362879 , 0.1451581096586606,
+ -0.1176633086028378 , 0.4366371636394202,
+ -0.0272791766173191 , 0.0227862627041619,
+ 0.2133536422718378 , 0.0118562921047211,
+ -0.0191296810967338 , -0.1664698927300045,
+ 0.0588821632785281 , -0.2672363715875608,
+ 0.1428649103637904 , 0.3247124128892542,
+ -0.1383551403404573 , 0.1715993345656525,
+ 0.2508002843205065 , -0.3187459152894954,
+ -0.2881928863802040 , 0.1142295247316356,
+ -0.0799771155430726 , 0.1379994750928690
+ ));
+
+
+ARR_DESC_DEFINE_SUBSET(statistics_f_31,
+ statistics_f_32,
+ 31);
+
+ARR_DESC_DEFINE_SUBSET(statistics_f_15,
+ statistics_f_32,
+ 15);
+
+ARR_DESC_DEFINE_SUBSET(statistics_f_2,
+ statistics_f_32,
+ 2);
+
+ARR_DESC_DEFINE(float32_t,
+ statistics_zeros,
+ 32,
+ CURLY(0));
+
+/* Aggregate all float datasets */
+ARR_DESC_DEFINE(ARR_DESC_t *,
+ statistics_f_all,
+ 4,
+ CURLY(
+ &statistics_zeros,
+ &statistics_f_2,
+ &statistics_f_15,
+ &statistics_f_32
+ ));
diff --git a/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/statistics_test_group.c b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/statistics_test_group.c new file mode 100644 index 0000000..6a610a6 --- /dev/null +++ b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/statistics_test_group.c @@ -0,0 +1,14 @@ +#include "jtest.h"
+#include "statistics_tests.h"
+
+JTEST_DEFINE_GROUP(statistics_tests)
+{
+ JTEST_GROUP_CALL(max_tests);
+ JTEST_GROUP_CALL(mean_tests);
+ JTEST_GROUP_CALL(min_tests);
+ JTEST_GROUP_CALL(power_tests);
+ JTEST_GROUP_CALL(rms_tests);
+ JTEST_GROUP_CALL(std_tests);
+ JTEST_GROUP_CALL(var_tests);
+ return;
+}
diff --git a/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/std_tests.c b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/std_tests.c new file mode 100644 index 0000000..b80ed71 --- /dev/null +++ b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/std_tests.c @@ -0,0 +1,34 @@ +#include "jtest.h"
+#include "statistics_test_data.h"
+#include "arr_desc.h"
+#include "arm_math.h" /* FUTs */
+#include "ref.h" /* Reference Functions */
+#include "test_templates.h"
+#include "statistics_templates.h"
+#include "type_abbrev.h"
+
+#define JTEST_ARM_STD_TEST(suffix) \
+ STATISTICS_DEFINE_TEST_TEMPLATE_BUF1_BLK( \
+ std, \
+ suffix, \
+ TYPE_FROM_ABBREV(suffix), \
+ TYPE_FROM_ABBREV(suffix), \
+ STATISTICS_SNR_COMPARE_INTERFACE)
+
+JTEST_ARM_STD_TEST(f32);
+JTEST_ARM_STD_TEST(q31);
+JTEST_ARM_STD_TEST(q15);
+
+/*--------------------------------------------------------------------------------*/
+/* Collect all tests in a group. */
+/*--------------------------------------------------------------------------------*/
+
+JTEST_DEFINE_GROUP(std_tests)
+{
+ /*
+ To skip a test, comment it out.
+ */
+ JTEST_TEST_CALL(arm_std_f32_test);
+ JTEST_TEST_CALL(arm_std_q31_test);
+ JTEST_TEST_CALL(arm_std_q15_test);
+}
diff --git a/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/var_tests.c b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/var_tests.c new file mode 100644 index 0000000..3aa7c27 --- /dev/null +++ b/Drivers/CMSIS/DSP/DSP_Lib_TestSuite/Common/src/statistics_tests/var_tests.c @@ -0,0 +1,34 @@ +#include "jtest.h"
+#include "statistics_test_data.h"
+#include "arr_desc.h"
+#include "arm_math.h" /* FUTs */
+#include "ref.h" /* Reference Functions */
+#include "test_templates.h"
+#include "statistics_templates.h"
+#include "type_abbrev.h"
+
+#define JTEST_ARM_VAR_TEST(suffix) \
+ STATISTICS_DEFINE_TEST_TEMPLATE_BUF1_BLK( \
+ var, \
+ suffix, \
+ TYPE_FROM_ABBREV(suffix), \
+ TYPE_FROM_ABBREV(suffix), \
+ STATISTICS_SNR_COMPARE_INTERFACE)
+
+JTEST_ARM_VAR_TEST(f32);
+JTEST_ARM_VAR_TEST(q31);
+JTEST_ARM_VAR_TEST(q15);
+
+/*--------------------------------------------------------------------------------*/
+/* Collect all tests in a group. */
+/*--------------------------------------------------------------------------------*/
+
+JTEST_DEFINE_GROUP(var_tests)
+{
+ /*
+ To skip a test, comment it out.
+ */
+ JTEST_TEST_CALL(arm_var_f32_test);
+ JTEST_TEST_CALL(arm_var_q31_test);
+ JTEST_TEST_CALL(arm_var_q15_test);
+}
|