mirror of
https://github.com/xoseperez/espurna.git
synced 2026-03-02 22:44:17 +01:00
using comparison macro for tests referencing string views move all local code related to unity to a separate object
25 lines
721 B
C++
25 lines
721 B
C++
#include <unity.h>
|
|
|
|
#include <espurna/types.h>
|
|
#include <espurna/libs/Delimiter.h>
|
|
|
|
void test_assert_equal_string_view(espurna::StringView expected, espurna::StringView actual, unsigned int line, const char* msg) {
|
|
UNITY_TEST_ASSERT_EQUAL_INT(expected.length(), actual.length(), line, msg);
|
|
if (msg != nullptr) {
|
|
UNITY_TEST_ASSERT_EQUAL_CHAR_ARRAY(
|
|
expected.data(), actual.data(), actual.length(), line, msg);
|
|
} else {
|
|
String out;
|
|
|
|
out += "'";
|
|
out += expected;
|
|
|
|
out += "' vs. '";
|
|
out += actual;
|
|
out += "'";
|
|
|
|
UNITY_TEST_ASSERT_EQUAL_CHAR_ARRAY(
|
|
expected.data(), actual.data(), actual.length(), line, out.c_str());
|
|
}
|
|
}
|