Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
add tests and groom naming (#4467)
Browse files Browse the repository at this point in the history
  • Loading branch information
rob-solana authored May 29, 2019
1 parent 534244b commit c05c3e6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions sdk/src/syscall/slot_hashes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ mod tests {
use crate::hash::hash;

#[test]
fn test_slot_hashes_id() {
fn test_id() {
let ids = [("Sysca11S1otHashes11111111111111111111111111", id())];
// to get the bytes above:
// ids.iter().for_each(|(name, _)| {
Expand All @@ -81,7 +81,7 @@ mod tests {
}

#[test]
fn test_slot_hashes_create_account() {
fn test_create_account() {
let lamports = 42;
let account = create_account(lamports);
let slot_hashes = SlotHashes::from(&account);
Expand All @@ -93,7 +93,10 @@ mod tests {
hash(&[(i >> 24) as u8, (i >> 16) as u8, (i >> 8) as u8, i as u8]),
);
}
assert_eq!(slot_hashes[0].0, MAX_SLOT_HASHES as u64);
for i in 0..MAX_SLOT_HASHES {
assert_eq!(slot_hashes[i].0, (MAX_SLOT_HASHES - i) as u64);
}

assert_eq!(slot_hashes.len(), MAX_SLOT_HASHES);
}
}

0 comments on commit c05c3e6

Please sign in to comment.