Skip to content

Commit

Permalink
tests: kconfig: functions: Fix arithmetic typo
Browse files Browse the repository at this point in the history
Moved the test to a single main file, fixed a typo
arithmetric -> arithmetic

Signed-off-by: Pieter De Gendt <[email protected]>
  • Loading branch information
pdgendt authored and carlescufi committed Aug 2, 2024
1 parent bc4442e commit 1e6f39e
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 60 deletions.
44 changes: 22 additions & 22 deletions tests/kconfig/functions/Kconfig
Original file line number Diff line number Diff line change
@@ -1,91 +1,91 @@
# SPDX-License-Identifier: Apache-2.0
# Copyright (c) 2022 CSIRO

config KCONFIG_ARITHMETRIC_ADD_10
config KCONFIG_ARITHMETIC_ADD_10
int
default $(add, 10)

config KCONFIG_ARITHMETRIC_ADD_10_3
config KCONFIG_ARITHMETIC_ADD_10_3
int
default $(add, 10, 3)

config KCONFIG_ARITHMETRIC_ADD_10_3_2
config KCONFIG_ARITHMETIC_ADD_10_3_2
int
default $(add, 10, 3, 2)

config KCONFIG_ARITHMETRIC_SUB_10
config KCONFIG_ARITHMETIC_SUB_10
int
default $(sub, 10)

config KCONFIG_ARITHMETRIC_SUB_10_3
config KCONFIG_ARITHMETIC_SUB_10_3
int
default $(sub, 10, 3)

config KCONFIG_ARITHMETRIC_SUB_10_3_2
config KCONFIG_ARITHMETIC_SUB_10_3_2
int
default $(sub, 10, 3, 2)

config KCONFIG_ARITHMETRIC_MUL_10
config KCONFIG_ARITHMETIC_MUL_10
int
default $(mul, 10)

config KCONFIG_ARITHMETRIC_MUL_10_3
config KCONFIG_ARITHMETIC_MUL_10_3
int
default $(mul, 10, 3)

config KCONFIG_ARITHMETRIC_MUL_10_3_2
config KCONFIG_ARITHMETIC_MUL_10_3_2
int
default $(mul, 10, 3, 2)

config KCONFIG_ARITHMETRIC_DIV_10
config KCONFIG_ARITHMETIC_DIV_10
int
default $(div, 10)

config KCONFIG_ARITHMETRIC_DIV_10_3
config KCONFIG_ARITHMETIC_DIV_10_3
int
default $(div, 10, 3)

config KCONFIG_ARITHMETRIC_DIV_10_3_2
config KCONFIG_ARITHMETIC_DIV_10_3_2
int
default $(div, 10, 3, 2)

config KCONFIG_ARITHMETRIC_MOD_10
config KCONFIG_ARITHMETIC_MOD_10
int
default $(mod, 10)

config KCONFIG_ARITHMETRIC_MOD_10_3
config KCONFIG_ARITHMETIC_MOD_10_3
int
default $(mod, 10, 3)

config KCONFIG_ARITHMETRIC_MOD_10_3_2
config KCONFIG_ARITHMETIC_MOD_10_3_2
int
default $(mod, 10, 3, 2)

config KCONFIG_ARITHMETRIC_INC_1
config KCONFIG_ARITHMETIC_INC_1
int
default $(inc, 1)

config KCONFIG_ARITHMETRIC_INC_1_1
config KCONFIG_ARITHMETIC_INC_1_1
string
default "$(inc, 1, 1)"

config KCONFIG_ARITHMETRIC_INC_INC_1_1
config KCONFIG_ARITHMETIC_INC_INC_1_1
string
default "$(inc, $(inc, 1, 1))"

config KCONFIG_ARITHMETRIC_DEC_1
config KCONFIG_ARITHMETIC_DEC_1
int
default $(dec, 1)

config KCONFIG_ARITHMETRIC_DEC_1_1
config KCONFIG_ARITHMETIC_DEC_1_1
string
default "$(dec, 1, 1)"

config KCONFIG_ARITHMETRIC_DEC_DEC_1_1
config KCONFIG_ARITHMETIC_DEC_DEC_1_1
string
default "$(dec, $(dec, 1, 1))"

config KCONFIG_ARITHMETRIC_ADD_INC_1_1
config KCONFIG_ARITHMETIC_ADD_INC_1_1
int
default $(add, $(inc, 1, 1))

Expand Down
38 changes: 0 additions & 38 deletions tests/kconfig/functions/src/arithmetric.c

This file was deleted.

38 changes: 38 additions & 0 deletions tests/kconfig/functions/src/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
/*
* Copyright (c) 2024 TOKITA Hiroshi
*
* SPDX-License-Identifier: Apache-2.0
*/

#include <string.h>
#include <zephyr/kernel.h>
#include <zephyr/sys/__assert.h>
#include <zephyr/ztest.h>

ZTEST(test_kconfig_functions, test_arithmetic)
{
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_ADD_10, 10);
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_ADD_10_3, 10 + 3);
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_ADD_10_3_2, 10 + 3 + 2);
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_SUB_10, 10);
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_SUB_10_3, 10 - 3);
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_SUB_10_3_2, 10 - 3 - 2);
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_MUL_10, 10);
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_MUL_10_3, 10 * 3);
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_MUL_10_3_2, 10 * 3 * 2);
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_DIV_10, 10);
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_DIV_10_3, 10 / 3);
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_DIV_10_3_2, 10 / 3 / 2);
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_MOD_10, 10);
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_MOD_10_3, 10 % 3);
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_MOD_10_3_2, 10 % 3 % 2);
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_INC_1, 1 + 1);
zassert_str_equal(CONFIG_KCONFIG_ARITHMETIC_INC_1_1, "2,2");
zassert_str_equal(CONFIG_KCONFIG_ARITHMETIC_INC_INC_1_1, "3,3");
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_DEC_1, 1 - 1);
zassert_str_equal(CONFIG_KCONFIG_ARITHMETIC_DEC_1_1, "0,0");
zassert_str_equal(CONFIG_KCONFIG_ARITHMETIC_DEC_DEC_1_1, "-1,-1");
zassert_equal(CONFIG_KCONFIG_ARITHMETIC_ADD_INC_1_1, (1 + 1) + (1 + 1));
}

ZTEST_SUITE(test_kconfig_functions, NULL, NULL, NULL, NULL, NULL);

0 comments on commit 1e6f39e

Please sign in to comment.