tools/tests/functional/unit_tests/algorithmic/core_deflate_histogram.cpp
/**
     * @brief Tests offset index calculation in accordance with @ref offset_correspondence_table
     */
@brief Tests offset index calculation in accordance with @ref offset_correspondence_table
@brief Tests offset index calculation in accordance with @ref offset_correspondence_table
QPL_UNIT_API_ALGORITHMIC_TEST(deflate_histogramm, offset_index_calculation) {
        qpl::test::random   random_offset(0u, 0u, util::TestEnvironment::GetInstance().GetSeed());
        deflate_histogram_t histogram;
        deflate_match_t     match = {};
        std::fill(reinterpret_cast<uint8_t*>(&histogram),
                  reinterpret_cast<uint8_t*>(&histogram) + sizeof(histogram),
                  0u);
        for (auto & borders : offset_correspondence_table) {
            random_offset.set_range(borders[0], borders[1]);
            match.offset = static_cast<uint32_t>(random_offset);
            deflate_histogram_update_match(&histogram, match);
        }
        auto offset_table = histogram.offsets;
        for (uint32_t i = 0; i < RFC1951_OFFSET_TABLE_SIZE; i++) {
            EXPECT_EQ(offset_table[i], 1u) << "Incorrect statistic for " << i << "offset group";
        }
    }
QPL_UNIT_API_ALGORITHMIC_TEST ( deflate_histogramm , offset_index_calculation ) { qpl :: test :: random random_offset ( 0u , 0u , util :: TestEnvironment :: GetInstance ( ) . GetSeed ( ) ) ; deflate_histogram_t histogram ; deflate_match_t match = { } ; std :: fill ( reinterpret_cast < uint8_t * > ( & histogram ) , reinterpret_cast < uint8_t * > ( & histogram ) + sizeof ( histogram ) , 0u ) ; for ( auto & borders : offset_correspondence_table ) { random_offset . set_range ( borders [ 0 ] , borders [ 1 ] ) ; match . offset = static_cast < uint32_t > ( random_offset ) ; deflate_histogram_update_match ( & histogram , match ) ; } auto offset_table = histogram . offsets ; for ( uint32_t i = 0 ; i < RFC1951_OFFSET_TABLE_SIZE ; i ++ ) { EXPECT_EQ ( offset_table [ i ] , 1u ) << " " << i << " " ; } }
@brief Tests offset index calculation in accordance with @ref offset_correspondence_table
@brief Tests offset index calculation in accordance with @ref offset_correspondence_table
// Variables // Reset histogram table // Fill histogram with offsets // Validate offset table