Skip to content

Commit

Permalink
Merge branch 'master' into hotfix-network-from-str-err
Browse files Browse the repository at this point in the history
  • Loading branch information
tamasblummer authored May 20, 2018
2 parents 5771841 + 6b1872e commit cf4024b
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/internal_macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,10 @@ macro_rules! impl_array_newtype {
#[inline]
/// Returns whether the object, as an array, is empty. Always false.
pub fn is_empty(&self) -> bool { false }

#[inline]
/// Returns the underlying data.
pub fn data(&self) -> [$ty; $len] { self.0.clone() }
}

impl<'a> From<&'a [$ty]> for $thing {
Expand Down
12 changes: 12 additions & 0 deletions src/util/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,18 @@ mod tests {
"56944C5D3F98413EF45CF54545538103CC9F298E0575820AD3591376E2E0F65D");
}

#[test]
fn test_sha256d_data() {
assert_eq!(
Sha256dHash::from_data(&[]).data(),
[
0x5d, 0xf6, 0xe0, 0xe2, 0x76, 0x13, 0x59, 0xd3, 0x0a, 0x82, 0x75, 0x05, 0x8e, 0x29,
0x9f, 0xcc, 0x03, 0x81, 0x53, 0x45, 0x45, 0xf5, 0x5c, 0xf4, 0x3e, 0x41, 0x98, 0x3f,
0x5d, 0x4c, 0x94, 0x56,
]
);
}

#[test]
fn sha256d_encoder() {
let test = vec![true, false, true, true, false];
Expand Down

0 comments on commit cf4024b

Please sign in to comment.