File: tests-readfile.cpp

package info (click to toggle)
xmlcopyeditor 1.3.1.0-1.2
  • links: PTS
  • area: main
  • in suites: forky, sid
  • size: 24,528 kB
  • sloc: xml: 140,240; cpp: 29,372; sh: 4,925; makefile: 299; sed: 16
file content (15 lines) | stat: -rw-r--r-- 408 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
#include "catch.hpp"
#include <string>
#include "../src/readfile.h"

TEST_CASE( "readfile works as specified", "[readfile]" ) {
  std::string valid_path = "catch.hpp", invalid_path = "invalid.hpp";
  std::string buf;

  REQUIRE( ReadFile::run(valid_path, buf) == true );
  REQUIRE( buf.at(0) == '/' );

  buf.clear();
  REQUIRE( ReadFile::run(invalid_path, buf) == false );
  REQUIRE( buf.length() == 0 );
}