Skip to content

Feature/unit tests#41

Merged
GUVWAF merged 4 commits intomeshtastic:masterfrom
zandi:feature/unit-tests
Jan 30, 2026
Merged

Feature/unit tests#41
GUVWAF merged 4 commits intomeshtastic:masterfrom
zandi:feature/unit-tests

Conversation

@zandi
Copy link
Contributor

@zandi zandi commented Jan 24, 2026

Add initial basic unit tests. Now that there are unit tests, future PRs can add more tests to improve coverage, and include their own tests for new features/fixed bugs.

@GUVWAF GUVWAF self-requested a review January 25, 2026 20:38
Copy link
Member

@GUVWAF GUVWAF left a comment

Choose a reason for hiding this comment

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

Cool! We could eventually then also set up a CI, perhaps when we have a more full-blown test as well, that runs a real simulation.

Left one comment which we should address when #40 is merged.

zandi added 4 commits January 28, 2026 20:47
Just to get started, add sanity-check tests of our `calc_dist` euclidean
distance calculating function in lib/common.py

Use the `unittest` python module because it's built-in.
Make sure for the first node case we:
- return a node
- it is within bounds

For the second node case, additionally:
- it is NOT within conf.MINDIST of origin node
- it IS within radio range of origin node

The radio range computation in the test is identical to the function so this is
not ideal. Additionally, the found node is random each test run, so use
f-strings in the failure messages to aid in troubleshooting any test failures
which might happen.
@zandi zandi force-pushed the feature/unit-tests branch from 39985e2 to 8eb8629 Compare January 29, 2026 01:55
@GUVWAF GUVWAF merged commit eb52785 into meshtastic:master Jan 30, 2026
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.

2 participants

Comments