From 66d4361c82ca246f5a3ff1c6bc5990b8eee94777 Mon Sep 17 00:00:00 2001 From: leandor Date: Sat, 5 Nov 2016 03:01:54 -0300 Subject: [PATCH] (#18) Added function to return the version string Added a VERSION_STRING() function that gives the version string in the standard format. --- src/papi/lz4/api.h | 6 ++++++ src/papi/lz4/api_detail.h | 1 + src/papi/lz4/init.cpp | 6 +++++- tests/papi/test_lz4.py | 1 + 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/papi/lz4/api.h b/src/papi/lz4/api.h index bc31a10..b7f96d2 100644 --- a/src/papi/lz4/api.h +++ b/src/papi/lz4/api.h @@ -2,6 +2,7 @@ #define __CINT_LZ4_API__ #pragma once +#include #include #include "module.h" #include "api_detail.h" @@ -35,6 +36,11 @@ namespace lz4 { namespace api { return _detail::VERSION_RELEASE; }; + constexpr auto VERSION_STRING() + { + return _detail::VERSION_STRING; + }; + /** Provides the maximum size that LZ4 compression may output in a "worst case" scenario (input data not compressible) This function is primarily useful for memory allocation purposes (destination buffer size). diff --git a/src/papi/lz4/api_detail.h b/src/papi/lz4/api_detail.h index b68f95a..dab64b4 100644 --- a/src/papi/lz4/api_detail.h +++ b/src/papi/lz4/api_detail.h @@ -14,6 +14,7 @@ namespace lz4 { namespace api { constexpr auto VERSION_MAJOR = LZ4_VERSION_MAJOR; constexpr auto VERSION_MINOR = LZ4_VERSION_MINOR; constexpr auto VERSION_RELEASE = LZ4_VERSION_RELEASE; + constexpr const char VERSION_STRING[] = LZ4_VERSION_STRING; template constexpr auto COMPRESSBOUND = LZ4_COMPRESSBOUND(Size); diff --git a/src/papi/lz4/init.cpp b/src/papi/lz4/init.cpp index 979e5bc..f17c61f 100644 --- a/src/papi/lz4/init.cpp +++ b/src/papi/lz4/init.cpp @@ -10,5 +10,9 @@ static test_initializer modules([](py::module &m) { .def("versionNumber", lz4::api::VERSION_NUMBER) .def("version", [](){ return py::make_tuple(lz4::api::VERSION_MAJOR(), lz4::api::VERSION_MINOR(), lz4::api::VERSION_RELEASE()); - }); + }) + .def("versionString", [](){ + return py::str(lz4::api::VERSION_STRING()); + }) + ; }); diff --git a/tests/papi/test_lz4.py b/tests/papi/test_lz4.py index 981527d..67c7e0b 100644 --- a/tests/papi/test_lz4.py +++ b/tests/papi/test_lz4.py @@ -9,3 +9,4 @@ def lz4(): def testVersion(lz4): assert lz4.versionNumber() == 10702 assert lz4.version() == (1, 7, 2) + assert lz4.versionString() == "1.7.2"