Skip to content

libc math test minor changes #403

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

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

libc math test minor changes #403

wants to merge 3 commits into from

Conversation

adamdebek
Copy link
Contributor

@adamdebek adamdebek commented Jul 22, 2025

Description

Motivation and Context

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Chore (refactoring, style fixes, git/CI config, submodule management, no code logic changes)

How Has This Been Tested?

  • Already covered by automatic testing.
  • New test added: (add PR link here).
  • Tested by hand on: (list targets here).

Checklist:

  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.
  • All new and existing linter checks and tests passed.
  • My changes generate no new compilation warnings for any of the targets.

Special treatment

Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Summary of Changes

Hello @adamdebek, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request focuses on a significant refactoring and enhancement of the libc/math test suite. The changes aim to improve the clarity, consistency, and robustness of existing tests by introducing specialized assertion macros for floating-point comparisons, standardizing test naming conventions, and enabling more comprehensive checks for edge cases and error conditions. It also includes minor refactorings of test utility functions.

Highlights

  • Test Infrastructure Improvement: Introduced new, more precise assertion macros (TEST_ASSERT_DOUBLE_IS_ZERO, TEST_ASSERT_DOUBLE_IS_NEG_ZERO, TEST_ASSERT_DOUBLE_IS_INF, TEST_ASSERT_DOUBLE_IS_NEG_INF) for double-precision floating-point comparisons in test cases, defined in libc/math/common.h.
  • Test Suite Refactoring: Standardized test case naming conventions by renaming numerous tests from *_special_cond to *_special_val across libc/math/abs.c, libc/math/exp.c, libc/math/frac.c, libc/math/pow.c, and libc/math/trig.c for improved clarity and consistency.
  • Enhanced Test Coverage: Enabled and corrected previously commented-out test cases, particularly for special floating-point values (NaN, Infinity, Zero) and error handling (errno), significantly improving test coverage for various mathematical functions including fabs, exp, frexp, ldexp, log, log2, log10, modf, fmod, ceil, floor, sqrt, pow, sin, cos, tan, asin, acos, atan, atan2, sinh, cosh, and tanh.
  • Test Utility Refinement: Refactored the test_checkResult function logic in libc/math/common.c and updated parameter types in test_check_digLost and test_check_digLost2 from double to int for better type accuracy and test utility.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point in your pull request via creating an issue comment (i.e. comment on the pull request page) using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in issue comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments or fill out our survey to provide feedback.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

@adamdebek adamdebek changed the title Adamdebek/ci 565 libc math test minor changes Jul 22, 2025
Copy link

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request significantly improves the math library's test suite by refactoring test cases for better clarity, enabling a large number of previously disabled tests for special floating-point values, and introducing more specific assertion macros. These are all great changes that enhance test quality. I've identified a few minor issues, including a potential bug in an error calculation function, some opportunities to improve test coverage and correctness, and a couple of instances of duplicated test code. My detailed comments are provided to help address these points.

Armv8m33-mcxn94x-frdm required a little bit lower precision what is acceptable.
I added also minor variable type changes and typo fix.

JIRA: CI-565
Copy link

github-actions bot commented Jul 22, 2025

Unit Test Results

8 201 tests  ±0   7 573 ✅  - 104   41m 59s ⏱️ +34s
  479 suites ±0     524 💤 ±  0 
    1 files   ±0     104 ❌ +104 

For more details on these failures, see this check.

Results for commit a20bc11. ± Comparison against base commit 2a9738b.

This pull request removes 207 and adds 207 tests. Note that renamed tests count towards both.
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_abs.fabs_special_cond
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_exp.exp_special_cond
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_exp.frexp_special_cond
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_exp.ldexp_special_cond
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_exp.log10_special_cond
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_exp.log2_special_cond
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_exp.log_special_cond
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_frac.ceil_special_cond
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_frac.floor_special_cond
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_frac.fmod_special_cond
…
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_abs.fabs_special_val
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_exp.exp_special_val
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_exp.frexp_special_val
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_exp.ldexp_special_val
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_exp.log10_special_val
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_exp.log2_special_val
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_exp.log_special_val
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_frac.ceil_special_val
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_frac.floor_special_val
phoenix-rtos-tests/libc/math ‑ armv7a7-imx6ull-evk:phoenix-rtos-tests/libc/math.math_frac.fmod_special_val
…

♻️ This comment has been updated with latest results.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant