Skip to content

Commit

Permalink
Working tests
Browse files Browse the repository at this point in the history
  • Loading branch information
fkrause98 committed Jun 12, 2024
1 parent 8b8e7c2 commit 25f4462
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,5 @@ clean:

lint:
cargo clippy --workspace --all-features --benches --examples --tests -- -D warnings
test: clean compile-programs
cargo test
14 changes: 14 additions & 0 deletions programs/sub_and_add.zasm
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
.text
.file "sub_and_add.zasm"
.globl __entry
__entry:

.func_begin0:
sub r1, r1, r1
add 1, r1, r1
sstore r0, r1
ret

.func_end0:
.note.GNU-stack
.rodata
8 changes: 8 additions & 0 deletions tests/integration_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,11 @@ fn test_sub_asm() {
let result = run_program(&bin_path);
assert_eq!(result, U256::from_dec_str("0").unwrap());
}

#[test]
fn test_sub_and_add() {
let bin_path = make_bin_path_asm("sub_and_add");
let result = run_program(&bin_path);
assert_eq!(result, U256::from_dec_str("1").unwrap());
}

0 comments on commit 25f4462

Please sign in to comment.