Entropy Monitors.Test

loom-sprint-scaffoldtesttypescript
Path: loom-sprint-scaffold/loom/tests/synthesis/entropy-monitors.test.tsRelative: loom/tests/synthesis/entropy-monitors.test.tsSubproject: loom-sprint-scaffoldCategory: tests
Lines: 191Bytes: 6,905Imports: 4Exports: 0has tests

Content Preview

  1. /**
  2. * Tests for H5.4 — Entropy Monitors.
  3. *
  4. * Proves:
  5. * - Shannon entropy computed correctly with natural log (hand-computed values)
  6. * - sliceEntropyWindows groups events into sliding windows correctly
  7. * - analyzeEntropy flags windows below thresholds
  8. * - Empty input → no flags
  9. * - High-entropy input → no flags
  10. * - Low-entropy input → flags fire
  11. */
  12. import { describe, expect, test } from "bun:test";
  13. import {
  14. shannonEntropy,
  15. sliceEntropyWindows,
  16. analyzeEntropy,
  17. runEnt