Skip to content

Commit

Permalink
Adds tests for new RateAdaptiveCode constructors
Browse files Browse the repository at this point in the history
  • Loading branch information
adomasbaliuka committed May 2, 2024
1 parent 432bf29 commit 5804105
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/test_rate_adaptive_code.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

// To be tested
#include "rate_adaptive_code.hpp"
#include "encoder_advanced.hpp"

// Test cases test against constants known to be correct for the LDPC-matrix defined here:
#include "fortest_autogen_ldpc_matrix_csc.hpp"
Expand Down Expand Up @@ -316,7 +317,9 @@ TEST(rate_adaptive_code_from_colptr_rowIdx, equals_not_equals_operators) {
}

TEST(rate_adaptive_code_from_decoder, obtain_from_advanced_encoder_behaviour) {
RateAdaptiveCode<std::uint32_t, std::uint16_t> H1(encoder2);
std::vector<std::uint16_t> rows_to_combine{}; // not used here!
RateAdaptiveCode<std::uint32_t, std::uint16_t> H1(encoder2.get_pos_varn(), rows_to_combine);

auto H2 = get_code_big_wra();

{
Expand All @@ -341,3 +344,12 @@ TEST(rate_adaptive_code_from_decoder, obtain_from_advanced_encoder_behaviour) {
EXPECT_EQ(hash_vector(out), 2814594723);
}
}

TEST(rate_adaptive_code_from_decoder, obtain_from_advanced_encoder_equals) {
std::vector<std::uint16_t> rows_to_combine(AutogenRateAdapt::rows.begin(), AutogenRateAdapt::rows.end());
RateAdaptiveCode<std::uint32_t, std::uint16_t> H1(encoder2.get_pos_varn(), rows_to_combine);

// TODO add random rate adaption for comparison
auto H2 = get_code_big_wra();
EXPECT_TRUE(H1 == H2);
}

0 comments on commit 5804105

Please sign in to comment.