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

randombit / botan / 23225340130

18 Mar 2026 01:53AM UTC coverage: 89.677% (-0.001%) from 89.678%
23225340130

push

github

web-flow
Merge pull request #5456 from randombit/jack/clang-tidy-22

Fix various warnings from clang-tidy 22

104438 of 116460 relevant lines covered (89.68%)

11819947.55 hits per line

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

89.29
/src/tests/test_x509_dn.cpp
1
/*
2
* (C) 2017 Jack Lloyd
3
*
4
* Botan is released under the Simplified BSD License (see license.txt)
5
*/
6

7
#include "tests.h"
8

9
#if defined(BOTAN_HAS_X509_CERTIFICATES)
10
   #include <botan/ber_dec.h>
11
   #include <botan/pkix_types.h>
12
#endif
13

14
namespace Botan_Tests {
15

16
namespace {
17

18
#if defined(BOTAN_HAS_X509_CERTIFICATES)
19
class X509_DN_Comparisons_Tests final : public Text_Based_Test {
×
20
   public:
21
      X509_DN_Comparisons_Tests() : Text_Based_Test("x509_dn.vec", "DN1,DN2") {}
2✔
22

23
      Test::Result run_one_test(const std::string& type, const VarMap& vars) override {
9✔
24
         const std::vector<uint8_t> dn_bits1 = vars.get_req_bin("DN1");
9✔
25
         const std::vector<uint8_t> dn_bits2 = vars.get_req_bin("DN2");
9✔
26

27
         const bool dn_same = (type == "Equal");
9✔
28

29
         Test::Result result("X509_DN comparisons");
9✔
30
         try {
9✔
31
            Botan::X509_DN dn1;
9✔
32
            Botan::BER_Decoder bd1(dn_bits1);
9✔
33
            dn1.decode_from(bd1);
9✔
34

35
            Botan::X509_DN dn2;
9✔
36
            Botan::BER_Decoder bd2(dn_bits2);
9✔
37
            dn2.decode_from(bd2);
9✔
38

39
            const bool compared_same = (dn1 == dn2);
9✔
40
            result.test_bool_eq("Comparison matches expected", dn_same, compared_same);
9✔
41

42
            const bool lt1 = (dn1 < dn2);
9✔
43
            const bool lt2 = (dn2 < dn1);
9✔
44

45
            if(dn_same) {
9✔
46
               result.test_is_false("same means neither is less than", lt1);
6✔
47
               result.test_is_false("same means neither is less than", lt2);
6✔
48
            } else {
49
               result.test_is_true("different means one is less than", lt1 || lt2);
3✔
50
               result.test_is_false("different means only one is less than", lt1 && lt2);
3✔
51
            }
52
         } catch(Botan::Exception& e) {
27✔
53
            result.test_failure(e.what());
×
54
         }
×
55

56
         return result;
9✔
57
      }
9✔
58
};
59

60
BOTAN_REGISTER_TEST("x509", "x509_dn_cmp", X509_DN_Comparisons_Tests);
61
#endif
62

63
}  // namespace
64

65
}  // namespace Botan_Tests
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