pub mod test_runner {
use std::sync::Arc;
#[derive(Debug, Clone)]
pub struct ClarityTestSession {
pub session_id: String,
}
impl ClarityTestSession {
pub fn new() -> Self {
Self {
session_id: format!("mock-session-{}", std::time::SystemTime::now().elapsed().unwrap_or_default().as_micros()),
}
}
pub fn execute_test<F>(&self, _test_fn: F) -> bool
where
F: FnOnce() -> bool
{
true }
}
}
pub mod types {
#[derive(Debug, Clone, PartialEq, Eq)]
pub struct Principal(pub String);
impl Principal {
pub fn new(address: &str) -> Self {
Self(address.to_string())
}
pub fn to_string(&self) -> String {
self.0.clone()
}
}
}
pub mod contract_helpers {
use super::types::Principal;
pub fn get_contract_principal(contract_name: &str) -> Principal {
Principal::new(&format!("ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.{}", contract_name))
}
}
pub mod macros {
#[macro_export]
macro_rules! clarity_test {
($name:ident, $body:expr) => {
#[test]
fn $name() {
let result = $body();
assert!(result);
}
};
}
}
pub mod client {
pub mod contracts {
use std::collections::HashMap;
#[derive(Debug)]
pub struct Contract {
name: String,
functions: HashMap<String, ContractFunction>,
}
#[derive(Debug)]
pub struct ContractFunction {
name: String,
}
impl Contract {
pub fn new(name: &str) -> Self {
Self {
name: name.to_string(),
functions: HashMap::new(),
}
}
pub fn call_fn<T>(&self, fn_name: &str, _args: Vec<T>) -> ContractResult {
ContractResult::success()
}
}
#[derive(Debug)]
pub struct ContractResult {
success: bool,
}
impl ContractResult {
pub fn success() -> Self {
Self { success: true }
}
pub fn is_ok(&self) -> bool {
self.success
}
}
}
}