Browse Source

Tests - add test for file_read_bin() / file_write_bin()

OS390/rc1
heck 10 months ago
parent
commit
5abcfb86bb
1 changed files with 24 additions and 0 deletions
  1. +24
    -0
      test/test_file_rw_bin.cc

+ 24
- 0
test/test_file_rw_bin.cc View File

@ -0,0 +1,24 @@
// This file is under GNU General Public License 3.0
// see LICENSE.txt
#include <iostream>
#include <cassert>
#include "../src/pEpLog.hh"
#include "../src/std_utils.hh"
int main(int argc, char* argv[])
{
pEp::Adapter::pEpLog::set_enabled(true);
std::string filename = "test_rw.bin";
std::vector<char> v_out{};
for (int i = 0; i < 1000; i++) {
v_out.push_back(pEp::Utils::random_char(0, 255));
}
pEp::Utils::file_write_bin(filename, v_out);
std::vector<char> v_in = pEp::Utils::file_read_bin(filename);
assert(v_in == v_out);
}

Loading…
Cancel
Save