Newer
Older
Error::<Test>::VoidPivot
);
assert_noop!(
Broker::do_interlace(region1, None, CoreMask::from_chunk(0, 20)),
Error::<Test>::CompletePivot
);
});
}
#[test]
fn assign_should_drop_invalid_region() {
TestExt::new().endow(1, 1000).execute_with(|| {
assert_ok!(Broker::do_start_sales(100, 1));
advance_to(2);
let mut region = Broker::do_purchase(1, u64::max_value()).unwrap();
advance_to(10);
assert_ok!(Broker::do_assign(region, Some(1), 1001, Provisional));
region.begin = 7;
System::assert_last_event(Event::RegionDropped { region_id: region, duration: 3 }.into());
});
}
#[test]
fn pool_should_drop_invalid_region() {
TestExt::new().endow(1, 1000).execute_with(|| {
assert_ok!(Broker::do_start_sales(100, 1));
advance_to(2);
let mut region = Broker::do_purchase(1, u64::max_value()).unwrap();
advance_to(10);
assert_ok!(Broker::do_pool(region, Some(1), 1001, Provisional));
region.begin = 7;
System::assert_last_event(Event::RegionDropped { region_id: region, duration: 3 }.into());
});
}
#[test]
fn config_works() {
TestExt::new().execute_with(|| {
let mut cfg = new_config();
// Good config works:
assert_ok!(Broker::configure(Root.into(), cfg.clone()));
// Bad config is a noop:
cfg.leadin_length = 0;
assert_noop!(Broker::configure(Root.into(), cfg), Error::<Test>::InvalidConfig);
});
}