Northeastern-Electric-Racing / Northeastern-Electric-Racing/Calypso

[Daedalus] - Unit Tests

Open
#96 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
2
Forks
2
Avg merge
6d 20h
Merged PRs (30d)
3

Description

Description

Right now, we just assume that the decoding and encoding functions generated by Daedalus work (which they do, as far as we know...)

It would be really nice to leave the hypothetical world and have some unit tests that validate this hypothesis

Acceptance Criteria

Set up a testing framework that is able to test the code generated by Daedalus by running cargo test

Optionally, something that uses trybuild (see below) to test that the macro expansion compiles properly (this is otherwise a very arcane process)

Proposed Solution

Set up a mod tests in libs/daedalus/, testing the sub-functions that the macro calls. If you look into the architecture of gen_decode_data! and gen_encode_data!, you'll see that it's broken up into granular sub-functions (that are defined in libs/calypso-cangen/. It would be more realistic to test that these work as expected, rather than expanding and re-expanding the macro for every test. Maybe one or two tests that expand the macros and test that things work as expected, but otherwise, it would be better for the planet to not do that.

Here are some resources that may help:

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the existing crates under libs/daedalus/ and libs/calypso-cangen/, then trace the gen_decode_data! and gen_encode_data! entry points and their granular sub-functions. Set up tests that run with cargo test and validate the relevant generated-code behavior; optionally add trybuild coverage for macro expansion. Done means the test suite exercises the encoding and decoding paths successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
testing-qa
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.