Skip to content

Commit

Permalink
Add couple tests despite I shouldn't probablt add them
Browse files Browse the repository at this point in the history
  • Loading branch information
ueco-jb committed Jun 10, 2022
1 parent 06b1b1d commit 81af6ee
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/std/src/math/uint128.rs
Original file line number Diff line number Diff line change
Expand Up @@ -508,6 +508,15 @@ mod tests {
use super::*;
use crate::{from_slice, to_vec};

#[test]
fn uint128_one_works() {
let one = Uint128::one();
assert_eq!(
one.to_be_bytes(),
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1]
);
}

#[test]
fn uint128_zero_and_one_works() {
let zero = Uint128::zero();
Expand Down
12 changes: 12 additions & 0 deletions packages/std/src/math/uint256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,18 @@ mod tests {
use super::*;
use crate::{from_slice, to_vec};

#[test]
fn uin256_one_works() {
let one = Uint256::one();
assert_eq!(
one.to_be_bytes(),
[
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 1,
]
);
}

#[test]
fn uint256_construct() {
let num = Uint256::new([1; 32]);
Expand Down
13 changes: 13 additions & 0 deletions packages/std/src/math/uint512.rs
Original file line number Diff line number Diff line change
Expand Up @@ -566,6 +566,19 @@ mod tests {
use super::*;
use crate::{from_slice, to_vec};

#[test]
fn uin512_one_works() {
let one = Uint512::one();
assert_eq!(
one.to_be_bytes(),
[
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 1
]
);
}

#[test]
fn uint512_construct() {
let num = Uint512::new([1; 64]);
Expand Down

0 comments on commit 81af6ee

Please sign in to comment.