Source
Synced / linked to GitHub for 1:1 mirror (2026-07-26).
Context
src/reference_lsm.jl has zero test coverage. The lazy initialization, dimension validation, and run_lsm_step function are completely untested.
Untested code paths
_init_ref_lsm!() — GPU initialization with custom dims
_ref_is_initialized() — boolean flag check
run_lsm_step() — lazy init, dimension validation, reservoir dynamics
run_lsm_step_str() — string output format
DimensionMismatch guard for wrong input length
Tests to add (test/runtests.jl)
@testset "Reference LSM" begin
if LiquidCortex._cuda_available[]
@testset "Lazy initialization" begin
# Reset state
LiquidCortex._ref_initialized[] = false
LiquidCortex._ref_W[] = nothing
@test !LiquidCortex._ref_is_initialized()
# First call triggers init
input = zeros(Float32, 16)
output = LiquidCortex.run_lsm_step(input, 0.5f0)
@test LiquidCortex._ref_is_initialized()
@test length(output) == 16
end
@testset "Custom dimensions" begin
LiquidCortex._ref_initialized[] = false
LiquidCortex._ref_W[] = nothing
input = zeros(Float32, 8)
output = LiquidCortex.run_lsm_step(input, 0.0f0; n_out=4)
@test length(output) == 4
@test LiquidCortex._ref_n_in[] == 8
@test LiquidCortex._ref_n_out[] == 4
end
@testset "Dimension validation" begin
LiquidCortex._ref_initialized[] = false
LiquidCortex._ref_W[] = nothing
# Init with 16 inputs
LiquidCortex.run_lsm_step(zeros(Float32, 16), 0.0f0)
# Try with wrong size
@test_throws DimensionMismatch LiquidCortex.run_lsm_step(zeros(Float32, 8), 0.0f0)
end
@testset "run_lsm_step_str" begin
output = LiquidCortex.run_lsm_step_str(zeros(Float32, 16), 0.0f0)
@test output isa String
@test occursin(",", output)
end
else
@info "Skipping reference LSM tests — no CUDA device"
@test_skip "Reference LSM GPU tests skipped"
end
end
Acceptance criteria
Labels
testing, good first issue
Source
Synced / linked to GitHub for 1:1 mirror (2026-07-26).
Limen-Neural/LiquidCortex.jlGH#22Context
src/reference_lsm.jlhas zero test coverage. The lazy initialization, dimension validation, andrun_lsm_stepfunction are completely untested.Untested code paths
_init_ref_lsm!()— GPU initialization with custom dims_ref_is_initialized()— boolean flag checkrun_lsm_step()— lazy init, dimension validation, reservoir dynamicsrun_lsm_step_str()— string output formatDimensionMismatchguard for wrong input lengthTests to add (
test/runtests.jl)Acceptance criteria
Labels
testing,good first issue