Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(primitives): Organize test data on a single dir #112

Merged
merged 1 commit into from
Jun 6, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pallas-primitives/src/alonzo/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ mod tests {
fn known_address_matches() {
// TODO: expand this test to include more test blocks
let block_idx = 1;
let block_str = include_str!("test_data/test2.block");
let block_str = include_str!("../test_data/alonzo2.block");

let block_bytes = hex::decode(block_str).expect(&format!("bad block file {}", block_idx));
let BlockWrapper(_, block) = BlockWrapper::decode_fragment(&block_bytes[..])
Expand Down
2 changes: 1 addition & 1 deletion pallas-primitives/src/alonzo/crypto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ mod tests {
fn transaction_hash_works() {
// TODO: expand this test to include more test blocks
let block_idx = 1;
let block_str = include_str!("test_data/test1.block");
let block_str = include_str!("../test_data/alonzo1.block");

let block_bytes = hex::decode(block_str).expect(&format!("bad block file {}", block_idx));
let block_model = BlockWrapper::decode_fragment(&block_bytes[..])
Expand Down
8 changes: 4 additions & 4 deletions pallas-primitives/src/alonzo/json.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,8 @@ mod tests {
#[test]
fn test_datums_serialize_as_expected() {
let test_blocks = vec![(
include_str!("test_data/test9.block"),
include_str!("test_data/test9.datums"),
include_str!("../test_data/alonzo9.block"),
include_str!("../test_data/alonzo9.datums"),
)];

for (idx, (block_str, jsonl_str)) in test_blocks.iter().enumerate() {
Expand Down Expand Up @@ -115,8 +115,8 @@ mod tests {
#[test]
fn test_native_scripts_serialize_as_expected() {
let test_blocks = vec![(
include_str!("test_data/test9.block"),
include_str!("test_data/test9.native"),
include_str!("../test_data/alonzo9.block"),
include_str!("../test_data/alonzo9.native"),
)];

for (idx, (block_str, jsonl_str)) in test_blocks.iter().enumerate() {
Expand Down
46 changes: 23 additions & 23 deletions pallas-primitives/src/alonzo/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1459,45 +1459,45 @@ mod tests {
#[test]
fn block_isomorphic_decoding_encoding() {
let test_blocks = vec![
include_str!("test_data/test1.block"),
include_str!("test_data/test2.block"),
include_str!("test_data/test3.block"),
include_str!("test_data/test4.block"),
include_str!("test_data/test5.block"),
include_str!("test_data/test6.block"),
include_str!("test_data/test7.block"),
include_str!("test_data/test8.block"),
include_str!("test_data/test9.block"),
include_str!("../test_data/alonzo1.block"),
include_str!("../test_data/alonzo2.block"),
include_str!("../test_data/alonzo3.block"),
include_str!("../test_data/alonzo4.block"),
include_str!("../test_data/alonzo5.block"),
include_str!("../test_data/alonzo6.block"),
include_str!("../test_data/alonzo7.block"),
include_str!("../test_data/alonzo8.block"),
include_str!("../test_data/alonzo9.block"),
// old block without invalid_transactions fields
include_str!("test_data/test10.block"),
include_str!("../test_data/alonzo10.block"),
// peculiar block with protocol update params
include_str!("test_data/test11.block"),
include_str!("../test_data/alonzo11.block"),
// peculiar block with decoding issue
// https://github.com/txpipe/oura/issues/37
include_str!("test_data/test12.block"),
include_str!("../test_data/alonzo12.block"),
// peculiar block with protocol update params, including nonce
include_str!("test_data/test13.block"),
include_str!("../test_data/alonzo13.block"),
// peculiar block with overflow crash
// https://github.com/txpipe/oura/issues/113
include_str!("test_data/test14.block"),
include_str!("../test_data/alonzo14.block"),
// peculiar block with many move-instantaneous-rewards certs
include_str!("test_data/test15.block"),
include_str!("../test_data/alonzo15.block"),
// peculiar block with protocol update values
include_str!("test_data/test16.block"),
include_str!("../test_data/alonzo16.block"),
// peculiar block with missing nonce hash
include_str!("test_data/test17.block"),
include_str!("../test_data/alonzo17.block"),
// peculiar block with strange AuxiliaryData variant
include_str!("test_data/test18.block"),
include_str!("../test_data/alonzo18.block"),
// peculiar block with strange AuxiliaryData variant
include_str!("test_data/test18.block"),
include_str!("../test_data/alonzo18.block"),
// peculiar block with nevative i64 overflow
include_str!("test_data/test19.block"),
include_str!("../test_data/alonzo19.block"),
// peculiar block with very BigInt in plutus code
include_str!("test_data/test20.block"),
include_str!("../test_data/alonzo20.block"),
// peculiar block with bad tx hash
include_str!("test_data/test21.block"),
include_str!("../test_data/alonzo21.block"),
// peculiar block with bad tx hash
include_str!("test_data/test22.block"),
include_str!("../test_data/alonzo22.block"),
];

for (idx, block_str) in test_blocks.iter().enumerate() {
Expand Down
2 changes: 1 addition & 1 deletion pallas-primitives/src/probing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ mod tests {

#[test]
fn alonzo_block_detected() {
let block_str = include_str!("alonzo/test_data/test1.block");
let block_str = include_str!("test_data/alonzo1.block");
let bytes = hex::decode(block_str).unwrap();

let inference = probe_block_cbor_era(bytes.as_slice());
Expand Down