16#ifndef TESTS_ASSERTIONS_H
17#define TESTS_ASSERTIONS_H
20#include "../iomanip.h"
21#include "../streams.h"
23#define ASSERT(OUT, CONDITION) tests::assert_true(OUT, F("" #CONDITION ""), CONDITION)
33 void assert_true(
streams::ostream& out,
const flash::FlashStorage* message,
bool condition)
39 template<
typename T1,
typename T2>
40 void assert_equals(
streams::ostream& out,
const char* var, T1 expected, T2 actual)
42 if (expected != actual)
43 out <<
F(
"ASSERTION FAILED on ") << var
44 <<
F(
": expected = ") << expected <<
F(
", actual=") << actual <<
streams::endl;
47 template<
typename T1,
typename T2>
48 void assert_equals(
streams::ostream& out,
const flash::FlashStorage* var, T1 expected, T2 actual)
50 if (expected != actual)
51 out <<
F(
"ASSERTION FAILED on ") << var
52 <<
F(
": expected = ") << expected <<
F(
", actual=") << actual <<
streams::endl;
Output stream wrapper to provide formatted output API, a la C++.
#define F(ptr)
Force string constant to be stored as flash storage.
void endl(FSTREAM &stream)
Manipulator for an output stream, which will insert a new-line character and flush the stream buffer.