Skip to content

Commit

Permalink
Merge pull request #108 from bastion-rs/redundancy-boundaries
Browse files Browse the repository at this point in the history
Fixed children redundancy tests
  • Loading branch information
r3v2d0g authored Dec 2, 2019
2 parents ca376bf + c141bab commit e6aa8ed
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
7 changes: 6 additions & 1 deletion bastion/src/children.rs
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,12 @@ impl Children {
self.id(),
redundancy
);
self.redundancy = redundancy;
if redundancy == std::usize::MIN {
self.redundancy = redundancy.saturating_add(1);
} else {
self.redundancy = redundancy;
}

self
}

Expand Down
1 change: 0 additions & 1 deletion bastion/tests/prop_children_broadcast.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use bastion::prelude::*;
use proptest::prelude::*;

use std::sync::Once;

static START: Once = Once::new();
Expand Down
11 changes: 10 additions & 1 deletion bastion/tests/prop_children_redundancy.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,18 @@
use bastion::prelude::*;
use proptest::prelude::*;
use std::sync::Once;

static START: Once = Once::new();

proptest! {
#![proptest_config(ProptestConfig::with_cases(1_000))]
#[test]
fn proptest_redundancy(r in std::usize::MIN..std::usize::MAX) {
fn proptest_redundancy(r in std::usize::MIN..32) {
START.call_once(|| {
Bastion::init();
});
Bastion::start();

Bastion::children(|children| {
children
// shrink over the redundancy
Expand Down

0 comments on commit e6aa8ed

Please sign in to comment.