Skip to content

Commit

Permalink
test force reward interval end fn (#32513)
Browse files Browse the repository at this point in the history
Co-authored-by: HaoranYi <[email protected]>
  • Loading branch information
HaoranYi and HaoranYi authored Jul 17, 2023
1 parent a2d9870 commit 5408872
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions runtime/src/bank/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12430,6 +12430,24 @@ fn test_rewards_point_calculation_empty() {
assert!(point_value.is_none());
}

#[test]
fn test_force_reward_interval_end() {
let (genesis_config, _mint_keypair) = create_genesis_config(1_000_000 * LAMPORTS_PER_SOL);
let mut bank = Bank::new_for_tests(&genesis_config);

let expected_num = 100;

let stake_rewards = (0..expected_num)
.map(|_| StakeReward::new_random())
.collect::<Vec<_>>();

bank.set_epoch_reward_status_active(vec![stake_rewards]);
assert!(bank.get_reward_interval() == RewardInterval::InsideInterval);

bank.force_reward_interval_end_for_tests();
assert!(bank.get_reward_interval() == RewardInterval::OutsideInterval);
}

#[test]
fn test_is_partitioned_reward_feature_enable() {
let (genesis_config, _mint_keypair) = create_genesis_config(1_000_000 * LAMPORTS_PER_SOL);
Expand Down

0 comments on commit 5408872

Please sign in to comment.