Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 29 additions & 16 deletions test/unit_tests/unit_tests.jl
Original file line number Diff line number Diff line change
@@ -1,21 +1,34 @@
using Test, SafeTestsets

@safetestset "Multithreading" begin
include("multithreading.jl")
end

@safetestset "Matrix algebra helper functions" begin
include("matrix_helpers.jl")
end
# Define available test sets
available_tests = Dict(
"multithreading" => "Multithreading",
"matrix_helpers" => "Matrix algebra helper functions",
"data_input_formats" => "SemObserved",
"specification" => "SemSpecification",
"model" => "Sem model"
)

@safetestset "SemObserved" begin
include("data_input_formats.jl")
end

@safetestset "SemSpecification" begin
include("specification.jl")
end
# Determine which tests to run based on command-line arguments
selected_tests = isempty(ARGS) ? collect(keys(available_tests)) : ARGS

@safetestset "Sem model" begin
include("model.jl")
@testset "All Tests" begin
for file in selected_tests
if haskey(available_tests, file)
let file_ = file, test_name = available_tests[file]
# Compute the literal values
test_sym = Symbol(file_)
file_jl = file_ * ".jl"
# Build the expression with no free variables:
ex = quote
@safetestset $(Symbol(test_sym)) = $test_name begin
include($file_jl)
end
end
eval(ex)
end
else
@warn "Test file '$file' not found in available tests. Skipping."
end
end
end
10 changes: 10 additions & 0 deletions test/unit_tests/unit_tests_interactive.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# requires: TestEnv to be installed globally, and the StructuralEquationModels package `]dev`ed
# example: julia test/unit_tests/unit_tests_interactive.jl matrix_helpers

try
import TestEnv
TestEnv.activate("StructuralEquationModels")
catch e
@warn "Error initializing Test Env" exception=(e, catch_backtrace())
end
include("unit_tests.jl")
Loading