1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
//! *Feature flag: `ensemble`*
//! Configurable integration testing harness.

#[cfg(not(target_arch = "wasm32"))]
mod bank;
#[cfg(not(target_arch = "wasm32"))]
mod ensemble;
#[cfg(not(target_arch = "wasm32"))]
mod env;
#[cfg(not(target_arch = "wasm32"))]
mod querier;
#[cfg(not(target_arch = "wasm32"))]
mod revertable;
#[cfg(not(target_arch = "wasm32"))]
mod storage;
#[cfg(not(target_arch = "wasm32"))]
mod block;
#[cfg(not(target_arch = "wasm32"))]
mod response;

#[cfg(all(test, not(target_arch = "wasm32")))]
mod tests;
#[cfg(not(target_arch = "wasm32"))]
pub use ensemble::*;
#[cfg(not(target_arch = "wasm32"))]
pub use env::*;
#[cfg(not(target_arch = "wasm32"))]
pub use querier::*;
#[cfg(not(target_arch = "wasm32"))]
pub use block::Block;
#[cfg(not(target_arch = "wasm32"))]
pub use response::*;

/// Implement ContractHarness for the harness struct.
/// Use this to enable Fadroma Ensemble for a contract.
#[macro_export]
macro_rules! impl_contract_harness_default {
    ($name:ident, $contract:ident) => {
        impl ContractHarness for $name {
            fn init(&self, deps: &mut MockDeps, env: Env, msg: Binary) -> StdResult<InitResponse> {
                $contract::init(deps, env, from_binary(&msg)?, $contract::DefaultImpl)
            }
            fn handle(
                &self,
                deps: &mut MockDeps,
                env: Env,
                msg: Binary,
            ) -> StdResult<HandleResponse> {
                $contract::handle(deps, env, from_binary(&msg)?, $contract::DefaultImpl)
            }
            fn query(&self, deps: &MockDeps, msg: Binary) -> StdResult<Binary> {
                $contract::query(deps, from_binary(&msg)?, $contract::DefaultImpl)
            }
        }
    };
}