Move 17 library crates into crates/, CLI binary into bin/fxt, consolidate 10 test crates into testing/, split config crate from deployment config files. Root directory reduced from 38+ to ~17 directories. All Cargo.toml paths and build.rs proto refs updated. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
41 lines
1.4 KiB
Rust
41 lines
1.4 KiB
Rust
//! Property-based tests using proptest for Foxhunt HFT system.
|
|
|
|
use proptest::prelude::*;
|
|
// CANONICAL TYPE IMPORTS - Use types::prelude::Decimal
|
|
|
|
proptest! {
|
|
#[test]
|
|
fn test_decimal_arithmetic_properties(
|
|
a in any::<i64>().prop_map(Decimal::from),
|
|
b in any::<i64>().prop_map(Decimal::from)
|
|
) {
|
|
// Test commutative property of addition
|
|
prop_assert_eq!(a + b, b + a);
|
|
|
|
// Test associative property (simplified)
|
|
if let (Some(sum1), Some(sum2)) = (a.checked_add(b), b.checked_add(a)) {
|
|
prop_assert_eq!(sum1, sum2);
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn test_price_calculations(price in 1i64..1000000i64) {
|
|
let decimal_price = Decimal::from(price);
|
|
|
|
// Price should always be positive in our domain
|
|
prop_assert!(decimal_price > Decimal::ZERO);
|
|
|
|
// Price with commission should be higher
|
|
let commission = Decimal::from(10); // 10 basis points
|
|
let with_commission = decimal_price + (decimal_price * commission / Decimal::from(10000));
|
|
prop_assert!(with_commission > decimal_price);
|
|
}
|
|
|
|
#[test]
|
|
fn test_uuid_generation(seed in any::<u128>()) {
|
|
// Test that UUIDs are unique (simplified test)
|
|
let uuid1 = uuid::Uuid::new_v4();
|
|
let uuid2 = uuid::Uuid::new_v4();
|
|
prop_assert_ne!(uuid1, uuid2);
|
|
}
|
|
} |