[TSM.ID].[11031972] 3Z: Fix 10 violations — command-center REAL, add tests, rm unwrap, rm hardcoded IP

- FIX #1: xcu-command-center — KOSONG -> REAL (CommandCenter + PriorityQueue + 3 tests)
- FIX #2: xcu-tesseract — remove unwrap() -> pattern match
- FIX #3: xcu-omni — hardcoded 0.0.0.0 -> bind_addr param
- FIX #4: xcu-billing-matrix — add deny(warnings), env var bind
- FIX #5: xcu-garbage-collector — add 3 unit tests (alloc/collect/promote)
- FIX #6: xcu-memory-pool — add 3 unit tests (alloc/dealloc/double-free/exhaust)
- FIX #7: xcu-neural-chat — env var bind address
- FIX #8: xcu-quic — add REAL QUIC VarInt + packet parser + 3 tests
- FIX #9: xcu-sfu-a — add 3 unit tests (dominant speaker/core assign/svc)
- FIX #10: xcu-wasm-sdk — add utility fn + 3 tests
This commit is contained in:
TSM.ID
2026-05-25 13:27:01 +07:00
parent 1d2f6d8c23
commit df65fe0696
10 changed files with 382 additions and 7 deletions
+29
View File
@@ -14,3 +14,32 @@ pub mod moq;
pub use nexus::Nexus;
pub use router::Router;
pub use moq::MoqRelayer;
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn test_dominant_speaker() {
assert!(!Router::is_dominant_speaker(1, 30, false)); // not premium
assert!(Router::is_dominant_speaker(1, 30, true)); // premium + low vol
assert!(!Router::is_dominant_speaker(1, 80, true)); // premium but high vol
}
#[test]
fn test_coolest_core_assignment() {
let cores = vec![3, 1, 7];
let assigned = Router::assign_stream_to_coolest_core(&cores);
assert_eq!(assigned, 3); // first = coolest
let empty: Vec<usize> = vec![];
assert_eq!(Router::assign_stream_to_coolest_core(&empty), 0); // fallback
}
#[test]
fn test_route_stream_svc_filter() {
let r = Router::new(0);
// SVC spatial_id = (0xF0 >> 4) & 0x07 = 7, bandwidth_score=3 < 7 -> DROP
let packet = bytes::Bytes::from(vec![0xF0, 0x00, 0x01, 0x02]);
r.route_stream(packet, &["user1".into()], 3); // should drop (no panic)
}
}