-
Notifications
You must be signed in to change notification settings - Fork 349
test: ztest: Add math basic trigonometry unit tests converted from CMock #10233
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
test: ztest: Add math basic trigonometry unit tests converted from CMock #10233
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR converts 9 existing math trigonometry unit tests from CMock/Unity to Zephyr's Ztest framework, maintaining the same test coverage and functionality while establishing the foundation for math/basic/trigonometry tests in the new SOF Ztest directory structure.
- Conversion of trigonometric function tests (sin, cos, asin, acos) for both 16-bit and 32-bit fixed-point implementations
- Addition of sine lookup table test for 16-bit fixed-point
- Preservation of original reference tables and tolerance values to maintain identical test accuracy
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| test/ztest/unit/math/basic/trigonometry/trig_test.c | Main test file with 9 converted trigonometry tests using Ztest framework |
| test/ztest/unit/math/basic/trigonometry/trig_tables.h | Reference data tables and tolerance constants for trigonometry tests |
| test/ztest/unit/math/basic/trigonometry/testcase.yaml | Test configuration file defining test metadata and platform requirements |
| test/ztest/unit/math/basic/trigonometry/prj.conf | Zephyr project configuration enabling Ztest framework |
| test/ztest/unit/math/basic/trigonometry/CMakeLists.txt | CMake build configuration linking SOF math libraries and test sources |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
f216226 to
40b6a9d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Copilot reviewed 5 out of 5 changed files in this pull request and generated 12 comments.
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
448fabb to
385485a
Compare
This patch converts 9 existing math trigonometry unit tests from CMock/Unity to Zephyr's Ztest framework, maintaining the same test coverage and functionality: - test_sin_32b_fixed: 32-bit fixed-point sine function - test_sin_16b_fixed: 16-bit fixed-point sine function - test_cos_32b_fixed: 32-bit fixed-point cosine function - test_cos_16b_fixed: 16-bit fixed-point cosine function - test_asin_32b_fixed: 32-bit fixed-point arcsine function - test_asin_16b_fixed: 16-bit fixed-point arcsine function - test_acos_32b_fixed: 32-bit fixed-point arccosine function - test_acos_16b_fixed: 16-bit fixed-point arccosine function - test_sin_lut_16b_fixed: 16-bit sine lookup table function Original tests converted from sof/test/cmocka/src/math/trig/ authored by: - Slawomir Blauciak <slawomir.blauciak@linux.intel.com> - Shriram Shastry <malladi.sastry@linux.intel.com> - Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com> The converted tests validate the same trigonometric functions from src/math/trig.c and src/math/lut_trig.c as the original CMock tests, 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. This is part of the broader SOF unit test migration from CMock to Zephyr Ztest framework, establishing the foundation for math/basic/trigonometry tests in the new directory structure. Signed-off-by: Tomasz Leman <tomasz.m.leman@intel.com>
lgirdwood
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but also needs @singalsu to approve.
softwarecki
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice cleanup! Migrating these tests to Ztest keeps coverage intact and moves us closer to a unified testing framework.
This patch converts 9 existing math trigonometry unit tests from CMock/Unity to Zephyr's Ztest framework, maintaining the same test coverage and functionality:
Original tests converted from sof/test/cmocka/src/math/trig/ authored by:
The converted tests validate the same trigonometric functions from src/math/trig.c and src/math/lut_trig.c as the original CMock tests, 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.
This is part of the broader SOF unit test migration from CMock to Zephyr Ztest framework, establishing the foundation for math/basic/trigonometry tests in the new directory structure.