Skip to content
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

Implement tests #31

Open
9 tasks
Git-Math opened this issue Mar 1, 2023 · 2 comments
Open
9 tasks

Implement tests #31

Git-Math opened this issue Mar 1, 2023 · 2 comments
Assignees

Comments

@Git-Math
Copy link
Owner

Git-Math commented Mar 1, 2023

Implement tests:

  • Universe.step()
  • Configuration.step()
  • Universe.solve_interference()
  • Universe.measure()
  • get_cell_coordinates()
  • Implement a function to check the validity of a rule "matrix"
  • Maybe add tests to compute_rules()
  • Maybe add tests to square_state_to_index()
  • Maybe add tests to index_to_square_state()
@elhmn
Copy link
Collaborator

elhmn commented Apr 9, 2023

I tried to implement the tests but it quickly became a pain as every time I tried ran the test script, the application was entirely recompiled. The compilation took a while because of nannou dependencies that needed to be rebuild every time.

In #41 the project was splitted in workspaces. This will allow us to implement
tests exclusively for the core crate which does not have nannou as a dependency. The dev feedback loop should be smaller and writing tests will be more enjoyable.

@elhmn
Copy link
Collaborator

elhmn commented Apr 9, 2023

We have also decided to use the state_2_diagonal_cells.json file as the main test fixture.
This file will help us create test scenarios and snapshots that can be used to write every tests.

We will also be tracking the test coverage using the tools provided by the cargo llvm profiler and grcov.

You might need to install llvm-tools

rustup component add llvm-tools-preview

Generate coverage files

RUSTFLAGS='-Cinstrument-coverage' LLVM_PROFILE_FILE='cargo-test-%m.profraw' cargo test

Generate html page to visualise the coverage using grcov

grcov . --binary-path ./target/debug/deps/ -s . -t html --branch --ignore-not-existing --ignore '../*' --ignore "/*" -o target/coverage

Visualize the coverage

open ./target/coverage/html/index.html

This should open a nice web page with a nice test coverage report

@elhmn elhmn self-assigned this Apr 9, 2023
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

No branches or pull requests

2 participants