From 4f36f89618336ac2d160b3a9b3e2e34d0f61a0bb Mon Sep 17 00:00:00 2001 From: Fredrik Ekre Date: Thu, 28 Jul 2022 02:23:09 +0200 Subject: [PATCH] Add LibHYPRE.VERSION. --- src/LibHYPRE.jl | 8 ++++++++ test/runtests.jl | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/src/LibHYPRE.jl b/src/LibHYPRE.jl index 9f424b1..0381ff9 100644 --- a/src/LibHYPRE.jl +++ b/src/LibHYPRE.jl @@ -86,4 +86,12 @@ for name in names(@__MODULE__; all=true) end end +function __init__() + major_ref = Ref{HYPRE_Int}(-1) + minor_ref = Ref{HYPRE_Int}(-1) + patch_ref = Ref{HYPRE_Int}(-1) + @check HYPRE_VersionNumber(major_ref, minor_ref, patch_ref, C_NULL) + global VERSION = VersionNumber(major_ref[], minor_ref[], patch_ref[]) +end + end diff --git a/test/runtests.jl b/test/runtests.jl index 1d7ae4a..179cc5e 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -13,6 +13,11 @@ using Test # Init HYPRE and MPI HYPRE.Init() +@testset "LibHYPRE" begin + @test LibHYPRE.VERSION > VERSION # :) + @test LibHYPRE.VERSION.major == 2 +end + @testset "HYPREMatrix" begin H = HYPREMatrix(MPI.COMM_WORLD, 1, 5) @test H.ijmatrix != HYPRE_IJMatrix(C_NULL)