Use test-utils for all zkvms (#88)

This commit is contained in:
Han
2025-08-15 09:34:24 +08:00
committed by GitHub
parent a0a29cbb7d
commit bf6d94f32a
48 changed files with 374 additions and 706 deletions

View 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" }

View 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);
});
}