From 769f86237a022572ff305b07deab22359b971dbe Mon Sep 17 00:00:00 2001 From: nathanemac <91251698+nathanemac@users.noreply.github.com> Date: Fri, 13 Sep 2024 15:03:09 -0400 Subject: [PATCH] add tests and CI --- Project.toml | 17 ++++++++++++----- test/Project.toml | 2 ++ test/runtests.jl | 16 +++++++++++++++- 3 files changed, 29 insertions(+), 6 deletions(-) diff --git a/Project.toml b/Project.toml index 1ef7933..ba6f75f 100644 --- a/Project.toml +++ b/Project.toml @@ -3,11 +3,18 @@ uuid = "925ea013-038b-5ab6-a1ab-e0849925e528" authors = ["Nathan Allaire and contributors"] version = "0.1.0" -[compat] -julia = "1.9" - [deps] -OpenBLAS32_jll = "656ef2d0-ae68-5445-9ca0-591084a874a2" +JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899" LAPACK_jll = "51474c39-65e3-53ba-86ba-03b1b862ec14" -proxTV_jll = "700117f8-5dbb-54dd-9908-6f3eb0e21f87" LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +OpenBLAS32_jll = "656ef2d0-ae68-5445-9ca0-591084a874a2" +proxTV_jll = "700117f8-5dbb-54dd-9908-6f3eb0e21f87" + +[compat] +julia = "1.9" + +[extras] +Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" + +[targets] +test = ["Test"] diff --git a/test/Project.toml b/test/Project.toml index 0c36332..f5cb6bf 100644 --- a/test/Project.toml +++ b/test/Project.toml @@ -1,2 +1,4 @@ [deps] Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" +LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" +JuliaFormatter = "98e50ef6-434e-11e9-1051-2b60c6c9e899" diff --git a/test/runtests.jl b/test/runtests.jl index 0f6deda..966c19d 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -1,6 +1,20 @@ using ProxTV using Test +using LinearAlgebra @testset "ProxTV.jl" begin - @test ProxTV.hello_world() == "Hello, World!" + # test on a basic function : + n = 4 + x = rand(n) + p = 2.0 + @test isapprox(ProxTV.LPnorm(x, n, p), norm(x), atol = 1e-5) + + # test on a more advanced function : + lambda = 0.18 + info = [] + y = rand(n) + x = zeros(n) + ws = ProxTV.newWorkspace(n) + @test ProxTV.TV(y, lambda, x, info, n, p, ws) == 1 # 1 is the expected return value of the function + end