• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

randombit / botan / 13629555237

03 Mar 2025 11:13AM UTC coverage: 91.694% (+0.002%) from 91.692%
13629555237

push

github

web-flow
Merge pull request #4739 from randombit/jack/version-getters

Split up versioning info

95842 of 104524 relevant lines covered (91.69%)

11270640.88 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

85.71
/src/lib/utils/version.cpp
1
/*
2
* Version Information
3
* (C) 1999-2013,2015 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7

8
#include <botan/version.h>
9

10
#include <botan/internal/fmt.h>
11
#include <botan/internal/target_info.h>
12
#include <botan/internal/version_info.h>
13

14
namespace Botan {
15

16
const char* short_version_cstr() {
6✔
17
   return BOTAN_SHORT_VERSION_STRING;
6✔
18
}
19

20
const char* version_cstr() {
12✔
21
   return BOTAN_FULL_VERSION_STRING;
12✔
22
}
23

24
std::string version_string() {
8✔
25
   return std::string(version_cstr());
8✔
26
}
27

28
std::string short_version_string() {
3✔
29
   return std::string(short_version_cstr());
3✔
30
}
31

32
uint32_t version_datestamp() {
3✔
33
   return BOTAN_VERSION_DATESTAMP;
3✔
34
}
35

36
std::optional<std::string> version_vc_revision() {
1✔
37
#if defined(BOTAN_VC_REVISION)
38
   return std::string(BOTAN_VC_REVISION);
39
#else
40
   return std::nullopt;
1✔
41
#endif
42
}
43

44
std::optional<std::string> version_distribution_info() {
×
45
#if defined(BOTAN_DISTRIBUTION_INFO_STRING)
46
   return std::string(BOTAN_DISTRIBUTION_INFO_STRING);
47
#else
48
   return std::nullopt;
×
49
#endif
50
}
51

52
/*
53
* Return parts of the version as integers
54
*/
55
uint32_t version_major() {
6,600✔
56
   return BOTAN_VERSION_MAJOR;
6,600✔
57
}
58

59
uint32_t version_minor() {
6,598✔
60
   return BOTAN_VERSION_MINOR;
6,598✔
61
}
62

63
uint32_t version_patch() {
6,597✔
64
   return BOTAN_VERSION_PATCH;
6,597✔
65
}
66

67
bool unsafe_for_production_build() {
×
68
#if defined(BOTAN_UNSAFE_FUZZER_MODE) || defined(BOTAN_TERMINATE_ON_ASSERTS)
69
   return true;
×
70
#else
71
   return false;
72
#endif
73
}
74

75
std::string runtime_version_check(uint32_t major, uint32_t minor, uint32_t patch) {
6,596✔
76
   if(major != version_major() || minor != version_minor() || patch != version_patch()) {
6,596✔
77
      return fmt("Warning: linked version ({}) does not match version built against ({}.{}.{})\n",
1✔
78
                 short_version_cstr(),
1✔
79
                 major,
80
                 minor,
81
                 patch);
1✔
82
   }
83

84
   return "";
6,595✔
85
}
86

87
}  // namespace Botan
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc