Commit 1c56e1a
test: ztest: Add base-2 logarithm unit test converted from CMock
This patch converts 1 existing math advanced function unit test from
CMock/Unity to Zephyr's Ztest framework, maintaining the same test
coverage and functionality:
- test_math_arithmetic_base2log_fixed: Fixed-point base-2 logarithm
Original test converted from
sof/test/cmocka/src/math/arithmetic/base2_logarithm.c authored by:
- Shriram Shastry <malladi.sastry@linux.intel.com>
The converted test validates the same base2_logarithm() function from
src/math/base2log.c as the original CMock test, ensuring no regression
in test coverage during the migration to Ztest framework. Reference
tables and tolerance values are preserved to maintain identical test
accuracy and validation criteria.
Test validates 100 uniformly distributed input values across the full
uint32_t range using MATLAB-generated reference data with fixed-point
arithmetic:
- Input values: Q32.0 format (unsigned 32-bit integers)
- Results: Q16.16 format
- Reference: MATLAB log2() function results
- Tolerance: max error 0.0000236785999981, THD -92.5128795787487235
This continues the SOF unit test migration from CMock to Zephyr Ztest
framework as part of the math/advanced/functions test suite.
Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>1 parent 2bad4ec commit 1c56e1a
3 files changed
Lines changed: 79 additions & 1 deletion
File tree
- test/ztest/unit/math/advanced/functions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
Lines changed: 76 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
10 | 10 | | |
11 | 11 | | |
12 | 12 | | |
13 | | - | |
| 13 | + | |
14 | 14 | | |
15 | 15 | | |
16 | 16 | | |
| |||
0 commit comments