Skip to content
Snippets Groups Projects
Commit 8662d22a authored by florian's avatar florian
Browse files

ENH: Introduce ccaosdb version function and use in test

parent 80774a9a
No related branches found
No related tags found
1 merge request!12F release results
...@@ -29,7 +29,7 @@ export evaluate_return_code, ...@@ -29,7 +29,7 @@ export evaluate_return_code,
CaosDBException, ClientException, GenericCaosDBException, CaosDBMessage CaosDBException, ClientException, GenericCaosDBException, CaosDBMessage
# Exports from module Utility # Exports from module Utility
export get_env_fallback export get_ccaosdb_version, get_env_fallback
# Export from module Connection # Export from module Connection
export connect, connect_manually export connect, connect_manually
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
# #
module Utility module Utility
export get_env_fallback export get_ccaosdb_version, get_env_fallback
using ..CaosDB using ..CaosDB
...@@ -47,4 +47,22 @@ function get_env_fallback(var::AbstractString, default::AbstractString = "") ...@@ -47,4 +47,22 @@ function get_env_fallback(var::AbstractString, default::AbstractString = "")
end end
"""
function get_ccaosdb_version()
Return the version of the CaosDB C interface that is used by
CaosDB.jl.
"""
function get_ccaosdb_version()
major =
ccall((:caosdb_constants_LIBCAOSDB_VERSION_MAJOR, CaosDB.library_name), Cint, ())
minor =
ccall((:caosdb_constants_LIBCAOSDB_VERSION_MINOR, CaosDB.library_name), Cint, ())
patch =
ccall((:caosdb_constants_LIBCAOSDB_VERSION_PATCH, CaosDB.library_name), Cint, ())
return VersionNumber("$major.$minor.$patch")
end
end # Utility end # Utility
...@@ -25,21 +25,7 @@ using CaosDB ...@@ -25,21 +25,7 @@ using CaosDB
@testset "CaosDBUnitTests" begin @testset "CaosDBUnitTests" begin
@testset "TestCaosdbCppLibVersion" begin @testset "TestCaosdbCppLibVersion" begin
@test ccall( @test CaosDB.Utility.get_ccaosdb_version() >= v"0.0.16"
(:caosdb_constants_LIBCAOSDB_VERSION_MAJOR, CaosDB.library_name),
Cint,
()
) == 0
@test ccall(
(:caosdb_constants_LIBCAOSDB_VERSION_MINOR, CaosDB.library_name),
Cint,
()
) == 0
@test ccall(
(:caosdb_constants_LIBCAOSDB_VERSION_PATCH, CaosDB.library_name),
Cint,
()
) == 16
end end
@testset "TestUtility" begin @testset "TestUtility" begin
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment