import Foundation
@testable import PhysarumEngine
/// Shared test data. A minimal-but-complete preset is kept inline so the sim /
/// render tests don't depend on the committed preset files (those are validated
/// separately in PresetCodableTests).
enum TestFixtures {
static let minimalPresetJSON = """
{"id":"t","name":"Test","builtIn":true,"tags":[],"tagSignal":"neural-bleed","params":{
"agentCount":1000,"spawnPattern":"random",
"species":[{"color":[0.9,0.6,0.2],"populationShare":1,"sensorAngle":0.5,"sensorDistance":9,"turnSpeed":0.3,"moveSpeed":1.5,"depositAmount":1},
{"color":[0,0,0],"populationShare":0,"sensorAngle":0,"sensorDistance":1,"turnSpeed":0,"moveSpeed":0,"depositAmount":0},
{"color":[0,0,0],"populationShare":0,"sensorAngle":0,"sensorDistance":1,"turnSpeed":0,"moveSpeed":0,"depositAmount":0}],
"interactionMatrix":[[1,0,0],[0,1,0],[0,0,1]],
"decayRate":0.95,"diffusionFreq":1,"fadeStrength":0,"trailSaturation":100,
"chaosInterval":0,"chaosStrength":0,"rhythmAmplitude":0,"simSpeed":1,
"backgroundColor":[0,0,0],"blendMode":"additive","exposure":1,"headIntensity":0,"kaleidoscope":0,
"feedbackAmount":0,"bloomThreshold":1,"bloomIntensity":1,"vignette":0,"saturation":1,"contrast":1,
"audioReactive":{"enabled":false,"gain":1,"autoGain":false,"routes":[]}}}
"""
static func minimalPreset() throws -> Preset {
try JSONDecoder().decode(Preset.self, from: Data(minimalPresetJSON.utf8))
}
/// Path to the committed canonical preset set (apple/presets), resolved from
/// this source file. Returns nil if the layout doesn't match (e.g. SwiftPM
/// copied sources elsewhere) so callers can XCTSkip gracefully.
static func committedPresetsDir() -> URL? {
let dir = URL(fileURLWithPath: #filePath)
.deletingLastPathComponent() // PhysarumEngineTests/
.deletingLastPathComponent() // Tests/
.deletingLastPathComponent() // PhysarumEngine/
.deletingLastPathComponent() // apple/
.appendingPathComponent("presets")
return FileManager.default.fileExists(atPath: dir.path) ? dir : nil
}
}