From 81af6eef22daf87a2653b1c2f656d284c4abb859 Mon Sep 17 00:00:00 2001 From: Jakub Bogucki Date: Sat, 11 Jun 2022 00:52:45 +0200 Subject: [PATCH] Add couple tests despite I shouldn't probablt add them --- packages/std/src/math/uint128.rs | 9 +++++++++ packages/std/src/math/uint256.rs | 12 ++++++++++++ packages/std/src/math/uint512.rs | 13 +++++++++++++ 3 files changed, 34 insertions(+) diff --git a/packages/std/src/math/uint128.rs b/packages/std/src/math/uint128.rs index c896dbe512..b8942a4469 100644 --- a/packages/std/src/math/uint128.rs +++ b/packages/std/src/math/uint128.rs @@ -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(); diff --git a/packages/std/src/math/uint256.rs b/packages/std/src/math/uint256.rs index af1c5abdb3..9ee6bc584d 100644 --- a/packages/std/src/math/uint256.rs +++ b/packages/std/src/math/uint256.rs @@ -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]); diff --git a/packages/std/src/math/uint512.rs b/packages/std/src/math/uint512.rs index f9c3155705..5b7db397b8 100644 --- a/packages/std/src/math/uint512.rs +++ b/packages/std/src/math/uint512.rs @@ -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]);