Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 22, 2025

Description

Adds ZTest-based unit testing for core library modules with CI integration. Provides foundation and examples for testing f_core components.

Changes

Test Suites:

  • app/tests/f_core/gnss_utils/ - Tests GNSS conversion utilities (nanodegrees↔degrees, millimeters↔meters)
  • app/tests/f_core/golay/ - Tests Golay (23,12,7) error correction encoding/decoding with 1-3 bit error correction

CI Integration:

  • Updated .github/hardware-roots.yaml to trigger tests on relevant file changes
  • Tests discovered via testcase.yaml and run through west twister

Documentation:

  • app/tests/f_core/README.md - Test authoring guide with examples, structure requirements, and ZTest assertion reference

Each test suite includes standard Zephyr test files: main.c, CMakeLists.txt, prj.conf, testcase.yaml, Kconfig

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Tests will be validated by CI on push. Structure follows existing app/tests/utils/ pattern.

Test Configuration:

  • ZTest framework via Zephyr unittest component
  • Tests run on native_sim and hardware platforms via Twister

Checklist:

  • New functionality is documented in the necessary spots (i.e new functions documented in the header)
  • Unit tests cover any new functionality or edge cases that the PR was meant to resolve (if applicable)
  • The CI checks are passing
  • I reviewed my own code in the GitHub diff and am sure that each change is intentional
  • I feel comfortable about this code flying in a rocket
Original prompt

This section details on the original issue you should resolve

<issue_title>Setup GTest</issue_title>
<issue_description>Is your feature request related to a problem? Please describe.
We should unit test our core library code to ensure additions to software are intended

Describe the solution you'd like
Setup basic unit tests using ZTest to set as an example for future libraries. Have the CI run these unit tests too

Additional context
Add any other context or screenshots about the feature request here.
</issue_description>

<agent_instructions>We need unit tests for our core libraries found in include/f_core and lib/f_core. Since they all pretty much depend on Zephyr, you may use ZTest. See Zephyr's documentation for it here
https://docs.zephyrproject.org/latest/develop/test/ztest.html

</agent_instructions>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 5 commits December 22, 2025 01:40
Co-authored-by: AarC10 <30483634+AarC10@users.noreply.github.com>
Co-authored-by: AarC10 <30483634+AarC10@users.noreply.github.com>
Co-authored-by: AarC10 <30483634+AarC10@users.noreply.github.com>
Co-authored-by: AarC10 <30483634+AarC10@users.noreply.github.com>
Co-authored-by: AarC10 <30483634+AarC10@users.noreply.github.com>
Copilot AI changed the title [WIP] Setup unit tests using ZTest for core libraries Setup ZTest unit testing infrastructure for f_core libraries Dec 22, 2025
Copilot AI requested a review from AarC10 December 22, 2025 01:49
@AarC10 AarC10 marked this pull request as ready for review December 22, 2025 02:08
@AarC10 AarC10 requested a review from a team as a code owner December 22, 2025 02:08
@AarC10 AarC10 marked this pull request as draft December 22, 2025 02:08
Copy link
Contributor

@cowsed cowsed left a comment

Choose a reason for hiding this comment

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

image dear ai, your tests fail to build let alone actually run

@cowsed
Copy link
Contributor

cowsed commented Dec 22, 2025

Also, i dont think the golay encoding is something we even bother taking up space with testing. for one, we didnt write it and its been correct for like 20 years. and for two, even if it fails some test, if we change it, we will no longer be decoded by horus-gui since its the one they use.

@cowsed
Copy link
Contributor

cowsed commented Dec 22, 2025

also if this PR decides that tests/f_core holds tests for things in f_core can this PR also move the test that resides in utils/ into there as well

Though, idk if its necessary to segment them under tests/f_core bc realistically what could the tests/ folder be for since its not for applications. i imagine a sensor-mod specific test would live under the sensor-mod folder since it will share code with the app (if we wever get that far - rn none of the app folders are really set up to support anything more than building an executable but if we got to be cool)

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.

Setup GTest

3 participants