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

randombit / botan / 22020273955

14 Feb 2026 04:02PM UTC coverage: 90.059% (-0.005%) from 90.064%
22020273955

push

github

web-flow
Merge pull request #5328 from randombit/jack/test-predicates

Change Test::Result integer and bool predicates to be specifically named

102238 of 113523 relevant lines covered (90.06%)

11567860.88 hits per line

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

90.48
/src/tests/test_gf2m.cpp
1
/*
2
* (C) 2015 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_MCELIECE)
10
   #include <botan/internal/gf2m_small_m.h>
11
#endif
12

13
namespace Botan_Tests {
14

15
namespace {
16

17
#if defined(BOTAN_HAS_MCELIECE)
18

19
class GF2m_Tests final : public Test {
1✔
20
   public:
21
      std::vector<Test::Result> run() override {
1✔
22
         std::vector<Test::Result> results;
1✔
23

24
         results.push_back(test_gf_overflow());
2✔
25

26
         return results;
1✔
27
      }
×
28

29
   private:
30
      static Test::Result test_gf_overflow() {
1✔
31
         Test::Result result("GF2m");
1✔
32

33
         /*
34
         * This is testing one specific case where an overflow
35
         * occurred. It should be extended to test more of the interface.
36
         */
37
         for(size_t degree = 2; degree <= 15; ++degree) {
15✔
38
            const Botan::GF2m_Field field(degree);
14✔
39

40
            for(size_t i = 0; i <= field.gf_ord(); ++i) {
65,546✔
41
               const Botan::gf2m a = static_cast<Botan::gf2m>(i);
65,532✔
42

43
               result.test_u16_eq("square vs multiply", field.gf_square(a), field.gf_mul(a, a));
131,050✔
44

45
               /*
46
               * This sequence is from the start of gf2m_decomp_rootfind_state::calc_Fxj_j_neq_0
47
               */
48
               {
65,532✔
49
                  const Botan::gf2m jl_gray = field.gf_l_from_n(a);
65,532✔
50
                  const Botan::gf2m xl_j_tt_5 = field.gf_square_rr(jl_gray);
65,532✔
51
                  const Botan::gf2m xl_gray_tt_3 = field.gf_mul_rrr(xl_j_tt_5, jl_gray);
65,532✔
52
                  const Botan::gf2m s = field.gf_mul_nrr(xl_gray_tt_3, field.gf_ord());
65,532✔
53

54
                  result.test_sz_gte("Value less than order", field.gf_ord(), s);
65,532✔
55
               }
56
            }
57
         }
58
         return result;
1✔
59
      }
×
60
};
61

62
BOTAN_REGISTER_TEST("pubkey", "gf2m", GF2m_Tests);
63

64
#endif
65

66
}  // namespace
67

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