Mercurial > repos > public > sbplib_julia
comparison test/runtests.jl @ 2057:8a2a0d678d6f feature/lazy_tensors/pretty_printing
Merge default
| author | Jonatan Werpers <jonatan@werpers.com> |
|---|---|
| date | Tue, 10 Feb 2026 22:41:19 +0100 |
| parents | 07315bc72b31 |
| children |
comparison
equal
deleted
inserted
replaced
| 1110:c0bff9f6e0fb | 2057:8a2a0d678d6f |
|---|---|
| 1 using Diffinitive | |
| 1 using Test | 2 using Test |
| 3 using JET | |
| 4 using Aqua | |
| 2 using Glob | 5 using Glob |
| 3 | 6 |
| 4 """ | 7 """ |
| 5 run_testfiles() | 8 run_testfiles() |
| 6 run_testfiles(path, globs) | 9 run_testfiles(path, globs) |
| 16 end | 19 end |
| 17 | 20 |
| 18 run_testfiles(".", globs) | 21 run_testfiles(".", globs) |
| 19 end | 22 end |
| 20 | 23 |
| 21 function run_testfiles(path, globs) | 24 function run_testfiles(path, globs) |
| 22 for name ∈ readdir(path) | 25 for name ∈ readdir(path) |
| 23 filepath = joinpath(path, name) | 26 filepath = joinpath(path, name) |
| 24 | 27 |
| 25 if isdir(filepath) | 28 if isdir(filepath) |
| 26 @testset "$name" begin | 29 @testset "$name" begin |
| 27 run_testfiles(filepath, globs) | 30 run_testfiles(filepath, globs) |
| 28 end | 31 end |
| 29 end | 32 end |
| 30 | 33 |
| 31 if endswith(name, "_test.jl") && any(occursin.(globs, filepath)) | 34 if endswith(name, "_test.jl") && any(occursin.(globs, filepath)) |
| 32 printstyled("Running "; bold=true, color=:green) | 35 log_and_time(filepath) do |
| 33 print(filepath) | 36 @testset "$name" begin |
| 34 | 37 include(filepath) |
| 35 t_start = time() | 38 end |
| 36 @testset "$name" begin | |
| 37 include(filepath) | |
| 38 end | 39 end |
| 39 t_end = time() | |
| 40 | |
| 41 Δt = t_end - t_start | |
| 42 printstyled(" ($(round(Δt, digits=2)) s)"; color=:light_black) | |
| 43 println() | |
| 44 end | 40 end |
| 45 end | 41 end |
| 46 end | 42 end |
| 47 | 43 |
| 48 testsetname = isempty(ARGS) ? "Sbplib.jl" : "["*join(ARGS, ", ")*"]" | 44 function log_and_time(f, msg) |
| 45 printstyled("Running "; bold=true, color=:green) | |
| 46 print(msg) | |
| 47 | |
| 48 t_start = time() | |
| 49 f() | |
| 50 t_end = time() | |
| 51 Δt = t_end - t_start | |
| 52 printstyled(" ($(round(Δt, digits=2)) s)"; color=:light_black) | |
| 53 println() | |
| 54 end | |
| 55 | |
| 56 testsetname = isempty(ARGS) ? "Diffinitive.jl" : "["*join(ARGS, ", ")*"]" | |
| 49 | 57 |
| 50 @testset "$testsetname" begin | 58 @testset "$testsetname" begin |
| 59 if isempty(ARGS) | |
| 60 log_and_time("code quality tests using Aqua.jl") do | |
| 61 @testset "Code quality (Aqua.jl)" begin | |
| 62 Aqua.test_all(Diffinitive) | |
| 63 end | |
| 64 end | |
| 65 | |
| 66 log_and_time("code linting using JET.jl") do | |
| 67 @testset "Code linting (JET.jl)" begin | |
| 68 JET.test_package(Diffinitive; target_modules = (Diffinitive,)) | |
| 69 end | |
| 70 end | |
| 71 end | |
| 72 | |
| 51 run_testfiles(ARGS) | 73 run_testfiles(ARGS) |
| 74 println() | |
| 52 end | 75 end |
