tools/tests/functional/bad_argument_tests/low_level_api/inflate.cpp
/**
 * @brief Test @ref qpl_op_decompress operation behaviour in case if incompatible flags were set
 */
@brief Test @ref qpl_op_decompress operation behaviour in case if incompatible flags were set
@brief Test @ref qpl_op_decompress operation behaviour in case if incompatible flags were set
QPL_LOW_LEVEL_API_BAD_ARGUMENT_TEST(inflate, flags_confilct) {
    std::array<uint8_t, SOURCE_ARRAY_SIZE> source{};
    std::array<uint8_t, DESTINATION_ARRAY_SIZE> destination{};
    source.fill(0);
    destination.fill(0);
    job_ptr->op = qpl_op_decompress;
    set_input_stream(job_ptr,
                     source.data(),
                     (uint32_t) source.size(),
                     NOT_APPLICABLE_PARAMETER,
                     NOT_APPLICABLE_PARAMETER,
                     static_cast<qpl_parser>(NOT_APPLICABLE_PARAMETER));
    set_output_stream(job_ptr, destination.data(),
                      (uint32_t) destination.size(),
                      static_cast<qpl_out_format>(NOT_APPLICABLE_PARAMETER));
    job_ptr->flags = QPL_FLAG_RND_ACCESS | QPL_FLAG_NO_HDRS;
    ASSERT_EQ(QPL_STS_FLAG_CONFLICT_ERR, run_job_api(job_ptr))
                                << "Don't found flag conflict: user try decompress huffman_only in random mode";
    job_ptr->flags = QPL_FLAG_GZIP_MODE | QPL_FLAG_NO_HDRS;
    ASSERT_EQ(QPL_STS_FLAG_CONFLICT_ERR, run_job_api(job_ptr))
                                << "Don't found flag conflict: user try decompress huffman_only in with gzip header";
    job_ptr->flags = QPL_FLAG_ZLIB_MODE | QPL_FLAG_NO_HDRS;
    if (qpl_path_hardware == job_ptr->data_ptr.path) {
        ASSERT_EQ(run_job_api(job_ptr), QPL_STS_NOT_SUPPORTED_MODE_ERR);
    } else {
        ASSERT_EQ(QPL_STS_FLAG_CONFLICT_ERR, run_job_api(job_ptr))
                                    << "Don't found flag conflict: user try decompress huffman_only in with zlib header";
    }
    job_ptr->flags = QPL_FLAG_ZLIB_MODE | QPL_FLAG_GZIP_MODE;
    if (qpl_path_hardware == job_ptr->data_ptr.path) {
        ASSERT_EQ(run_job_api(job_ptr), QPL_STS_NOT_SUPPORTED_MODE_ERR);
    } else {
        ASSERT_EQ(QPL_STS_FLAG_CONFLICT_ERR, run_job_api(job_ptr))
                                    << "Don't found flag conflict: user try decompress with zlib and gzip header both";
    }
}
QPL_LOW_LEVEL_API_BAD_ARGUMENT_TEST ( inflate , flags_confilct ) { std :: array < uint8_t , SOURCE_ARRAY_SIZE > source { } ; std :: array < uint8_t , DESTINATION_ARRAY_SIZE > destination { } ; source . fill ( 0 ) ; destination . fill ( 0 ) ; job_ptr -> op = qpl_op_decompress ; set_input_stream ( job_ptr , source . data ( ) , ( uint32_t ) source . size ( ) , NOT_APPLICABLE_PARAMETER , NOT_APPLICABLE_PARAMETER , static_cast < qpl_parser > ( NOT_APPLICABLE_PARAMETER ) ) ; set_output_stream ( job_ptr , destination . data ( ) , ( uint32_t ) destination . size ( ) , static_cast < qpl_out_format > ( NOT_APPLICABLE_PARAMETER ) ) ; job_ptr -> flags = QPL_FLAG_RND_ACCESS | QPL_FLAG_NO_HDRS ; ASSERT_EQ ( QPL_STS_FLAG_CONFLICT_ERR , run_job_api ( job_ptr ) ) << " " ; job_ptr -> flags = QPL_FLAG_GZIP_MODE | QPL_FLAG_NO_HDRS ; ASSERT_EQ ( QPL_STS_FLAG_CONFLICT_ERR , run_job_api ( job_ptr ) ) << " " ; job_ptr -> flags = QPL_FLAG_ZLIB_MODE | QPL_FLAG_NO_HDRS ; if ( qpl_path_hardware == job_ptr -> data_ptr . path ) { ASSERT_EQ ( run_job_api ( job_ptr ) , QPL_STS_NOT_SUPPORTED_MODE_ERR ) ; } else { ASSERT_EQ ( QPL_STS_FLAG_CONFLICT_ERR , run_job_api ( job_ptr ) ) << " " ; } job_ptr -> flags = QPL_FLAG_ZLIB_MODE | QPL_FLAG_GZIP_MODE ; if ( qpl_path_hardware == job_ptr -> data_ptr . path ) { ASSERT_EQ ( run_job_api ( job_ptr ) , QPL_STS_NOT_SUPPORTED_MODE_ERR ) ; } else { ASSERT_EQ ( QPL_STS_FLAG_CONFLICT_ERR , run_job_api ( job_ptr ) ) << " " ; } }
@brief Test @ref qpl_op_decompress operation behaviour in case if incompatible flags were set
@brief Test @ref qpl_op_decompress operation behaviour in case if incompatible flags were set
// Preset