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

Switch to alloy #21

Merged
merged 7 commits into from
Aug 14, 2024
Merged
Changes from 1 commit
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
Prev Previous commit
Bytes tests
  • Loading branch information
michaelsproul committed Aug 14, 2024
commit 06d9bcd1f0f36f38919496900c16d16e7f805ea5
23 changes: 20 additions & 3 deletions ssz/tests/tests.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use alloy_primitives::{Address, B256, U128, U256};
use alloy_primitives::{Address, Bytes, B256, U128, U256};
use ssz::{Decode, DecodeError, Encode};
use ssz_derive::{Decode, Encode};
use std::num::NonZeroUsize;
@@ -503,7 +503,7 @@ mod round_trip {
}

#[test]
fn alloy_u256() {
fn u256() {
let data = vec![
U256::from(0),
U256::MAX,
@@ -514,7 +514,7 @@ mod round_trip {
}

#[test]
fn vec_of_option_alloy_u256() {
fn vec_of_option_u256() {
let data = vec![
vec![Some(U256::MAX), Some(U256::from(0)), None],
vec![None],
@@ -523,6 +523,23 @@ mod round_trip {
];
round_trip(data);
}

#[test]
fn alloy_bytes() {
let data = vec![
Bytes::new(),
Bytes::from_static(&[1, 2, 3]),
Bytes::from_static(&[0; 32]),
Bytes::from_static(&[0]),
];
round_trip(data);
}

#[test]
fn tuple_option() {
let data = vec![(48u8, Some(0u64)), (0u8, None), (u8::MAX, Some(u64::MAX))];
round_trip(data);
}
}

/// Decode tests that are expected to fail.
Loading