mkvtoolnix/tests/unit/util.h

55 lines
1.3 KiB
C
Raw Normal View History

2012-08-17 20:46:54 +00:00
/*
mkvmerge -- utility for splicing together matroska files
from component media subtypes
Distributed under the GPL
see the file COPYING for details
or visit http://www.gnu.org/copyleft/gpl.html
definitions for helper functions for unit tests
Written by Moritz Bunkus <moritz@bunkus.org>.
*/
#ifndef MTX_TESTS_UNIT_INIT_H
#define MTX_TESTS_UNIT_INIT_H
#include "common/common_pch.h"
#include <ebml/EbmlElement.h>
2012-08-17 20:46:54 +00:00
#include "gtest/gtest.h"
#include "common/strings/formatting.h"
#define ASSERT_EBML_EQ(a, b) ASSERT_PRED_FORMAT2(EbmlEquals, (a), (b))
#define EXPECT_EBML_EQ(a, b) EXPECT_PRED_FORMAT2(EbmlEquals, (a), (b))
2012-08-17 20:46:54 +00:00
namespace mtxut {
using namespace libebml;
void dump(EbmlElement *element, bool with_values = false, unsigned int level = 0);
2012-08-17 20:46:54 +00:00
::testing::AssertionResult EbmlEquals(char const *a_expr, char const *b_expr, EbmlElement &a, EbmlElement &b);
2012-08-17 20:46:54 +00:00
class ebml_equals_c {
private:
std::vector<std::string> m_path;
std::string m_error;
2012-08-17 20:46:54 +00:00
public:
ebml_equals_c();
2012-08-17 20:46:54 +00:00
bool compare_impl(EbmlElement &a, EbmlElement &b);
std::string get_error() const;
bool set_error(std::string const &error, EbmlElement *cmp = nullptr);
bool set_error(boost::format const &error, EbmlElement *cmp = nullptr);
2012-08-17 20:46:54 +00:00
public:
static bool check(EbmlElement &a, EbmlElement &b, std::string &error);
};
2012-08-17 20:46:54 +00:00
}
#endif // MTX_TESTS_UNIT_UTIL_H