diff options
author | Szczepan Zalega <szczepan@nitrokey.com> | 2018-07-18 11:36:42 +0200 |
---|---|---|
committer | Szczepan Zalega <szczepan@nitrokey.com> | 2018-07-18 11:36:42 +0200 |
commit | c79b12abb7b9cb2adb95b6529061ed1593ae5ee3 (patch) | |
tree | 6c37501700f8e42baef23323961176f15648298e /unittest/test_offline.cc | |
parent | cdd155eacb37c9ce513ddfe6eee692b189de2f2c (diff) | |
download | libnitrokey-c79b12abb7b9cb2adb95b6529061ed1593ae5ee3.tar.gz libnitrokey-c79b12abb7b9cb2adb95b6529061ed1593ae5ee3.tar.bz2 |
Allow for <patch> field in library version getter test
Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'unittest/test_offline.cc')
-rw-r--r-- | unittest/test_offline.cc | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/unittest/test_offline.cc b/unittest/test_offline.cc index 2ad6a0e..92af78c 100644 --- a/unittest/test_offline.cc +++ b/unittest/test_offline.cc @@ -169,13 +169,15 @@ TEST_CASE("Test version getter", "[fast]") { REQUIRE(nitrokey::get_minor_library_version() >= 3u); const char *library_version = nitrokey::get_library_version(); REQUIRE(library_version != nullptr); + CAPTURE(library_version); // The library version has to match the pattern returned by git describe: // v<major>.<minor> or v<major>.<minor>-<n>-g<hash>, where <n> is the number // of commits since the last tag, and <hash> is the hash of the current - // commit. (This assumes that all tags have the name v<major>.<minor>.) + // commit. (This assumes that all tags have the name v<major>.<minor>.). + // Optional <patch> field is allowed as well. std::string s = library_version; - std::string version("v[0-9]+\\.[0-9]+"); + std::string version("v[0-9]+\\.[0-9]+(\\.[0-9]+)?"); std::string git_suffix("-[0-9]+-g[0-9a-z]+"); std::regex pattern(version + "(" + git_suffix + "|)"); REQUIRE(std::regex_match(s, pattern)); |