diff --git a/src/channel/tests/test_channel.cairo b/src/channel/tests/test_channel.cairo index 7bbd60f4f..b732b68be 100644 --- a/src/channel/tests/test_channel.cairo +++ b/src/channel/tests/test_channel.cairo @@ -73,3 +73,96 @@ fn test_read_from_prover() { 'invalid read uint64' ); } + +#[test] +#[available_gas(9999999999)] +fn test_read_felt_from_prover() { + let mut channel = ChannelTrait::new( + 32204560462099576052071116479981543464788400881991862378480356767528153881242 + ); + + channel + .read_felt_from_prover( + 2189543135532000975073223102299103804374316765743393096814633396722915142781 + ); + + assert(channel.counter == 0, 'invalid read felt'); + assert( + channel + .digest == 45225624675187382281293799788723729210709046294536191403393069808321359573734, + 'invalid read felt' + ); +} + +#[test] +#[available_gas(9999999999)] +fn test_read_felts_from_prover() { + let mut channel = ChannelTrait::new( + 32204560462099576052071116479981543464788400881991862378480356767528153881242 + ); + + let input: Array = array![ + 801118498771077385876680702501056689617384700744497628665736844456538025970, + 136480279717397680743751578088474164975408857089091902035326656170846663451, + 2651216551934055237793488162754368170820458364194359599585259842725151359862, + 1329979499816441827238714390674457535408265475870499110057295862043364226076, + 1296657666566505608212940111737606773084572384346777899263419033521078751013, + 2670331407575655388711197125855776741254884375650252030276227999952482413107, + 495372650276597730770783063328923909247361253131174237717335302286062865236, + ]; + + channel.read_felts_from_prover(input.span()); + + assert(channel.counter == 0, 'invalid read felts'); + assert( + channel + .digest == 9361551412742470520142265470561908553217097453533185961440210388135835515653, + 'invalid read felts' + ); +} + +#[test] +#[available_gas(9999999999)] +fn test_read_felt_vector_from_prover() { + let mut channel = ChannelTrait::new( + 32204560462099576052071116479981543464788400881991862378480356767528153881242 + ); + + let input: Array = array![ + 801118498771077385876680702501056689617384700744497628665736844456538025970, + 136480279717397680743751578088474164975408857089091902035326656170846663451, + 2651216551934055237793488162754368170820458364194359599585259842725151359862, + 1329979499816441827238714390674457535408265475870499110057295862043364226076, + 1296657666566505608212940111737606773084572384346777899263419033521078751013, + 2670331407575655388711197125855776741254884375650252030276227999952482413107, + 495372650276597730770783063328923909247361253131174237717335302286062865236, + 530987496743476398107560876052655845720523049587973335384780354401593620645, + 3345549494797593157992468861554060638252345356820185819238082993079257164020 + ]; + + channel.read_felt_vector_from_prover(input.span()); + + assert(channel.counter == 0, 'invalid read felts'); + assert( + channel + .digest == 4348116345188292541807408380512632346270917025990245174258204584556253737000, + 'invalid read felts' + ); +} + +#[test] +#[available_gas(9999999999)] +fn test_read_uint64_from_prover() { + let mut channel = ChannelTrait::new( + 32204560462099576052071116479981543464788400881991862378480356767528153881242 + ); + + channel.read_uint64_from_prover(4815830333676699184); + + assert(channel.counter == 0, 'invalid read uint64'); + assert( + channel + .digest == 82019160662385672738794368995803566011653417904767166511054323305428036240181, + 'invalid read uint64' + ); +}