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

randombit / botan / 11844561993

14 Nov 2024 07:58PM UTC coverage: 91.178% (+0.1%) from 91.072%
11844561993

Pull #4435

github

web-flow
Merge 81dcb29da into e430f157a
Pull Request #4435: Test duration values ​​are now presented in seconds with six digits of precision. Tests without time measurements have been edited.

91856 of 100744 relevant lines covered (91.18%)

9311006.71 hits per line

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

88.0
/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 {
×
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
         result.start_timer();
1✔
33

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

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

44
               result.test_eq("square vs multiply",
65,532✔
45
                              static_cast<size_t>(field.gf_square(a)),
65,532✔
46
                              static_cast<size_t>(field.gf_mul(a, a)));
131,050✔
47

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

57
                  result.test_gte("Value less than order", field.gf_ord(), s);
131,064✔
58
               }
59
            }
60
         }
61
         result.end_timer();
1✔
62
         return result;
1✔
63
      }
×
64
};
65

66
BOTAN_REGISTER_TEST("pubkey", "gf2m", GF2m_Tests);
67

68
#endif
69

70
}  // namespace
71

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

© 2025 Coveralls, Inc