Commit 21cbf1ba authored by Paul Asmuth's avatar Paul Asmuth
Browse files

compare test output with fixture...

parent 11cd3d82
Loading
Loading
Loading
Loading
+4 −0
Original line number Diff line number Diff line
@@ -986,6 +986,10 @@ TEST_CASE(QueryTest, TestQueryService, [] () {
      input.get(),
      QueryService::FORMAT_SVG,
      output.get());

  EXPECT_FILES_EQ(
      "test/fixtures/QueryTest_TestQueryService_out.svg.html",
      "build/tests/tmp/QueryTest_TestQueryService_out.svg.html");
});

+20 −1
Original line number Diff line number Diff line
@@ -6,7 +6,9 @@
 */
#ifndef _FNORDMETRIC_UTIL_UNITTEST_H
#define _FNORDMETRIC_UTIL_UNITTEST_H
#include "runtimeexception.h"
#include <fnordmetric/util/runtimeexception.h>
#include <fnordmetric/util/inputstream.h>
#include <fnordmetric/util/outputstream.h>
#include <functional>
#include <unordered_map>
#include <vector>
@@ -60,6 +62,23 @@ namespace util {
      } \
    }

#define EXPECT_FILES_EQ(F1, F2) \
  { \
    auto one = fnordmetric::util::FileInputStream::openFile(F1); \
    auto two = fnordmetric::util::FileInputStream::openFile(F1); \
    std::string one_str; \
    std::string two_str; \
    one->readUntilEOF(&one_str); \
    two->readUntilEOF(&two_str); \
    if (one_str != two_str) { \
      RAISE( \
          fnordmetric::util::UnitTest::ExpectationFailed, \
          "expected files '%s' and '%s' to be equal, but the differ", \
          one_str.c_str(), two_str.c_str()); \
    } \
  }


class UnitTest {
public:
  static const int kExpectationFailed = 0;
+304 −0

File added.

Preview size limit exceeded, changes collapsed.