Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added functions in the primitive interface #450

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add set_slot_time and unit test
  • Loading branch information
limemloh committed Sep 26, 2024
commit 28ce9c4020e5b6311d136f319c5ffd30373558f1
19 changes: 19 additions & 0 deletions concordium-std/src/prims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -288,6 +288,10 @@ extern "C" {
column: u32,
);

/// TODO
#[cfg(all(feature = "wasm-test", target_arch = "wasm32"))]
pub(crate) fn set_slot_time(slot_time: u64);

#[cfg(feature = "debug")]
/// Emit text together with the source location.
/// This is used as the equivalent of the `dbg!` macro when the
Expand Down Expand Up @@ -513,3 +517,18 @@ mod host_dummy_functions {
unimplemented!("Dummy function! Not to be executed")
}
}

#[cfg(feature = "internal-wasm-test")]
mod wasm_test {
use super::*;
use crate::{claim_eq, concordium_test};

#[concordium_test]
fn test() {
let slot_time = unsafe {
set_slot_time(10);
get_slot_time()
};
claim_eq!(slot_time, 10)
}
}