66use std:: time:: Duration ;
77
88use criterion:: { Criterion , criterion_group, criterion_main} ;
9- use tinyscript:: { DefaultEnvironment , Runtime } ;
9+ use tinyscript:: { DefaultEnvironment , Runtime , SHOULD_NOT_HAPPEN } ;
1010
1111const SAMPLES : usize = 100 ;
1212const ITERATIONS : usize = 100 ;
@@ -21,57 +21,57 @@ fn equality(c: &mut Criterion) {
2121
2222 let chunk = runtime
2323 . parse ( "true==true; true==false; false==true; false==false;" )
24- . expect ( "snh" ) ;
24+ . expect ( SHOULD_NOT_HAPPEN ) ;
2525 group. bench_function ( "boolean" , |b| {
2626 b. iter ( || {
2727 for _ in 1 ..=ITERATIONS {
28- runtime. execute ( & chunk, & mut env) . expect ( "snh" ) ;
28+ runtime. execute ( & chunk, & mut env) . expect ( SHOULD_NOT_HAPPEN ) ;
2929 }
3030 std:: hint:: black_box ( ( ) ) ;
3131 } ) ;
3232 } ) ;
3333
3434 let chunk = runtime
3535 . parse ( "1==1; 3.1475==4.99999; -3.00987654321234==-3.00987654321234; 3.00987654321234==4;" )
36- . expect ( "snh" ) ;
36+ . expect ( SHOULD_NOT_HAPPEN ) ;
3737 group. bench_function ( "double" , |b| {
3838 b. iter ( || {
3939 for _ in 1 ..=ITERATIONS {
40- runtime. execute ( & chunk, & mut env) . expect ( "snh" ) ;
40+ runtime. execute ( & chunk, & mut env) . expect ( SHOULD_NOT_HAPPEN ) ;
4141 }
4242 std:: hint:: black_box ( ( ) ) ;
4343 } ) ;
4444 } ) ;
4545
4646 let chunk = runtime
4747 . parse ( "0x1==0x1; 0xFF321==0x56adf; -0x34==-0x34; 0xabcdef==0x1;" )
48- . expect ( "snh" ) ;
48+ . expect ( SHOULD_NOT_HAPPEN ) ;
4949 group. bench_function ( "integer" , |b| {
5050 b. iter ( || {
5151 for _ in 1 ..=ITERATIONS {
52- runtime. execute ( & chunk, & mut env) . expect ( "snh" ) ;
52+ runtime. execute ( & chunk, & mut env) . expect ( SHOULD_NOT_HAPPEN ) ;
5353 }
5454 std:: hint:: black_box ( ( ) ) ;
5555 } ) ;
5656 } ) ;
5757
58- let chunk = runtime. parse ( "'short'=='short'; 'short'=='sho'; 'medium'=='this is a little bit longer'; 'this is a little bit longer'=='this is a little bit longer';" ) . expect ( "snh" ) ;
58+ let chunk = runtime. parse ( "'short'=='short'; 'short'=='sho'; 'medium'=='this is a little bit longer'; 'this is a little bit longer'=='this is a little bit longer';" ) . expect ( SHOULD_NOT_HAPPEN ) ;
5959 group. bench_function ( "string" , |b| {
6060 b. iter ( || {
6161 for _ in 1 ..=ITERATIONS {
62- runtime. execute ( & chunk, & mut env) . expect ( "snh" ) ;
62+ runtime. execute ( & chunk, & mut env) . expect ( SHOULD_NOT_HAPPEN ) ;
6363 }
6464 std:: hint:: black_box ( ( ) ) ;
6565 } ) ;
6666 } ) ;
6767
6868 let chunk = runtime
6969 . parse ( "'short'==true; 'short'==1; 'medium'==nil; 'this is a little bit longer'==0x15;" )
70- . expect ( "snh" ) ;
70+ . expect ( SHOULD_NOT_HAPPEN ) ;
7171 group. bench_function ( "mixed" , |b| {
7272 b. iter ( || {
7373 for _ in 1 ..=ITERATIONS {
74- runtime. execute ( & chunk, & mut env) . expect ( "snh" ) ;
74+ runtime. execute ( & chunk, & mut env) . expect ( SHOULD_NOT_HAPPEN ) ;
7575 }
7676 std:: hint:: black_box ( ( ) ) ;
7777 } ) ;
0 commit comments