Skip to content

Commit

Permalink
clean up bitshifts from tests
Browse files Browse the repository at this point in the history
  • Loading branch information
baitcode committed Jan 6, 2025
1 parent 80cf041 commit f507631
Showing 1 changed file with 0 additions and 23 deletions.
23 changes: 0 additions & 23 deletions src/utils/fp_test.cairo
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use core::num::traits::WideMul;
use super::fp::BitShiftImpl;
use super::fp::UFixedPointTrait;

use crate::utils::fp::{UFixedPoint124x128};
Expand Down Expand Up @@ -71,31 +70,9 @@ fn test_u256_conversion() {
assert_eq!(f.low, 0x00112233445566778899AABBCCDDEEFF);
assert_eq!(f.high, 0x0123456789ABCDEFFEDCBA9876543210);

// BITSHIFT DOWN
let fp: UFixedPoint124x128 = f.into();
assert_eq!(fp.get_integer(), f.high);
assert_eq!(fp.get_fractional(), f.low);

let fp = fp.bitshift_128_down();
assert_eq!(fp.get_integer(), 0);
assert_eq!(fp.get_fractional(), f.high);

let fp = fp.bitshift_128_down();
assert_eq!(fp.get_integer(), 0);
assert_eq!(fp.get_fractional(), 0);

// BITSHIFT UP
let fp: UFixedPoint124x128 = f.into();
assert_eq!(fp.get_integer(), f.high);
assert_eq!(fp.get_fractional(), f.low);

let fp = fp.bitshift_128_up();
assert_eq!(fp.get_integer(), f.low);
assert_eq!(fp.get_fractional(), 0);

let fp = fp.bitshift_128_up();
assert_eq!(fp.get_integer(), 0);
assert_eq!(fp.get_fractional(), 0);
}

fn run_division_test(left: u128, right: u128, expected_int: u128, expected_frac: u128) {
Expand Down

0 comments on commit f507631

Please sign in to comment.