mirror of
https://github.com/eth-act/ere.git
synced 2026-04-03 03:00:17 -04:00
Use test-utils for all zkvms (#88)
This commit is contained in:
10
tests/openvm/basic/Cargo.toml
Normal file
10
tests/openvm/basic/Cargo.toml
Normal file
@@ -0,0 +1,10 @@
|
||||
[package]
|
||||
name = "ere-test-openvm-guest"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
[workspace]
|
||||
|
||||
[dependencies]
|
||||
openvm = { git = "https://github.com/openvm-org/openvm.git", features = ["std"], tag = "v1.2.0" }
|
||||
test-utils = { path = "../../../crates/test-utils" }
|
||||
16
tests/openvm/basic/src/main.rs
Normal file
16
tests/openvm/basic/src/main.rs
Normal file
@@ -0,0 +1,16 @@
|
||||
use openvm::io::{read, read_vec, reveal_u32};
|
||||
use test_utils::guest::BasicStruct;
|
||||
|
||||
fn main() {
|
||||
// Read `Hello world` bytes.
|
||||
let bytes = read_vec();
|
||||
assert_eq!(String::from_utf8_lossy(&bytes), "Hello world");
|
||||
|
||||
// Read `BasicStruct`.
|
||||
let basic_struct = read::<BasicStruct>();
|
||||
let output = basic_struct.output();
|
||||
|
||||
output.chunks(4).enumerate().for_each(|(idx, bytes)| {
|
||||
reveal_u32(u32::from_le_bytes(bytes.try_into().unwrap()), idx);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user