tests: lib: cmsis_dsp: move quaternionmath to new ztest API

Move test lib/cmsis_dsp/quaternionmath to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
This commit is contained in:
li biao 2022-07-15 14:24:57 +08:00 committed by Carles Cufí
parent df5a535a5f
commit d233b40bf1
4 changed files with 10 additions and 39 deletions

View file

@ -6,5 +6,4 @@ project(cmsis_dsp_quaternionmath)
target_sources(app PRIVATE
src/f32.c
src/main.c
)

View file

@ -1,4 +1,5 @@
CONFIG_ZTEST=y
CONFIG_ZTEST_NEW_API=y
CONFIG_NEWLIB_LIBC=y
CONFIG_CMSIS_DSP=y
CONFIG_CMSIS_DSP_QUATERNIONMATH=y

View file

@ -17,7 +17,7 @@
#define REL_ERROR_THRESH (1.0e-6)
#define ABS_ERROR_THRESH (1.0e-7)
void test_arm_quaternion_norm_f32(void)
ZTEST(quaternionmath_f32, test_arm_quaternion_norm_f32)
{
size_t length = ARRAY_SIZE(ref_norm);
const float32_t *input = (const float32_t *)in_com1;
@ -45,7 +45,7 @@ void test_arm_quaternion_norm_f32(void)
free(output);
}
void test_arm_quaternion_inverse_f32(void)
ZTEST(quaternionmath_f32, test_arm_quaternion_inverse_f32)
{
size_t length = ARRAY_SIZE(ref_inv);
const float32_t *input = (const float32_t *)in_com1;
@ -73,7 +73,7 @@ void test_arm_quaternion_inverse_f32(void)
free(output);
}
void test_arm_quaternion_conjugate_f32(void)
ZTEST(quaternionmath_f32, test_arm_quaternion_conjugate_f32)
{
size_t length = ARRAY_SIZE(ref_conj);
const float32_t *input = (const float32_t *)in_com1;
@ -101,7 +101,7 @@ void test_arm_quaternion_conjugate_f32(void)
free(output);
}
void test_arm_quaternion_normalize_f32(void)
ZTEST(quaternionmath_f32, test_arm_quaternion_normalize_f32)
{
size_t length = ARRAY_SIZE(ref_normalize);
const float32_t *input = (const float32_t *)in_com1;
@ -129,7 +129,7 @@ void test_arm_quaternion_normalize_f32(void)
free(output);
}
void test_arm_quaternion_product_single_f32(void)
ZTEST(quaternionmath_f32, test_arm_quaternion_product_single_f32)
{
size_t index;
size_t length = ARRAY_SIZE(ref_mult);
@ -167,7 +167,7 @@ void test_arm_quaternion_product_single_f32(void)
free(output_buf);
}
void test_arm_quaternion_product_f32(void)
ZTEST(quaternionmath_f32, test_arm_quaternion_product_f32)
{
size_t length = ARRAY_SIZE(ref_mult);
const float32_t *input1 = (const float32_t *)in_com1;
@ -196,7 +196,7 @@ void test_arm_quaternion_product_f32(void)
free(output);
}
void test_arm_quaternion2rotation_f32(void)
ZTEST(quaternionmath_f32, test_arm_quaternion2rotation_f32)
{
size_t length = ARRAY_SIZE(ref_quat2rot);
const float32_t *input = (const float32_t *)in_com1;
@ -224,7 +224,7 @@ void test_arm_quaternion2rotation_f32(void)
free(output);
}
void test_arm_rotation2quaternion_f32(void)
ZTEST(quaternionmath_f32, test_arm_rotation2quaternion_f32)
{
size_t length = ARRAY_SIZE(ref_rot2quat);
const float32_t *input = (const float32_t *)in_rot;
@ -262,18 +262,4 @@ void test_arm_rotation2quaternion_f32(void)
free(output);
}
void test_quaternionmath_f32(void)
{
ztest_test_suite(quaternionmath_f32,
ztest_unit_test(test_arm_quaternion_norm_f32),
ztest_unit_test(test_arm_quaternion_inverse_f32),
ztest_unit_test(test_arm_quaternion_conjugate_f32),
ztest_unit_test(test_arm_quaternion_normalize_f32),
ztest_unit_test(test_arm_quaternion_product_single_f32),
ztest_unit_test(test_arm_quaternion_product_f32),
ztest_unit_test(test_arm_quaternion2rotation_f32),
ztest_unit_test(test_arm_rotation2quaternion_f32)
);
ztest_run_test_suite(quaternionmath_f32);
}
ZTEST_SUITE(quaternionmath_f32, NULL, NULL, NULL, NULL, NULL);

View file

@ -1,15 +0,0 @@
/*
* Copyright (c) 2021 Stephanos Ioannidis <root@stephanos.io>
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <ztest.h>
#include <zephyr/zephyr.h>
extern void test_quaternionmath_f32(void);
void test_main(void)
{
test_quaternionmath_f32();
}