Skip to content

Commit

Permalink
Add test
Browse files Browse the repository at this point in the history
  • Loading branch information
sakridge committed Dec 18, 2021
1 parent 2a67c59 commit 441e584
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions core/src/transaction_weighting_stage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,22 @@ impl TransactionWeightStage {
self.thread_hdl.join()
}
}

#[cfg(test)]
mod tests {
use super::*;
use solana_perf::packet::Packet;

#[test]
fn test_apply_weights() {
let packet = Packet::default();
let packets = PacketBatch::new(vec![packet]);
let ip_to_stake = HashMap::new();
let mut vec_packets_batch = vec![packets];
TransactionWeightStage::apply_weights(&mut vec_packets_batch, &ip_to_stake);
vec_packets_batch[0]
.packets
.iter()
.for_each(|packet| assert_eq!(packet.meta.weight, 0));
}
}

0 comments on commit 441e584

Please sign in to comment.