Skip to content

Commit 1615c49

Browse files
committed
split "too few args" and "no args" tests
1 parent 248111e commit 1615c49

File tree

1 file changed

+54
-0
lines changed
  • crates/move-bytecode-verifier/src/type_safety_tests

1 file changed

+54
-0
lines changed

crates/move-bytecode-verifier/src/type_safety_tests/mod.rs

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,22 @@ fn test_arithmetic_too_few_args() {
343343
let module = make_module(code);
344344
let fun_context = get_fun_context(&module);
345345
let _result = type_safety::verify(&module, &fun_context, &mut DummyMeter);
346+
}
347+
}
346348

349+
#[test]
350+
#[should_panic]
351+
fn test_arithmetic_no_args() {
352+
for instr in vec![
353+
Bytecode::Add,
354+
Bytecode::Sub,
355+
Bytecode::Mul,
356+
Bytecode::Mod,
357+
Bytecode::Div,
358+
Bytecode::BitOr,
359+
Bytecode::BitAnd,
360+
Bytecode::Xor,
361+
] {
347362
let code = vec![instr.clone()];
348363
let module = make_module(code);
349364
let fun_context = get_fun_context(&module);
@@ -421,6 +436,16 @@ fn test_shl_shr_too_few_args() {
421436
let fun_context = get_fun_context(&module);
422437
let _result = type_safety::verify(&module, &fun_context, &mut DummyMeter);
423438

439+
}
440+
}
441+
442+
#[test]
443+
#[should_panic]
444+
fn test_shl_shr_no_args() {
445+
for instr in vec![
446+
Bytecode::Shl,
447+
Bytecode::Shr,
448+
] {
424449
let code = vec![instr.clone()];
425450
let module = make_module(code);
426451
let fun_context = get_fun_context(&module);
@@ -480,7 +505,16 @@ fn test_or_and_too_few_args() {
480505
let module = make_module(code);
481506
let fun_context = get_fun_context(&module);
482507
let _result = type_safety::verify(&module, &fun_context, &mut DummyMeter);
508+
}
509+
}
483510

511+
#[test]
512+
#[should_panic]
513+
fn test_or_and_no_args() {
514+
for instr in vec![
515+
Bytecode::Or,
516+
Bytecode::And,
517+
] {
484518
let code = vec![instr.clone()];
485519
let module = make_module(code);
486520
let fun_context = get_fun_context(&module);
@@ -607,7 +641,18 @@ fn test_comparison_too_few_args() {
607641
let module = make_module(code);
608642
let fun_context = get_fun_context(&module);
609643
let _result = type_safety::verify(&module, &fun_context, &mut DummyMeter);
644+
}
645+
}
610646

647+
#[test]
648+
#[should_panic]
649+
fn test_comparison_no_args() {
650+
for instr in vec![
651+
Bytecode::Lt,
652+
Bytecode::Gt,
653+
Bytecode::Le,
654+
Bytecode::Ge,
655+
] {
611656
let code = vec![instr.clone()];
612657
let module = make_module(code);
613658
let fun_context = get_fun_context(&module);
@@ -834,7 +879,16 @@ fn test_eq_neq_too_few_args() {
834879
let module = make_module(code);
835880
let fun_context = get_fun_context(&module);
836881
let _result = type_safety::verify(&module, &fun_context, &mut DummyMeter);
882+
}
883+
}
837884

885+
#[test]
886+
#[should_panic]
887+
fn test_eq_neq_no_args() {
888+
for instr in vec![
889+
Bytecode::Eq,
890+
Bytecode::Neq,
891+
] {
838892
let code = vec![instr.clone()];
839893
let module = make_module(code);
840894
let fun_context = get_fun_context(&module);

0 commit comments

Comments
 (0)