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

randombit / botan / 5111374265

29 May 2023 11:19AM UTC coverage: 92.227% (+0.5%) from 91.723%
5111374265

push

github

randombit
Next release will be 3.1.0. Update release notes

75588 of 81959 relevant lines covered (92.23%)

11886470.91 hits per line

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

25.0
/src/lib/utils/assert.cpp
1
/*
2
* Runtime assertion checking
3
* (C) 2010,2012,2018 Jack Lloyd
4
*
5
* Botan is released under the Simplified BSD License (see license.txt)
6
*/
7

8
#include <botan/assert.h>
9

10
#include <botan/exceptn.h>
11
#include <botan/internal/fmt.h>
12
#include <sstream>
13

14
#if defined(BOTAN_TERMINATE_ON_ASSERTS)
15
   #include <cstdlib>
16
   #include <iostream>
17
#endif
18

19
namespace Botan {
20

21
void throw_invalid_argument(const char* message, const char* func, const char* file) {
5,084✔
22
   throw Invalid_Argument(fmt("{} in {}:{}", message, func, file));
10,168✔
23
}
24

25
void throw_invalid_state(const char* expr, const char* func, const char* file) {
15,963✔
26
   throw Invalid_State(fmt("Invalid state: expr {} was false in {}:{}", expr, func, file));
31,926✔
27
}
28

29
void assertion_failure(const char* expr_str, const char* assertion_made, const char* func, const char* file, int line) {
×
30
   std::ostringstream format;
×
31

32
   format << "False assertion ";
×
33

34
   if(assertion_made && assertion_made[0] != 0)
×
35
      format << "'" << assertion_made << "' (expression " << expr_str << ") ";
×
36
   else
37
      format << expr_str << " ";
×
38

39
   if(func)
×
40
      format << "in " << func << " ";
×
41

42
   format << "@" << file << ":" << line;
×
43

44
#if defined(BOTAN_TERMINATE_ON_ASSERTS)
45
   std::cerr << format.str() << '\n';
×
46
   std::abort();
×
47
#else
48
   throw Internal_Error(format.str());
49
#endif
50
}
×
51

52
}  // 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

© 2025 Coveralls, Inc