diff --git a/src/komet/kdist/soroban-semantics/host/ledger.md b/src/komet/kdist/soroban-semantics/host/ledger.md index 7f138bc..c22cca8 100644 --- a/src/komet/kdist/soroban-semantics/host/ledger.md +++ b/src/komet/kdist/soroban-semantics/host/ledger.md @@ -31,7 +31,7 @@ module HOST-LEDGER putContractData(#instance) => toSmall(Void) ... KEY : VAL : S => S CONTRACT - + CONTRACT STORAGE => STORAGE [ KEY <- VAL ] ... @@ -71,7 +71,7 @@ module HOST-LEDGER KEY : S => S CONTRACT - + CONTRACT STORAGE ... @@ -112,7 +112,7 @@ module HOST-LEDGER KEY : S => S CONTRACT - + CONTRACT ... KEY |-> VAL ... ... @@ -151,7 +151,7 @@ module HOST-LEDGER delContractData(#instance) => toSmall(Void) ... KEY : S => S CONTRACT - + CONTRACT MAP => MAP [ KEY <- undef ] ... diff --git a/src/tests/integration/data/soroban/contracts/test_containers/Cargo.toml b/src/tests/integration/data/soroban/contracts/test_containers/Cargo.toml new file mode 100644 index 0000000..24d1c9f --- /dev/null +++ b/src/tests/integration/data/soroban/contracts/test_containers/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "test_containers" +version = "0.0.0" +edition = "2021" +publish = false + +[lib] +crate-type = ["cdylib"] +doctest = false + +[dependencies] +soroban-sdk = { workspace = true } + +[dev-dependencies] +soroban-sdk = { workspace = true, features = ["testutils"] } diff --git a/src/tests/integration/data/soroban/contracts/test_containers/src/lib.rs b/src/tests/integration/data/soroban/contracts/test_containers/src/lib.rs new file mode 100644 index 0000000..4d1e6ab --- /dev/null +++ b/src/tests/integration/data/soroban/contracts/test_containers/src/lib.rs @@ -0,0 +1,29 @@ +#![no_std] +use soroban_sdk::{contract, contractimpl, Env, Vec}; + +#[contract] +pub struct ContainersContract; + +#[contractimpl] +impl ContainersContract { + + pub fn test_vector(env: Env, n: u32) -> bool { + let n = n % 100; + + let mut vec: Vec = Vec::new(&env); + assert_eq!(vec.len(), 0); + + for i in 0..n { + vec.push_back(i); + } + + assert_eq!(vec.len(), n); + + for i in 0..n { + assert_eq!(vec.get_unchecked(i), i); + } + + true + } + +}