-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement scanner format round-trip tests
- Loading branch information
Showing
6 changed files
with
56 additions
and
4 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
3 changes: 3 additions & 0 deletions
3
zebra-state/src/service/finalized_state/disk_format/scan/tests.rs
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 |
---|---|---|
@@ -0,0 +1,3 @@ | ||
//! Tests for scanner database serialization. | ||
mod prop; |
36 changes: 36 additions & 0 deletions
36
zebra-state/src/service/finalized_state/disk_format/scan/tests/prop.rs
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 |
---|---|---|
@@ -0,0 +1,36 @@ | ||
//! Randomised proptests for scanner database formats. | ||
use proptest::{arbitrary::any, prelude::*}; | ||
|
||
use crate::{ | ||
service::finalized_state::arbitrary::assert_value_properties, SaplingScannedDatabaseIndex, | ||
SaplingScannedResult, SaplingScanningKey, | ||
}; | ||
|
||
#[test] | ||
fn roundtrip_sapling_scanning_key() { | ||
let _init_guard = zebra_test::init(); | ||
|
||
proptest!(|(val in any::<SaplingScanningKey>())| assert_value_properties(val)); | ||
} | ||
|
||
#[test] | ||
fn roundtrip_sapling_db_index() { | ||
let _init_guard = zebra_test::init(); | ||
|
||
proptest!(|(val in any::<SaplingScannedDatabaseIndex>())| assert_value_properties(val)); | ||
} | ||
|
||
#[test] | ||
fn roundtrip_sapling_result() { | ||
let _init_guard = zebra_test::init(); | ||
|
||
proptest!(|(val in any::<SaplingScannedResult>())| assert_value_properties(val)); | ||
} | ||
|
||
#[test] | ||
fn roundtrip_option_sapling_result() { | ||
let _init_guard = zebra_test::init(); | ||
|
||
proptest!(|(val in any::<Option<SaplingScannedResult>>())| assert_value_properties(val)); | ||
} |
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