import XCTest
@testable import Physarum
import PhysarumEngine
final class ParamRegistryTests: XCTestCase {
private func sample() -> PresetParams { PresetCatalog.fallbackPreset.params }
func testEveryDescriptorRoundTrips() {
var p = sample()
for d in ParamRegistry.all {
let mid = (d.range.lowerBound + d.range.upperBound) / 2
d.set(&p, mid)
let got = d.get(p)
if d.isInt {
XCTAssertEqual(got, mid.rounded(), accuracy: 0.5, "\(d.idKey) int roundtrip")
} else {
XCTAssertEqual(got, mid, accuracy: 1e-4, "\(d.idKey) roundtrip")
}
}
}
func testRegistryCoversExpectedCount() {
// 3 global scalars + 6×3 species + 9 matrix + 4 pheromone + 3 dynamics + 8 effects = 45
XCTAssertEqual(ParamRegistry.all.count, 45)
XCTAssertFalse(ParamRegistry.respawnIDs.isEmpty)
}
func testRangesNonEmpty() {
for d in ParamRegistry.all {
XCTAssertLessThan(d.range.lowerBound, d.range.upperBound, "\(d.idKey)")
}
}
}