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

Move test svm to use new ztest API.

Signed-off-by: li biao <biao1x.li@intel.com>
This commit is contained in:
li biao 2022-07-18 09:50:55 +08:00 committed by Carles Cufí
parent cbcc21e418
commit ff6bf25632
5 changed files with 13 additions and 54 deletions

View file

@ -6,7 +6,6 @@ project(cmsis_dsp_svm)
target_sources(app PRIVATE
src/f32.c
src/main.c
)
target_sources_ifdef(CONFIG_CMSIS_DSP_FLOAT16 app PRIVATE

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_SVM=y

View file

@ -42,7 +42,7 @@
const float16_t gamma = \
params[svec_count + (vec_dims * svec_count) + 2]
static void test_arm_svm_linear_predict_f16(void)
ZTEST(svm_f16, test_arm_svm_linear_predict_f16)
{
DECLARE_COMMON_VARS(in_linear_dims, in_linear_param);
@ -81,7 +81,7 @@ static void test_arm_svm_linear_predict_f16(void)
free(output_buf);
}
static void test_arm_svm_polynomial_predict_f16(void)
ZTEST(svm_f16, test_arm_svm_polynomial_predict_f16)
{
DECLARE_COMMON_VARS(in_polynomial_dims, in_polynomial_param);
DECLARE_POLY_VARS();
@ -123,7 +123,7 @@ static void test_arm_svm_polynomial_predict_f16(void)
free(output_buf);
}
static void test_arm_svm_rbf_predict_f16(void)
ZTEST(svm_f16, test_arm_svm_rbf_predict_f16)
{
DECLARE_COMMON_VARS(in_rbf_dims, in_rbf_param);
DECLARE_RBF_VARS();
@ -164,7 +164,7 @@ static void test_arm_svm_rbf_predict_f16(void)
free(output_buf);
}
static void test_arm_svm_sigmoid_predict_f16(void)
ZTEST(svm_f16, test_arm_svm_sigmoid_predict_f16)
{
DECLARE_COMMON_VARS(in_sigmoid_dims, in_sigmoid_param);
DECLARE_SIGMOID_VARS();
@ -205,7 +205,7 @@ static void test_arm_svm_sigmoid_predict_f16(void)
free(output_buf);
}
static void test_arm_svm_oneclass_predict_f16(void)
ZTEST(svm_f16, test_arm_svm_oneclass_predict_f16)
{
DECLARE_COMMON_VARS(in_oneclass_dims, in_oneclass_param);
@ -244,15 +244,4 @@ static void test_arm_svm_oneclass_predict_f16(void)
free(output_buf);
}
void test_svm_f16(void)
{
ztest_test_suite(svm_f16,
ztest_unit_test(test_arm_svm_linear_predict_f16),
ztest_unit_test(test_arm_svm_polynomial_predict_f16),
ztest_unit_test(test_arm_svm_rbf_predict_f16),
ztest_unit_test(test_arm_svm_sigmoid_predict_f16),
ztest_unit_test(test_arm_svm_oneclass_predict_f16)
);
ztest_run_test_suite(svm_f16);
}
ZTEST_SUITE(svm_f16, NULL, NULL, NULL, NULL, NULL);

View file

@ -42,7 +42,7 @@
const float32_t gamma = \
params[svec_count + (vec_dims * svec_count) + 2]
static void test_arm_svm_linear_predict_f32(void)
ZTEST(svm_f32, test_arm_svm_linear_predict_f32)
{
DECLARE_COMMON_VARS(in_linear_dims, in_linear_param);
@ -81,7 +81,7 @@ static void test_arm_svm_linear_predict_f32(void)
free(output_buf);
}
static void test_arm_svm_polynomial_predict_f32(void)
ZTEST(svm_f32, test_arm_svm_polynomial_predict_f32)
{
DECLARE_COMMON_VARS(in_polynomial_dims, in_polynomial_param);
DECLARE_POLY_VARS();
@ -123,7 +123,7 @@ static void test_arm_svm_polynomial_predict_f32(void)
free(output_buf);
}
static void test_arm_svm_rbf_predict_f32(void)
ZTEST(svm_f32, test_arm_svm_rbf_predict_f32)
{
DECLARE_COMMON_VARS(in_rbf_dims, in_rbf_param);
DECLARE_RBF_VARS();
@ -164,7 +164,7 @@ static void test_arm_svm_rbf_predict_f32(void)
free(output_buf);
}
static void test_arm_svm_sigmoid_predict_f32(void)
ZTEST(svm_f32, test_arm_svm_sigmoid_predict_f32)
{
DECLARE_COMMON_VARS(in_sigmoid_dims, in_sigmoid_param);
DECLARE_SIGMOID_VARS();
@ -205,7 +205,7 @@ static void test_arm_svm_sigmoid_predict_f32(void)
free(output_buf);
}
static void test_arm_svm_oneclass_predict_f32(void)
ZTEST(svm_f32, test_arm_svm_oneclass_predict_f32)
{
DECLARE_COMMON_VARS(in_oneclass_dims, in_oneclass_param);
@ -244,15 +244,4 @@ static void test_arm_svm_oneclass_predict_f32(void)
free(output_buf);
}
void test_svm_f32(void)
{
ztest_test_suite(svm_f32,
ztest_unit_test(test_arm_svm_linear_predict_f32),
ztest_unit_test(test_arm_svm_polynomial_predict_f32),
ztest_unit_test(test_arm_svm_rbf_predict_f32),
ztest_unit_test(test_arm_svm_sigmoid_predict_f32),
ztest_unit_test(test_arm_svm_oneclass_predict_f32)
);
ztest_run_test_suite(svm_f32);
}
ZTEST_SUITE(svm_f32, NULL, NULL, NULL, NULL, NULL);

View file

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