-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Use test_strategy over proptest macro in replicated state t…
…ests (#3462)
- Loading branch information
Showing
6 changed files
with
393 additions
and
339 deletions.
There are no files selected for viewing
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,21 @@ | ||
use ic_protobuf::state::{queues::v1 as pb_queues, system_metadata::v1 as pb_metadata}; | ||
use ic_replicated_state::{metadata_state::SubnetMetrics, Stream}; | ||
use ic_test_utilities_state::{arb_stream, arb_subnet_metrics}; | ||
use proptest::prelude::*; | ||
use std::convert::TryInto; | ||
|
||
proptest! { | ||
#[test] | ||
fn roundtrip_conversion_stream_proptest(stream in arb_stream(0, 10, 0, 100)) { | ||
assert_eq!( | ||
stream, | ||
pb_queues::Stream::from(&stream) | ||
.try_into() | ||
.unwrap() | ||
); | ||
} | ||
#[test_strategy::proptest] | ||
fn roundtrip_conversion_stream_proptest(#[strategy(arb_stream(0, 10, 0, 100))] stream: Stream) { | ||
assert_eq!(stream, pb_queues::Stream::from(&stream).try_into().unwrap()); | ||
} | ||
|
||
#[test] | ||
fn roundtrip_conversion_subnet_metrics(subnet_metrics in arb_subnet_metrics()) { | ||
assert_eq!( | ||
subnet_metrics, | ||
pb_metadata::SubnetMetrics::from(&subnet_metrics) | ||
.try_into() | ||
.unwrap() | ||
); | ||
} | ||
#[test_strategy::proptest] | ||
fn roundtrip_conversion_subnet_metrics( | ||
#[strategy(arb_subnet_metrics())] subnet_metrics: SubnetMetrics, | ||
) { | ||
assert_eq!( | ||
subnet_metrics, | ||
pb_metadata::SubnetMetrics::from(&subnet_metrics) | ||
.try_into() | ||
.unwrap() | ||
); | ||
} |
Oops, something went wrong.