mirror of
https://github.com/ruvnet/RuVector.git
synced 2026-05-26 07:44:05 +00:00
Root-level `cargo fmt --all` doesn't recurse into nested workspaces
(crates/rvf/, examples/onnx-embeddings/, examples/data/, …), but
CI's `cargo fmt --all -- --check` was failing on files inside them
(e.g. crates/rvf/rvf-wire/src/hash.rs).
Ran `cargo fmt --all` inside each nested workspace. Mechanical-only
whitespace, no semantic change.
Touched nested workspaces:
crates/rvf/*
examples/onnx-embeddings/*
examples/data/*
examples/mincut/*
examples/exo-ai-2025/*
examples/prime-radiant/*
examples/rvf/*
examples/ultra-low-latency-sim/*
examples/edge/*
examples/vibecast-7sense/*
examples/onnx-embeddings-wasm/*
Combined with previous commit (96d8fdc17), the full workspace tree
should now pass `cargo fmt --all -- --check` in CI.
Co-Authored-By: claude-flow <ruv@ruv.net>
89 lines
2.8 KiB
Rust
89 lines
2.8 KiB
Rust
//! Test library for 7sense bioacoustics platform integration tests
|
|
//!
|
|
//! This library provides test fixtures, mocks, and integration tests for
|
|
//! all six bounded contexts of the 7sense system:
|
|
//!
|
|
//! - **Audio Ingestion Context**: Audio file loading, resampling, segmentation
|
|
//! - **Embedding Context**: Perch 2.0 model integration, vector generation
|
|
//! - **Vector Space Context**: HNSW index operations, k-NN search
|
|
//! - **Analysis Context**: HDBSCAN clustering, motif detection, entropy
|
|
//! - **Interpretation Context**: RAB evidence packs, citation validation
|
|
//! - **API Context**: REST endpoints, GraphQL, rate limiting
|
|
//!
|
|
//! ## Test Organization
|
|
//!
|
|
//! - `fixtures/` - Test data factories and builders
|
|
//! - `mocks/` - Mock implementations of repositories and services
|
|
//! - `integration/` - Integration tests organized by bounded context
|
|
//!
|
|
//! ## Usage
|
|
//!
|
|
//! Run all tests with:
|
|
//! ```bash
|
|
//! cargo test -p vibecast-tests
|
|
//! ```
|
|
//!
|
|
//! Run specific context tests:
|
|
//! ```bash
|
|
//! cargo test -p vibecast-tests --test audio_test
|
|
//! cargo test -p vibecast-tests --test vector_test
|
|
//! ```
|
|
|
|
pub mod fixtures;
|
|
pub mod integration;
|
|
pub mod mocks;
|
|
|
|
// Re-export commonly used types for convenience
|
|
pub use fixtures::*;
|
|
pub use integration::{IntegrationTestContext, TestConfig};
|
|
pub use mocks::*;
|
|
|
|
/// Version of the test suite
|
|
pub const TEST_VERSION: &str = env!("CARGO_PKG_VERSION");
|
|
|
|
/// Target recall@10 for HNSW index tests (from ADR requirements)
|
|
pub const TARGET_RECALL_AT_10: f32 = 0.95;
|
|
|
|
/// Perch 2.0 embedding dimensions
|
|
pub const PERCH_EMBEDDING_DIMS: usize = 1536;
|
|
|
|
/// Required sample rate for audio processing
|
|
pub const REQUIRED_SAMPLE_RATE: u32 = 32000;
|
|
|
|
/// Mel spectrogram dimensions (frames x mel bins)
|
|
pub const MEL_FRAMES: usize = 500;
|
|
pub const MEL_BINS: usize = 128;
|
|
|
|
/// HNSW default parameters
|
|
pub const HNSW_M: usize = 16;
|
|
pub const HNSW_EF_CONSTRUCTION: usize = 200;
|
|
pub const HNSW_EF_SEARCH: usize = 100;
|
|
|
|
#[cfg(test)]
|
|
mod tests {
|
|
use super::*;
|
|
|
|
#[test]
|
|
fn test_constants_match_requirements() {
|
|
// Verify test constants match ADR requirements
|
|
assert_eq!(
|
|
PERCH_EMBEDDING_DIMS, 1536,
|
|
"Perch 2.0 uses 1536-D embeddings"
|
|
);
|
|
assert_eq!(
|
|
REQUIRED_SAMPLE_RATE, 32000,
|
|
"Perch 2.0 requires 32kHz audio"
|
|
);
|
|
assert_eq!(MEL_FRAMES, 500, "Spectrogram should have 500 frames");
|
|
assert_eq!(MEL_BINS, 128, "Spectrogram should have 128 mel bins");
|
|
assert!(TARGET_RECALL_AT_10 >= 0.95, "Recall@10 must be >= 0.95");
|
|
}
|
|
|
|
#[test]
|
|
fn test_hnsw_params_match_defaults() {
|
|
let config = HnswConfig::default();
|
|
assert_eq!(config.m, HNSW_M);
|
|
assert_eq!(config.ef_construction, HNSW_EF_CONSTRUCTION);
|
|
assert_eq!(config.ef_search, HNSW_EF_SEARCH);
|
|
}
|
|
}
|