-
Notifications
You must be signed in to change notification settings - Fork 12
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
Move tests and associated data types into their own crate #10
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Codecov Report
@@ Coverage Diff @@
## romac/data-generic #10 +/- ##
======================================================
- Coverage 84.61% 77.37% -7.24%
======================================================
Files 16 17 +1
Lines 1150 782 -368
======================================================
- Hits 973 605 -368
Misses 177 177
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
romac
force-pushed
the
romac/data-generic
branch
from
October 24, 2023 07:28
4e36931
to
94c8651
Compare
romac
force-pushed
the
romac/test-crate
branch
from
October 24, 2023 07:32
8c3f8db
to
848817d
Compare
romac
force-pushed
the
romac/data-generic
branch
2 times, most recently
from
October 24, 2023 08:00
a9af4d9
to
1d0ec33
Compare
romac
force-pushed
the
romac/test-crate
branch
from
October 24, 2023 08:01
7a9a12f
to
d049fba
Compare
romac
force-pushed
the
romac/test-crate
branch
from
October 24, 2023 09:53
d049fba
to
a783847
Compare
Drop in coverage is likely because a bunch of code was moved to the test crate, ie. deleted from the main crates and added to the test crate. |
romac
added a commit
that referenced
this pull request
Oct 24, 2023
* Move tests and associated data types into their own crate * Add small threshold to codecov * Small cleanup * Move tests into `tests` folder * Adjust base when computing coverage in the presence of removed code See: https://docs.codecov.com/docs/commit-status#removed_code_behavior
romac
added a commit
that referenced
this pull request
Oct 25, 2023
Closes: #11 This gist of this PR is that it adds a `Consensus` trait which defines the various datatypes that the consensus engine operates over, as well as a trait per such datatype that defines the requirement for said datatype. ```rust pub trait Consensus where Self: Sized, { type Address: Address; type Height: Height; type Proposal: Proposal<Self>; type PublicKey: PublicKey; type Validator: Validator<Self>; type ValidatorSet: ValidatorSet<Self>; type Value: Value; type Vote: Vote<Self>; ``` ```rust pub trait Height where Self: Clone + Debug + PartialEq + Eq + PartialOrd + Ord, { } ``` etc. In test code, we define our own simple versions of these datatypes as well as a `TestConsensus` struct, for which we implement the `Consensus` trait. ```rust #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pub struct Address(u64); impl Address { pub const fn new(value: u64) -> Self { Self(value) } } impl malachite_common::Address for Address {} ``` ```rust pub struct TestConsensus; impl Consensus for TestConsensus { type Address = Address; type Height = Height; type Proposal = Proposal; type PublicKey = PublicKey; type ValidatorSet = ValidatorSet; type Validator = Validator; type Value = Value; type Vote = Vote; } ``` --- * Attempt to abstract over the various data types needed by the consensus engine * Fix tests * Fix lints names * Move tests and associated data types into their own crate (#10) * Move tests and associated data types into their own crate * Add small threshold to codecov * Small cleanup * Move tests into `tests` folder * Adjust base when computing coverage in the presence of removed code See: https://docs.codecov.com/docs/commit-status#removed_code_behavior * Document the `Round` type and rename `Round::None` to `Round::Nil` * More doc comments * Remove `PublicKey::hash` requirement * Few more comments * Add propose+precommit timeout test
romac
added a commit
that referenced
this pull request
Nov 8, 2023
Closes: #11 This gist of this PR is that it adds a `Consensus` trait which defines the various datatypes that the consensus engine operates over, as well as a trait per such datatype that defines the requirement for said datatype. ```rust pub trait Consensus where Self: Sized, { type Address: Address; type Height: Height; type Proposal: Proposal<Self>; type PublicKey: PublicKey; type Validator: Validator<Self>; type ValidatorSet: ValidatorSet<Self>; type Value: Value; type Vote: Vote<Self>; ``` ```rust pub trait Height where Self: Clone + Debug + PartialEq + Eq + PartialOrd + Ord, { } ``` etc. In test code, we define our own simple versions of these datatypes as well as a `TestConsensus` struct, for which we implement the `Consensus` trait. ```rust #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord)] pub struct Address(u64); impl Address { pub const fn new(value: u64) -> Self { Self(value) } } impl malachite_common::Address for Address {} ``` ```rust pub struct TestConsensus; impl Consensus for TestConsensus { type Address = Address; type Height = Height; type Proposal = Proposal; type PublicKey = PublicKey; type ValidatorSet = ValidatorSet; type Validator = Validator; type Value = Value; type Vote = Vote; } ``` --- * Attempt to abstract over the various data types needed by the consensus engine * Fix tests * Fix lints names * Move tests and associated data types into their own crate (#10) * Move tests and associated data types into their own crate * Add small threshold to codecov * Small cleanup * Move tests into `tests` folder * Adjust base when computing coverage in the presence of removed code See: https://docs.codecov.com/docs/commit-status#removed_code_behavior * Document the `Round` type and rename `Round::None` to `Round::Nil` * More doc comments * Remove `PublicKey::hash` requirement * Few more comments * Add propose+precommit timeout test
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Doing this ensure that we publicly export all the necessary definitions from the main crates to test them exhaustively, so that when we move to MBT we'll be in a good shape and won't have to rework the codebase.