Rename arb_nonnegative_note_value -> arb_note_value_bounded

This commit is contained in:
Kris Nuttycombe 2021-05-05 17:23:21 -06:00
parent 3170096134
commit 71736433d0
2 changed files with 8 additions and 8 deletions

View File

@ -375,7 +375,7 @@ pub mod testing {
Signature, Signature,
}, },
value::{ value::{
testing::arb_nonnegative_note_value, NoteValue, ValueCommitTrapdoor, ValueCommitment, testing::arb_note_value_bounded, NoteValue, ValueCommitTrapdoor, ValueCommitment,
ValueSum, MAX_NOTE_VALUE, ValueSum, MAX_NOTE_VALUE,
}, },
Anchor, Anchor,
@ -425,9 +425,9 @@ pub mod testing {
n_actions: usize, n_actions: usize,
flags: Flags, flags: Flags,
) -> impl Strategy<Value = (ValueSum, Action<()>)> { ) -> impl Strategy<Value = (ValueSum, Action<()>)> {
arb_nonnegative_note_value(MAX_NOTE_VALUE / n_actions as u64).prop_flat_map( arb_note_value_bounded(MAX_NOTE_VALUE / n_actions as u64).prop_flat_map(
move |spend_value| { move |spend_value| {
arb_nonnegative_note_value(MAX_NOTE_VALUE / n_actions as u64).prop_flat_map( arb_note_value_bounded(MAX_NOTE_VALUE / n_actions as u64).prop_flat_map(
move |output_value| { move |output_value| {
let spend_value = if flags.spends_enabled { let spend_value = if flags.spends_enabled {
spend_value spend_value
@ -487,9 +487,9 @@ pub mod testing {
n_actions: usize, n_actions: usize,
flags: Flags, flags: Flags,
) -> impl Strategy<Value = (ValueSum, Action<Signature<SpendAuth>>)> { ) -> impl Strategy<Value = (ValueSum, Action<Signature<SpendAuth>>)> {
arb_nonnegative_note_value(MAX_NOTE_VALUE / n_actions as u64).prop_flat_map( arb_note_value_bounded(MAX_NOTE_VALUE / n_actions as u64).prop_flat_map(
move |spend_value| { move |spend_value| {
arb_nonnegative_note_value(MAX_NOTE_VALUE / n_actions as u64).prop_flat_map( arb_note_value_bounded(MAX_NOTE_VALUE / n_actions as u64).prop_flat_map(
move |output_value| { move |output_value| {
let spend_value = if flags.spends_enabled { let spend_value = if flags.spends_enabled {
spend_value spend_value

View File

@ -301,7 +301,7 @@ pub mod testing {
prop_compose! { prop_compose! {
/// Generate an arbitrary value in the range of valid positive Zcash amounts /// Generate an arbitrary value in the range of valid positive Zcash amounts
/// less than a specified value. /// less than a specified value.
pub fn arb_nonnegative_note_value(max: u64)(value in 0u64..max) -> NoteValue { pub fn arb_note_value_bounded(max: u64)(value in 0u64..max) -> NoteValue {
NoteValue(value) NoteValue(value)
} }
} }
@ -320,7 +320,7 @@ mod tests {
use proptest::prelude::*; use proptest::prelude::*;
use super::{ use super::{
testing::{arb_nonnegative_note_value, arb_trapdoor, arb_value_sum_bounded}, testing::{arb_note_value_bounded, arb_trapdoor, arb_value_sum_bounded},
OverflowError, ValueCommitTrapdoor, ValueCommitment, ValueSum, MAX_NOTE_VALUE, OverflowError, ValueCommitTrapdoor, ValueCommitment, ValueSum, MAX_NOTE_VALUE,
}; };
use crate::primitives::redpallas; use crate::primitives::redpallas;
@ -329,7 +329,7 @@ mod tests {
#[test] #[test]
fn bsk_consistent_with_bvk( fn bsk_consistent_with_bvk(
values in (1usize..10).prop_flat_map(|n_values| values in (1usize..10).prop_flat_map(|n_values|
arb_nonnegative_note_value(MAX_NOTE_VALUE / n_values as u64).prop_flat_map(move |bound| arb_note_value_bounded(MAX_NOTE_VALUE / n_values as u64).prop_flat_map(move |bound|
prop::collection::vec((arb_value_sum_bounded(bound), arb_trapdoor()), n_values) prop::collection::vec((arb_value_sum_bounded(bound), arb_trapdoor()), n_values)
) )
) )