Skip to content

Commit

Permalink
generate tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ralexstokes committed Jun 7, 2023
1 parent 5733812 commit 8dca0dc
Show file tree
Hide file tree
Showing 90 changed files with 60,099 additions and 47,830 deletions.
64,581 changes: 38,861 additions & 25,720 deletions ssz-rs/tests/basic_vector.rs

Large diffs are not rendered by default.

3,930 changes: 1,595 additions & 2,335 deletions ssz-rs/tests/bitlist.rs

Large diffs are not rendered by default.

1,091 changes: 446 additions & 645 deletions ssz-rs/tests/bitvector.rs

Large diffs are not rendered by default.

75 changes: 38 additions & 37 deletions ssz-rs/tests/boolean.rs
Original file line number Diff line number Diff line change
@@ -1,49 +1,14 @@
//! This file was generated by `ssz-rs-test-gen`; do NOT manually edit.
mod test_utils;

use ssz_rs::prelude::*;
use test_utils::{
deserialize, hash_tree_root, read_ssz_snappy_from_test_data, root_from_hex, serialize,
};

#[test]
fn test_boolean_true() {
let mut value = true;
let encoding = serialize(&value);
let expected_encoding = read_ssz_snappy_from_test_data(
"ssz-rs/tests/data/boolean/valid/true/serialized.ssz_snappy",
);
assert_eq!(encoding, expected_encoding);

let recovered_value: bool = deserialize(&expected_encoding);
assert_eq!(recovered_value, value);

let root = hash_tree_root(&mut value);
let expected_root =
root_from_hex("0100000000000000000000000000000000000000000000000000000000000000");
assert_eq!(root, expected_root);
}

#[test]
fn test_boolean_false() {
let mut value = false;
let encoding = serialize(&value);
let expected_encoding = read_ssz_snappy_from_test_data(
"ssz-rs/tests/data/boolean/valid/false/serialized.ssz_snappy",
);
assert_eq!(encoding, expected_encoding);

let recovered_value: bool = deserialize(&expected_encoding);
assert_eq!(recovered_value, value);

let root = hash_tree_root(&mut value);
let expected_root =
root_from_hex("0000000000000000000000000000000000000000000000000000000000000000");
assert_eq!(root, expected_root);
}

#[test]
#[should_panic]
fn test_boolean_byte_0x80() {
fn test_boolean_byte_0_x_80() {
let encoding = read_ssz_snappy_from_test_data(
"ssz-rs/tests/data/boolean/invalid/byte_0x80/serialized.ssz_snappy",
);
Expand Down Expand Up @@ -80,3 +45,39 @@ fn test_boolean_byte_rev_nibble() {

deserialize::<bool>(&encoding);
}

#[test]
fn test_boolean_false() {
let mut value = false;
let encoding = serialize(&value);
let expected_encoding = read_ssz_snappy_from_test_data(
"ssz-rs/tests/data/boolean/valid/false/serialized.ssz_snappy",
);
assert_eq!(encoding, expected_encoding);

let recovered_value: bool = deserialize(&expected_encoding);
assert_eq!(recovered_value, value);

let root = hash_tree_root(&mut value);
let expected_root =
root_from_hex("0x0000000000000000000000000000000000000000000000000000000000000000");
assert_eq!(root, expected_root);
}

#[test]
fn test_boolean_true() {
let mut value = true;
let encoding = serialize(&value);
let expected_encoding = read_ssz_snappy_from_test_data(
"ssz-rs/tests/data/boolean/valid/true/serialized.ssz_snappy",
);
assert_eq!(encoding, expected_encoding);

let recovered_value: bool = deserialize(&expected_encoding);
assert_eq!(recovered_value, value);

let root = hash_tree_root(&mut value);
let expected_root =
root_from_hex("0x0100000000000000000000000000000000000000000000000000000000000000");
assert_eq!(root, expected_root);
}
36,803 changes: 18,402 additions & 18,401 deletions ssz-rs/tests/containers.rs

Large diffs are not rendered by default.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Loading

0 comments on commit 8dca0dc

Please sign in to comment.