File: test.hpp

package info (click to toggle)
protozero 1.8.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,548 kB
  • sloc: cpp: 20,364; sh: 18; makefile: 14
file content (33 lines) | stat: -rw-r--r-- 1,147 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifndef TEST_HPP
#define TEST_HPP

#include <catch.hpp> // IWYU pragma: export

#include <array> // IWYU pragma: export
#include <limits> // IWYU pragma: export
#include <string> // IWYU pragma: export
#include <vector> // IWYU pragma: export

#include <stdexcept>
// Define protozero_assert() to throw this error. This allows the tests to
// check that the assert fails.
struct assert_error : public std::runtime_error {
    explicit assert_error(const char* what_arg) : std::runtime_error(what_arg) {
    }
};
#define protozero_assert(x) if (!(x)) { throw assert_error{#x}; } // NOLINT(readability-simplify-boolean-expr)

#include <protozero/pbf_builder.hpp> // IWYU pragma: export
#include <protozero/pbf_message.hpp> // IWYU pragma: export
#include <protozero/pbf_reader.hpp> // IWYU pragma: export
#include <protozero/pbf_writer.hpp> // IWYU pragma: export

extern std::string load_data(const std::string& filename);

#define PROTOZERO_TEST_CONCAT2(x, y) x##y
#define PROTOZERO_TEST_CONCAT(x, y) PROTOZERO_TEST_CONCAT2(x, y)

#define PROTOZERO_TEST_STRING2(s) #s
#define PROTOZERO_TEST_STRING(s) PROTOZERO_TEST_STRING2(s)

#endif // TEST_HPP