Skip to content

Commit

Permalink
Moved into-guarantee test into bounded-int.
Browse files Browse the repository at this point in the history
commit-id:7f79b0ef
  • Loading branch information
orizi committed Jun 25, 2024
1 parent a01c11b commit 510fd77
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 38 deletions.
35 changes: 35 additions & 0 deletions tests/e2e_test_data/libfuncs/bounded_int
Original file line number Diff line number Diff line change
Expand Up @@ -823,3 +823,38 @@ store_temp<NonZero<BoundedInt<-680564733841876926926749214863536422911, -1>>>([1
return([1]); // 2

test::foo@0([0]: BoundedInt<-680564733841876926926749214863536422911, -1>) -> (NonZero<BoundedInt<-680564733841876926926749214863536422911, -1>>);

//! > ==========================================================================

//! > bounded_int_into_guarantee

//! > test_runner_name
SmallE2ETestRunner

//! > cairo
use core::internal::{BoundedIntGuarantee, bounded_int_into_guarantee};


fn foo(val: u8) -> BoundedIntGuarantee<u8> {
bounded_int_into_guarantee(val)
}

//! > casm
[ap + 0] = [fp + -3], ap++;
ret;

//! > sierra_code
type u8 = u8 [storable: true, drop: true, dup: true, zero_sized: false];
type BoundedIntGuarantee<u8> = BoundedIntGuarantee<u8> [storable: true, drop: false, dup: false, zero_sized: false];

libfunc bounded_int_into_guarantee<u8> = bounded_int_into_guarantee<u8>;
libfunc store_temp<BoundedIntGuarantee<u8>> = store_temp<BoundedIntGuarantee<u8>>;

bounded_int_into_guarantee<u8>([0]) -> ([1]); // 0
store_temp<BoundedIntGuarantee<u8>>([1]) -> ([1]); // 1
return([1]); // 2

test::foo@0([0]: u8) -> (BoundedIntGuarantee<u8>);

//! > function_costs
test::foo: OrderedHashMap({Const: 100})
38 changes: 0 additions & 38 deletions tests/e2e_test_data/libfuncs/circuit
Original file line number Diff line number Diff line change
Expand Up @@ -712,44 +712,6 @@ test::foo: OrderedHashMap({Const: 1700})

//! > ==========================================================================

//! > into_u96_guarantee

//! > test_runner_name
SmallE2ETestRunner

//! > cairo
use core::circuit::{U96Guarantee, into_u96_guarantee};


fn foo(val: u8) -> U96Guarantee {
into_u96_guarantee(val)
}

//! > casm
[ap + 0] = [fp + -3], ap++;
ret;

//! > sierra_code
type u8 = u8 [storable: true, drop: true, dup: true, zero_sized: false];
type BoundedIntGuarantee<BoundedInt<0, 79228162514264337593543950335>> = BoundedIntGuarantee<BoundedInt<0, 79228162514264337593543950335>> [storable: true, drop: false, dup: false, zero_sized: false];
type BoundedInt<0, 79228162514264337593543950335> = BoundedInt<0, 79228162514264337593543950335> [storable: true, drop: true, dup: true, zero_sized: false];

libfunc upcast<u8, BoundedInt<0, 79228162514264337593543950335>> = upcast<u8, BoundedInt<0, 79228162514264337593543950335>>;
libfunc bounded_int_into_guarantee<BoundedInt<0, 79228162514264337593543950335>> = bounded_int_into_guarantee<BoundedInt<0, 79228162514264337593543950335>>;
libfunc store_temp<BoundedIntGuarantee<BoundedInt<0, 79228162514264337593543950335>>> = store_temp<BoundedIntGuarantee<BoundedInt<0, 79228162514264337593543950335>>>;

upcast<u8, BoundedInt<0, 79228162514264337593543950335>>([0]) -> ([1]); // 0
bounded_int_into_guarantee<BoundedInt<0, 79228162514264337593543950335>>([1]) -> ([2]); // 1
store_temp<BoundedIntGuarantee<BoundedInt<0, 79228162514264337593543950335>>>([2]) -> ([2]); // 2
return([2]); // 3

test::foo@0([0]: u8) -> (BoundedIntGuarantee<BoundedInt<0, 79228162514264337593543950335>>);

//! > function_costs
test::foo: OrderedHashMap({Const: 100})

//! > ==========================================================================

//! > u96_guarantee_verify

//! > test_runner_name
Expand Down

0 comments on commit 510fd77

Please sign in to comment.