Skip to main content

nym_node_tester_utils/
lib.rs

1// Copyright 2023 - Nym Technologies SA <contact@nymtech.net>
2// SPDX-License-Identifier: Apache-2.0
3
4pub mod error;
5pub mod message;
6pub mod node;
7pub mod processor;
8pub mod receiver;
9pub mod tester;
10
11pub use message::{Empty, TestMessage};
12pub use nym_sphinx::{
13    chunking::fragment::FragmentIdentifier, params::PacketSize, preparer::PreparedFragment,
14};
15pub use tester::NodeTester;
16
17// it feels wrong to redefine it, but I don't want to import the whole of contract commons just for this one type
18pub(crate) type NodeId = u32;
19
20#[macro_export]
21macro_rules! log_err {
22    ($($t:tt)*) => {{
23        #[cfg(target_arch = "wasm32")]
24        {::nym_wasm_utils::console_error!($($t)*)}
25
26        #[cfg(not(target_arch = "wasm32"))]
27        {::log::error!($($t)*)}
28    }};
29}
30
31#[macro_export]
32macro_rules! log_warn {
33    ($($t:tt)*) => {{
34        #[cfg(target_arch = "wasm32")]
35        {::nym_wasm_utils::console_warn!($($t)*)}
36
37        #[cfg(not(target_arch = "wasm32"))]
38        {::log::warn!($($t)*)}
39    }};
40}
41
42#[macro_export]
43macro_rules! log_info {
44    ($($t:tt)*) => {{
45        #[cfg(target_arch = "wasm32")]
46        {::nym_wasm_utils::console_log!($($t)*)}
47
48        #[cfg(not(target_arch = "wasm32"))]
49        {::log::info!($($t)*)}
50    }};
51}