Skip to content

Commit

Permalink
Merge branch 'epoch_report_refactor' into feature/spl-beam-test-accounts
Browse files Browse the repository at this point in the history
  • Loading branch information
dankelleher committed Feb 29, 2024
2 parents 10e19c2 + 7a74040 commit d7aed90
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion programs/sunrise-core/src/state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -351,6 +351,14 @@ impl BeamEpochDetails {
mod internal_tests {
use super::*;

// Stub the Clock sysvar
struct SyscallStubs {}
impl solana_sdk::program_stubs::SyscallStubs for SyscallStubs {
fn sol_get_clock_sysvar(&self, _var_addr: *mut u8) -> u64 {
0
}
}

#[test]
fn test_register_beam() {
let mut state = State::default();
Expand Down Expand Up @@ -390,13 +398,17 @@ mod internal_tests {

assert_eq!(state.beam_count(), 2);
}

#[test]
fn test_add_beam() {
solana_sdk::program_stubs::set_syscall_stubs(Box::new(SyscallStubs {}));
let mut state = State::default();
let mut input = RegisterStateInput::default();

input.initial_capacity = 2;
state.register(input, 0, &Pubkey::new_unique(), 1000).unwrap();
state
.register(input, 0, &Pubkey::new_unique(), 1000)
.unwrap();

let beam_key = Pubkey::new_unique();
let new_beam = BeamDetails::new(beam_key, 10);
Expand Down

0 comments on commit d7aed90

Please sign in to comment.