- Rust engine: real bootstrap/wiring preflight (guardrail-agent), execution layer (retry/router/pre-trade/post-trade/reconciliation), guardrail-doctor diagnostics with allowlist-drift guard. - guardrail-cli: extracted pure helpers into util.rs (split in progress). - 6 Track-2 skills + ensemble; python-lab analytics (regime/drawdown/montecarlo/dossier/ensemble/journal/seed); clients (ts/py/go/mcp/langchain/web-lite/proof-verifier); alert relay; scenarios; helm/k8s/compose; docs. - dashboard/vercel.json + docs/VERCEL_DEPLOY.md for Vercel deployment. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
44 lines
1.1 KiB
Rust
44 lines
1.1 KiB
Rust
//! Tests for chain identifiers and addresses.
|
|
|
|
use common::chain::{Address, ChainId};
|
|
|
|
#[test]
|
|
fn bsc_constant_is_chain_56_and_is_bsc() {
|
|
assert_eq!(ChainId::BSC.0, 56);
|
|
assert!(ChainId::BSC.is_bsc());
|
|
}
|
|
|
|
#[test]
|
|
fn non_bsc_chain_is_not_bsc() {
|
|
assert!(!ChainId(1).is_bsc());
|
|
}
|
|
|
|
#[test]
|
|
fn chain_id_display() {
|
|
assert_eq!(ChainId::BSC.to_string(), "56");
|
|
}
|
|
|
|
#[test]
|
|
fn address_looks_valid_for_42_char_0x_string() {
|
|
// "0x" + 40 hex chars = 42 chars total.
|
|
let addr = Address::new("0x55d398326f99059ff775485246999027b3197955");
|
|
assert_eq!(addr.0.len(), 42);
|
|
assert!(addr.looks_valid());
|
|
}
|
|
|
|
#[test]
|
|
fn address_looks_invalid_without_prefix_or_wrong_length() {
|
|
// Wrong length (too short).
|
|
assert!(!Address::new("0x1234").looks_valid());
|
|
// Missing 0x prefix but correct length.
|
|
assert!(!Address::new("55d398326f99059ff775485246999027b31979551x").looks_valid());
|
|
// Empty.
|
|
assert!(!Address::new("").looks_valid());
|
|
}
|
|
|
|
#[test]
|
|
fn address_display() {
|
|
let addr = Address::new("0xabc");
|
|
assert_eq!(addr.to_string(), "0xabc");
|
|
}
|