Mercurial > repos > public > sbplib_julia
comparison test/runtests.jl @ 1877:21e5fe1545c0 refactor/lazy_tensors/elementwise_ops
Merge default
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Mon, 27 Jan 2025 16:56:04 +0100 |
parents | 6a56a853271d |
children |
comparison
equal
deleted
inserted
replaced
1840:cb3a8450ed44 | 1877:21e5fe1545c0 |
---|---|
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 |
42 end | |
43 | |
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() | |
46 end | 54 end |
47 | 55 |
48 testsetname = isempty(ARGS) ? "Diffinitive.jl" : "["*join(ARGS, ", ")*"]" | 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_defined_modules = true) | |
69 end | |
70 end | |
71 end | |
72 | |
51 run_testfiles(ARGS) | 73 run_testfiles(ARGS) |
52 println() | 74 println() |
53 end | 75 end |