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

Add examples, integration tests and docs for simulated device and rea… #87

Merged
merged 4 commits into from
Aug 6, 2024

Conversation

radumarias
Copy link
Contributor

@radumarias radumarias commented Aug 2, 2024

Add tests and docs for simulated device and reader interaction.

Integration tests:

  • add simulated device and reader interaction
  • also for simulated device and reader interaction, add a more structured one using state pattern, Mutex and Arc

Docs:

  • add diagram for simulated device and reader interaction
  • add diagrams for simulated device perspective and simulated reader perspective
  • add diagrams in readme and links to examples
  • add ASCII diagrams in lib.rs and include examples from device and reader's perspective
  • fix some docs

Code:

  • add allow invisible_characters for clippy in a file

CI:

  • upgrade actions/checkout
  • add --all-targets to build so that it builds tests too (to make sure they don't fall behind)
  • add --all-targets to clippy so that it runs on tests too (it will run o tests too but I assume it's fine)
    • don't explicitly run in in macros because --all-targets takes care of that
  • add --all to fmt --check so that it runs on examples too
    • don't explicitly run in in macros because --all takes care of that

…der interaction (#1)

Integration tests and docs for simulated device and reader interaction

**Integration tests:**
- add simulated device and reader interaction
- also for simulated device and reader interaction, add a more structured one using `state pattern`, `Mutex` and `Arc`
- one test from the holder's POV with a simulated reader, and vice-versa for another test

**Docs:**
- add example from the holder's POV with a simulated reader, and vice-versa for another example
- add diagram for simulated device and reader interaction
- add diagrams for simulated device perspective and simulated reader perspective
- add diagrams in readme and links to examples
- add ASCII diagrams in `lib.rs` and include examples from device and reader's perspective
- fix some docs

**Code:**
- add `allow invisible_characters` for clippy in a file

**CI:**
- upgrade `actions/checkout`
- add `--all-targets` to build so that it builds tests too (to make sure they don't fall behind)
- add `--all-targets` to `clippy` so that it runs on tests too (it will run o tests too but I assume it's fine)
    - don't explicitly run in in `macros` because `--all-targets` takes care of that
- add `--all` to `fmt --check` so that it runs on examples too
    - don't explicitly run in in `macros` because `--all` takes care of that
@radumarias radumarias requested a review from cobward August 2, 2024 20:35
Copy link
Contributor

@cobward cobward left a comment

Choose a reason for hiding this comment

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

I don't see the value of these four separate files in the tests directory. They are using the same code, sometimes imported from common.rs, sometimes duplicated in the file. Possibly it could be made clearer if you created Device and Reader structs, where each of these functions was a method of the corresponding struct, but I also think just having a single well-documented file would be clearer.

tests/simulated_device_and_reader.rs Outdated Show resolved Hide resolved
tests/simulated_device_and_reader.rs Outdated Show resolved Hide resolved
tests/on_simulated_reader.rs Outdated Show resolved Hide resolved
tests/on_simulated_reader.rs Outdated Show resolved Hide resolved
@radumarias radumarias requested a review from cobward August 5, 2024 14:38
@radumarias
Copy link
Contributor Author

@cobward did the changes.

…se common code. (#3)

Removed some of the integration tests and refactor remaining ones to use common code.
# Conflicts:
#	src/lib.rs
#	tests/README.md
#	tests/common.rs
#	tests/simulated_device_and_reader.rs
#	tests/simulated_device_and_reader_state.rs
@cobward cobward merged commit 9d99da6 into spruceid:main Aug 6, 2024
1 check passed
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