Go to the documentation of this file.
10 #include <gtest/gtest.h>
16 #include <test_mrpt_common.h>
24 const unsigned int random_seed = 123U;
26 mersenne_engine.
seed(random_seed);
30 auto gen = [&mersenne_engine]() {
32 return mersenne_engine() % 4;
39 TEST(CFileGZStreams, readwriteTmpFileCompressed)
41 std::vector<uint8_t> tst_data;
45 for (
int compress_level = 1; compress_level <= 9; compress_level++)
53 const bool open_ok = fil_out.
open(fil, compress_level);
62 const bool open_ok = fil_in.
open(fil);
75 TEST(CFileGZStreams, compareWithTestGZFiles)
77 std::vector<uint8_t> tst_data;
81 for (
int compress_level = 1; compress_level <= 9; compress_level++)
84 "%s/tests/gz-tests/%i.gz", mrpt::UNITTEST_BASEDIR.c_str(),
89 GTEST_FAIL() <<
"ERROR: test due to missing file: " << fil <<
"\n";
93 const bool open_ok = fil_in.
open(fil);
102 <<
" compress_level:" << compress_level;
const_iterator end() const
TEST(CFileGZStreams, readwriteTmpFileCompressed)
EXPECT_TRUE(mrpt::system::fileExists(ini_fil))
bool open(const std::string &fileName, int compress_level=1, mrpt::optional_ref< std::string > error_msg=std::nullopt)
Open a file for write, choosing the compression level.
size_t Write(const void *Buffer, size_t Count) override
Introduces a pure virtual method responsible for writing to the stream.
const size_t tst_data_len
std::string getTempFileName()
Returns the name of a proposed temporary file name.
bool fileExists(const std::string &fileName)
Test if a given file (or directory) exists.
const_iterator begin() const
void generate_test_data(std::vector< uint8_t > &tst_data)
Saves data to a file and transparently compress the data using the given compression level.
std::string to_string(T v)
Just like std::to_string(), but with an overloaded version for std::string arguments.
void seed(const uint32_t seed)
EXPECT_EQ(out.image_pair_was_used.size(), NUM_IMGS)
Portable MT19937 random generator, C++11 UniformRandomBitGenerator compliant.
std::string std::string format(std::string_view fmt, ARGS &&... args)
Page generated by Doxygen 1.8.17 for MRPT 2.0.3 at Thu May 21 21:53:32 UTC 2020 | |