chore: Add test for output traverse (#157)

This commit is contained in:
Santiago Carmuega 2022-08-02 22:45:21 -03:00 committed by GitHub
parent 14bd038874
commit d77019618e
2 changed files with 20 additions and 0 deletions

View file

@ -104,3 +104,22 @@ impl<'b> MultiEraOutput<'b> {
}
}
}
#[cfg(test)]
mod tests {
use crate::MultiEraBlock;
#[test]
fn traverse_block_with_varied_outputs() {
let str = include_str!("../../test_data/alonzo24.block");
let bytes = hex::decode(str).unwrap();
let block = MultiEraBlock::decode(&bytes).unwrap();
for tx in block.txs() {
for output in tx.outputs() {
assert_ne!(output.ada_amount(), 0);
assert!(matches!(output.address(), Ok(_)));
}
}
}
}