mirror of
https://github.com/xoseperez/espurna.git
synced 2026-03-06 08:24:27 +01:00
test(delimiter): split and delimiter view
using comparison macro for tests referencing string views move all local code related to unity to a separate object
This commit is contained in:
24
code/test/unit/unity/unity_extra.cpp
Normal file
24
code/test/unit/unity/unity_extra.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#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());
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user