Skip to content

Commit

Permalink
chore(bounded-ints): refresh snapshot
Browse files Browse the repository at this point in the history
  • Loading branch information
Lucas Franceschino authored and W95Psp committed Jun 24, 2024
1 parent ebd667a commit cf6012d
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,30 +38,3 @@ let t_BoundedU8 (v_MIN v_MAX: u8) = x: u8{x >=. v_MIN && x <=. v_MAX}

///Bounded usize integers. This struct enforces the invariant that values are greater or equal to `MIN` and less or equal to `MAX`.
let t_BoundedUsize (v_MIN v_MAX: usize) = x: usize{x >=. v_MIN && x <=. v_MAX}

let t_Test (v_B: usize) =
x:
i16
{ x >=. (Core.Ops.Arith.Neg.neg (cast (v_B <: usize) <: i16) <: i16) &&
x <=. (cast (v_B <: usize) <: i16) }

let tests (_: Prims.unit) : Prims.unit =
let (zzz: t_Test (sz 123)):t_Test (sz 123) = (-122s) <: t_Test (sz 123) in
let zzz:t_Test (sz 123) = Core.Ops.Arith.f_add_assign #(t_Test (sz 123)) #i16 zzz 32s in
let (x: t_BoundedU8 0uy 5uy):t_BoundedU8 0uy 5uy = 2uy <: t_BoundedU8 0uy 5uy in
let (y: t_BoundedU8 5uy 10uy):t_BoundedU8 5uy 10uy = x +! x <: t_BoundedU8 5uy 10uy in
let _:u8 = x >>! 3uy in
let _:u8 = x >>! (3uy <: t_BoundedU8 0uy 5uy) in
let _:u8 = x /! y in
let _:u8 = x *! y in
let _:u8 = x +! y in
let _:u8 = y -! x in
let _:u8 = x /! 1uy in
let _:u8 = x *! 1uy in
let _:u8 = x +! 1uy in
let _:u8 = x -! 1uy in
let _:u8 = 4uy /! y in
let _:u8 = 4uy *! y in
let _:u8 = 4uy +! y in
let _:u8 = 4uy -! y in
()
2 changes: 1 addition & 1 deletion hax-bounded-integers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ const _: () = {
#[test]
fn tests() {
refinement_int!(
Test<const B: usize>(i16, 2, |x| x >= -(B as i16) && x <= (B as i16))
Test<const B: usize>(i16, 2, |x| B < 32768 && x >= -(B as i16) && x <= (B as i16))
);

use hax_lib::*;
Expand Down

0 comments on commit cf6012d

Please sign in to comment.