""" Integration test for TinyConfessionalLayer with Windsurf Cascade. """ import torch import torch.nn as nn from components.tiny_confessional_layer import TinyConfessionalLayer def test_integration(): print("Testing TinyConfessionalLayer with Windsurf Cascade...") # Create a test instance model = TinyConfessionalLayer( d_model=64, enable_windsurf=True, max_opt_rate=0.1, reflection_pause_prob=0.1 ) # Create test input batch_size = 2 seq_len = 10 x = torch.randn(batch_size, seq_len, 64) # Run forward pass print("Running forward pass...") output, metadata = model(x, audit_mode=True) # Check output shapes assert output.shape == (batch_size, seq_len, 64), "Output shape mismatch" # Check metadata assert 'windsurf_phase' in metadata, "Missing windsurf_phase in metadata" assert 'reflection_count' in metadata, "Missing reflection_count in metadata" print("\nTest passed!") print("Output shape:", output.shape) print("Phase:", metadata.get('windsurf_phase', 'N/A')) print("Reflection count:", metadata.get('reflection_count', 0)) if __name__ == "__main__": test_integration()