tudocomp
– The TU Dortmund Compression Framework
test/test/util.hpp File Reference
#include <cstdint>
#include <fstream>
#include <iostream>
#include <string>
#include <memory>
#include <glog/logging.h>
#include <gtest/gtest.h>
#include <sys/stat.h>
#include <tudocomp/Algorithm.hpp>
#include <tudocomp/AlgorithmStringParser.hpp>
#include <tudocomp/Env.hpp>
#include <tudocomp/Registry.hpp>
#include <tudocomp/Compressor.hpp>
#include <tudocomp/CreateAlgorithm.hpp>
#include <tudocomp/io.hpp>
#include <tudocomp/util/View.hpp>
#include <tudocomp/generators/FibonacciGenerator.hpp>
#include <tudocomp/generators/RandomUniformGenerator.hpp>
#include <tudocomp/generators/RunRichGenerator.hpp>
#include <tudocomp/generators/ThueMorseGenerator.hpp>
#include <tudocomp/Literal.hpp>
#include <tudocomp/Range.hpp>
#include <tudocomp/io/Path.hpp>

Go to the source code of this file.

Classes

struct  tdc::test::CompressResult< C >
 
class  tdc::test::RoundTrip< C >
 
class  tdc::test::TestInput
 
class  tdc::test::TestOutput
 

Namespaces

 tdc
 Contains the text compression and encoding framework.
 
 tdc::test
 Contains helpers for the unit tests.
 

Typedefs

using tdc::test::PacketIntegers = std::vector< uint64_t >
 

Functions

template<class T , class U >
void tdc::test::assert_eq_strings (const T &expected_, const U &actual_)
 Error diagnostic optimized for string data. More...
 
template<class T , class U >
void tdc::test::assert_eq_integers (const T &expected_, const U &actual_)
 Error diagnostic optimized for binary data. More...
 
template<class T , class U >
void tdc::test::assert_eq_hybrid_strings (const T &expected, const U &actual)
 Error diagnostic optimized for mixed binary/ascii data. More...
 
template<class T , class U >
void tdc::test::assert_eq_sequence (const T &expected, const U &actual)
 Error diagnostic optimized for arbitrary data. More...
 
template<class Lambda >
std::string tdc::test::ostream_to_string (Lambda f)
 Temporary provides a ostream to write into, and returns it as a string. More...
 
template<class Lambda >
std::vector< uint8_t > tdc::test::ostream_to_bytes (Lambda f)
 Temporary provides a ostream to write into, and returns it as a byte vector. More...
 
template<class F >
void tdc::test::roundtrip_batch (F f)
 Call the given function with a number of different strings testing common corner cases and unicode input. More...
 
template<class F >
void tdc::test::on_string_generators (F func, size_t n)
 
std::string tdc::test::test_file_path (const std::string &filename)
 
bool tdc::test::test_file_exists (const std::string &filename)
 
std::string tdc::test::read_test_file (const std::string &filename)
 
void tdc::test::create_test_directory ()
 
void tdc::test::write_test_file (const std::string &filename, string_ref text)
 
void tdc::test::remove_test_file (const std::string &filename)
 
std::vector< uint8_t > tdc::test::pack_integers (std::vector< uint64_t > ints)
 
std::string tdc::test::format_diff (const std::string &a, const std::string &b)
 
std::string tdc::test::format_diff_bin (const std::string &a, const std::string &b)
 
void tdc::test::assert_eq_binary (string_ref actual, PacketIntegers expected)
 
template<class T >
CompressResult< T > tdc::test::compress (string_ref text, const std::string &options="", const Registry< Compressor > &registry=Registry< Compressor >("compressor"))
 
template<class T >
void tdc::test::roundtrip_ex (string_ref original_text, string_ref expected_compressed_text, const std::string &options="", const Registry< Compressor > &registry=Registry< Compressor >("compressor"))
 
template<class T >
void tdc::test::roundtrip (string_ref original_text)
 
template<class T >
void tdc::test::roundtrip_binary (string_ref original_text, const std::vector< uint64_t > &expected_compressed_text_packed_ints={}, const std::string &options="", const Registry< Compressor > &registry=Registry< Compressor >("compressor"))
 
TestInput tdc::test::compress_input (string_ref text)
 Creates an instance of an tdc::Input to be used with Compressor::compress(). More...
 
TestInput tdc::test::compress_input_file (string_ref path)
 Creates an instance of an tdc::Input to be used with Compressor::compress(). More...
 
TestOutput tdc::test::compress_output ()
 Creates an instance of an tdc::Output to be used with Compressor::compress(). More...
 
TestInput tdc::test::decompress_input (string_ref text)
 Creates an instance of an tdc::Input to be used with Compressor::decompress(). More...
 
TestInput tdc::test::decompress_input_file (string_ref path)
 Creates an instance of an tdc::Input to be used with Compressor::decompress(). More...
 
TestOutput tdc::test::decompress_output ()
 Creates an instance of an tdc::Output to be used with Compressor::decompress(). More...
 
template<typename Coder >
void tdc::test::test_binary_out (string_ref in, std::vector< uint64_t > packed_ints_out, bool interleave=false)
 

Variables

const std::string tdc::test::TEST_FILE_PATH = "test_files"