@@ -473,43 +473,36 @@ BOOST_AUTO_TEST_CASE(bls_threshold_signature_tests)
473
473
}
474
474
475
475
// A dummy BLS object that satisfies the minimal interface expected by CBLSLazyWrapper.
476
- class DummyBLS {
476
+ class DummyBLS
477
+ {
477
478
public:
478
479
// Define a fixed serialization size (for testing purposes).
479
480
static const size_t SerSize = 4 ;
480
481
std::array<uint8_t , SerSize> data{};
481
482
482
- DummyBLS () {
483
- data.fill (0 );
484
- }
483
+ DummyBLS () { data.fill (0 ); }
485
484
486
485
// A dummy validity check: valid if any byte is non-zero.
487
- bool IsValid () const {
488
- return std::any_of (data.begin (), data.end (), [](uint8_t c){ return c != 0 ; });
486
+ bool IsValid () const
487
+ {
488
+ return std::any_of (data.begin (), data.end (), [](uint8_t c) { return c != 0 ; });
489
489
}
490
490
491
491
// Convert to bytes; ignore the legacy flag for simplicity.
492
- std::array<uint8_t , SerSize> ToBytes (bool /* legacy*/ ) const {
493
- return data;
494
- }
492
+ std::array<uint8_t , SerSize> ToBytes (bool /* legacy*/ ) const { return data; }
495
493
496
494
// Set from bytes; again, ignore the legacy flag.
497
- void SetBytes (const std::array<uint8_t , SerSize>& bytes, bool /* legacy*/ ) {
498
- data = bytes;
499
- }
495
+ void SetBytes (const std::array<uint8_t , SerSize>& bytes, bool /* legacy*/ ) { data = bytes; }
500
496
501
497
// A dummy malleability check: simply compares the stored data to the given bytes.
502
- bool CheckMalleable (const std::array<uint8_t , SerSize>& bytes, bool /* legacy*/ ) const {
503
- return data == bytes;
504
- }
498
+ bool CheckMalleable (const std::array<uint8_t , SerSize>& bytes, bool /* legacy*/ ) const { return data == bytes; }
505
499
506
500
// Reset the object to an "empty" state.
507
- void Reset () {
508
- data.fill (0 );
509
- }
501
+ void Reset () { data.fill (0 ); }
510
502
511
503
// Produce a string representation.
512
- std::string ToString (bool /* legacy*/ ) const {
504
+ std::string ToString (bool /* legacy*/ ) const
505
+ {
513
506
std::ostringstream oss;
514
507
for (auto b : data) {
515
508
oss << std::setfill (' 0' ) << std::setw (2 ) << std::hex << static_cast <int >(b);
@@ -518,9 +511,7 @@ class DummyBLS {
518
511
}
519
512
520
513
// Equality operator.
521
- bool operator ==(const DummyBLS& other) const {
522
- return data == other.data ;
523
- }
514
+ bool operator ==(const DummyBLS& other) const { return data == other.data ; }
524
515
};
525
516
526
517
// Define a type alias for our lazy wrapper instantiated with DummyBLS.
@@ -541,7 +532,7 @@ BOOST_AUTO_TEST_CASE(test_non_default_vs_default)
541
532
LazyDummyBLS lazy_default;
542
533
LazyDummyBLS lazy_set;
543
534
DummyBLS obj;
544
- obj.data = {1 , 2 , 3 , 4 }; // nonzero data makes the object valid
535
+ obj.data = {1 , 2 , 3 , 4 }; // nonzero data makes the object valid
545
536
lazy_set.Set (obj, false );
546
537
BOOST_CHECK (!(lazy_default == lazy_set));
547
538
BOOST_CHECK (lazy_default != lazy_set);
@@ -553,9 +544,9 @@ BOOST_AUTO_TEST_CASE(test_non_default_vs_different)
553
544
LazyDummyBLS lazy_a;
554
545
LazyDummyBLS lazy_b;
555
546
DummyBLS obj;
556
- obj.data = {1 , 2 , 3 , 4 }; // nonzero data makes the object valid
547
+ obj.data = {1 , 2 , 3 , 4 }; // nonzero data makes the object valid
557
548
lazy_a.Set (obj, false );
558
- obj.data = {4 , 3 , 2 , 1 }; // nonzero data makes the object valid
549
+ obj.data = {2 , 2 , 3 , 4 }; // nonzero data makes the object valid
559
550
lazy_b.Set (obj, false );
560
551
BOOST_CHECK (lazy_a != lazy_b);
561
552
}
0 commit comments