@@ -689,3 +689,56 @@ test "insula — InternalState activity threshold" {
689689 state .action_rate = 0.05 ; // Exactly at threshold
690690 try std .testing .expect (state .isHealthyActivity ());
691691}
692+
693+ // ═══════════════════════════════════════════════════════════════════════════════
694+ // REAL function tests
695+ // ═══════════════════════════════════════════════════════════════════════════════
696+
697+ test "insula — measureState returns valid state" {
698+ const start = std .time .nanoTimestamp ();
699+ const state = try measureState (std .testing .allocator , start );
700+ // Should have non-zero latency at minimum
701+ try std .testing .expect (state .cycle_latency_us > 0 );
702+ }
703+
704+ test "insula — measureState has timing data" {
705+ const start = std .time .nanoTimestamp ();
706+ const state = try measureState (std .testing .allocator , start );
707+ // Timing fields should be populated
708+ _ = state .thalamus_latency_us ;
709+ _ = state .dlpfc_decision_us ;
710+ }
711+
712+ test "insula — health returns valid CellHealth" {
713+ const h = health ();
714+ try std .testing .expect (h .last_check > 0 );
715+ try std .testing .expectEqual (@as (u32 , 0 ), h .cycle );
716+ }
717+
718+ test "insula — CellHealth status enum" {
719+ const h = health ();
720+ switch (h .status ) {
721+ .healthy , .weak , .broken = > {},
722+ }
723+ }
724+
725+ test "insula — TimingSnapshot measures latencies" {
726+ const snap = TimingSnapshot .init ();
727+ snap .markThalamus ();
728+ snap .markDlpfc ();
729+
730+ const cycle_us = snap .cycleLatencyUs ();
731+ const thalamus_us = snap .thalamusLatencyUs ();
732+ const dlpfc_us = snap .dlpfcLatencyUs ();
733+
734+ try std .testing .expect (cycle_us > 0 );
735+ try std .testing .expect (thalamus_us > 0 );
736+ try std .testing .expect (dlpfc_us > 0 );
737+ }
738+
739+ test "insula — TimingSnapshot initTest creates test data" {
740+ const snap = TimingSnapshot .initTest ();
741+ try std .testing .expectEqual (@as (u64 , 1000 ), snap .cycle_latency_us );
742+ try std .testing .expectEqual (@as (u64 , 100 ), snap .thalamus_latency_us );
743+ try std .testing .expectEqual (@as (u64 , 200 ), snap .dlpfc_latency_us );
744+ }
0 commit comments