diff --git a/include/CppUTest/SimpleString.h b/include/CppUTest/SimpleString.h index b158bd55a..1d9cf79c6 100644 --- a/include/CppUTest/SimpleString.h +++ b/include/CppUTest/SimpleString.h @@ -149,6 +149,8 @@ SimpleString StringFromFormat(const char* format, ...) __check_format__(printf, SimpleString VStringFromFormat(const char* format, va_list args); SimpleString StringFromBinary(const unsigned char* value, size_t size); SimpleString StringFromBinaryOrNull(const unsigned char* value, size_t size); +SimpleString StringFromBinaryWithSize(const unsigned char* value, size_t size); +SimpleString StringFromBinaryWithSizeOrNull(const unsigned char* value, size_t size); SimpleString StringFromMaskedBits(unsigned long value, unsigned long mask, size_t byteCount); #if CPPUTEST_USE_STD_CPP_LIB diff --git a/include/CppUTestExt/MockActualCall.h b/include/CppUTestExt/MockActualCall.h index ab72422a3..706a02894 100644 --- a/include/CppUTestExt/MockActualCall.h +++ b/include/CppUTestExt/MockActualCall.h @@ -51,6 +51,7 @@ class MockActualCall MockActualCall& withParameter(const SimpleString& name, const char* value) { return withStringParameter(name, value); } MockActualCall& withParameter(const SimpleString& name, void* value) { return withPointerParameter(name, value); } MockActualCall& withParameter(const SimpleString& name, const void* value) { return withConstPointerParameter(name, value); } + MockActualCall& withParameter(const SimpleString& name, const unsigned char* value, size_t size) { return withMemoryBufferParameter(name, value, size); } virtual MockActualCall& withParameterOfType(const SimpleString& typeName, const SimpleString& name, const void* value)=0; virtual MockActualCall& withOutputParameter(const SimpleString& name, void* output)=0; virtual MockActualCall& withOutputParameterOfType(const SimpleString& typeName, const SimpleString& name, void* output)=0; @@ -63,6 +64,7 @@ class MockActualCall virtual MockActualCall& withStringParameter(const SimpleString& name, const char* value)=0; virtual MockActualCall& withPointerParameter(const SimpleString& name, void* value)=0; virtual MockActualCall& withConstPointerParameter(const SimpleString& name, const void* value)=0; + virtual MockActualCall& withMemoryBufferParameter(const SimpleString& name, const unsigned char* value, size_t size)=0; virtual bool hasReturnValue()=0; virtual MockNamedValue returnValue()=0; diff --git a/include/CppUTestExt/MockCheckedActualCall.h b/include/CppUTestExt/MockCheckedActualCall.h index 601a01aea..88a688341 100644 --- a/include/CppUTestExt/MockCheckedActualCall.h +++ b/include/CppUTestExt/MockCheckedActualCall.h @@ -47,6 +47,7 @@ class MockCheckedActualCall : public MockActualCall virtual MockActualCall& withStringParameter(const SimpleString& name, const char* value) _override; virtual MockActualCall& withPointerParameter(const SimpleString& name, void* value) _override; virtual MockActualCall& withConstPointerParameter(const SimpleString& name, const void* value) _override; + virtual MockActualCall& withMemoryBufferParameter(const SimpleString& name, const unsigned char* value, size_t size) _override; virtual MockActualCall& withParameterOfType(const SimpleString& type, const SimpleString& name, const void* value) _override; virtual MockActualCall& withOutputParameter(const SimpleString& name, void* output) _override; virtual MockActualCall& withOutputParameterOfType(const SimpleString& type, const SimpleString& name, void* output) _override; @@ -149,6 +150,7 @@ class MockActualCallTrace : public MockActualCall virtual MockActualCall& withStringParameter(const SimpleString& name, const char* value) _override; virtual MockActualCall& withPointerParameter(const SimpleString& name, void* value) _override; virtual MockActualCall& withConstPointerParameter(const SimpleString& name, const void* value) _override; + virtual MockActualCall& withMemoryBufferParameter(const SimpleString& name, const unsigned char* value, size_t size) _override; virtual MockActualCall& withParameterOfType(const SimpleString& typeName, const SimpleString& name, const void* value) _override; virtual MockActualCall& withOutputParameter(const SimpleString& name, void* output) _override; virtual MockActualCall& withOutputParameterOfType(const SimpleString& typeName, const SimpleString& name, void* output) _override; @@ -205,6 +207,7 @@ class MockIgnoredActualCall: public MockActualCall virtual MockActualCall& withStringParameter(const SimpleString&, const char*) _override { return *this; } virtual MockActualCall& withPointerParameter(const SimpleString& , void*) _override { return *this; } virtual MockActualCall& withConstPointerParameter(const SimpleString& , const void*) _override { return *this; } + virtual MockActualCall& withMemoryBufferParameter(const SimpleString&, const unsigned char*, size_t) _override { return *this; } virtual MockActualCall& withParameterOfType(const SimpleString&, const SimpleString&, const void*) _override { return *this; } virtual MockActualCall& withOutputParameter(const SimpleString&, void*) _override { return *this; } virtual MockActualCall& withOutputParameterOfType(const SimpleString&, const SimpleString&, void*) _override { return *this; } diff --git a/include/CppUTestExt/MockCheckedExpectedCall.h b/include/CppUTestExt/MockCheckedExpectedCall.h index ea08f58ab..e9ec8ae40 100644 --- a/include/CppUTestExt/MockCheckedExpectedCall.h +++ b/include/CppUTestExt/MockCheckedExpectedCall.h @@ -48,6 +48,7 @@ class MockCheckedExpectedCall : public MockExpectedCall virtual MockExpectedCall& withStringParameter(const SimpleString& name, const char* value) _override; virtual MockExpectedCall& withPointerParameter(const SimpleString& name, void* value) _override; virtual MockExpectedCall& withConstPointerParameter(const SimpleString& name, const void* value) _override; + virtual MockExpectedCall& withMemoryBufferParameter(const SimpleString& name, const unsigned char* value, size_t size) _override; virtual MockExpectedCall& withParameterOfType(const SimpleString& typeName, const SimpleString& name, const void* value) _override; virtual MockExpectedCall& withOutputParameterReturning(const SimpleString& name, const void* value, size_t size) _override; virtual MockExpectedCall& withOutputParameterOfTypeReturning(const SimpleString& typeName, const SimpleString& name, const void* value) _override; @@ -146,6 +147,7 @@ class MockExpectedCallComposite : public MockExpectedCall virtual MockExpectedCall& withStringParameter(const SimpleString& name, const char* value) _override; virtual MockExpectedCall& withConstPointerParameter(const SimpleString& name, const void* value) _override; virtual MockExpectedCall& withPointerParameter(const SimpleString& name, void* value) _override; + virtual MockExpectedCall& withMemoryBufferParameter(const SimpleString& name, const unsigned char* value, size_t size) _override; virtual MockExpectedCall& withParameterOfType(const SimpleString& typeName, const SimpleString& name, const void* value) _override; virtual MockExpectedCall& withOutputParameterReturning(const SimpleString& name, const void* value, size_t size) _override; virtual MockExpectedCall& withOutputParameterOfTypeReturning(const SimpleString& typeName, const SimpleString& name, const void* value) _override; @@ -182,6 +184,7 @@ class MockIgnoredExpectedCall: public MockExpectedCall virtual MockExpectedCall& withStringParameter(const SimpleString&, const char*) _override { return *this; } virtual MockExpectedCall& withPointerParameter(const SimpleString& , void*) _override { return *this; } virtual MockExpectedCall& withConstPointerParameter(const SimpleString& , const void*) _override { return *this; } + virtual MockExpectedCall& withMemoryBufferParameter(const SimpleString&, const unsigned char*, size_t) _override { return *this; } virtual MockExpectedCall& withParameterOfType(const SimpleString&, const SimpleString&, const void*) _override { return *this; } virtual MockExpectedCall& withOutputParameterReturning(const SimpleString&, const void*, size_t) _override { return *this; } virtual MockExpectedCall& withOutputParameterOfTypeReturning(const SimpleString&, const SimpleString&, const void*) _override { return *this; } diff --git a/include/CppUTestExt/MockExpectedCall.h b/include/CppUTestExt/MockExpectedCall.h index 57a307d43..62e2294b2 100644 --- a/include/CppUTestExt/MockExpectedCall.h +++ b/include/CppUTestExt/MockExpectedCall.h @@ -48,6 +48,7 @@ class MockExpectedCall MockExpectedCall& withParameter(const SimpleString& name, const char* value) { return withStringParameter(name, value); } MockExpectedCall& withParameter(const SimpleString& name, void* value) { return withPointerParameter(name, value); } MockExpectedCall& withParameter(const SimpleString& name, const void* value) { return withConstPointerParameter(name, value); } + MockExpectedCall& withParameter(const SimpleString& name, const unsigned char* value, size_t size) { return withMemoryBufferParameter(name, value, size); } virtual MockExpectedCall& withParameterOfType(const SimpleString& typeName, const SimpleString& name, const void* value)=0; virtual MockExpectedCall& withOutputParameterReturning(const SimpleString& name, const void* value, size_t size)=0; virtual MockExpectedCall& withOutputParameterOfTypeReturning(const SimpleString& typeName, const SimpleString& name, const void* value)=0; @@ -61,6 +62,7 @@ class MockExpectedCall virtual MockExpectedCall& withStringParameter(const SimpleString& name, const char* value)=0; virtual MockExpectedCall& withPointerParameter(const SimpleString& name, void* value)=0; virtual MockExpectedCall& withConstPointerParameter(const SimpleString& name, const void* value)=0; + virtual MockExpectedCall& withMemoryBufferParameter(const SimpleString& name, const unsigned char* value, size_t size)=0; virtual MockExpectedCall& andReturnValue(int value)=0; virtual MockExpectedCall& andReturnValue(unsigned int value)=0; virtual MockExpectedCall& andReturnValue(long int value)=0; diff --git a/include/CppUTestExt/MockNamedValue.h b/include/CppUTestExt/MockNamedValue.h index 29cc5f632..e15701ca0 100644 --- a/include/CppUTestExt/MockNamedValue.h +++ b/include/CppUTestExt/MockNamedValue.h @@ -111,6 +111,7 @@ class MockNamedValue virtual void setValue(void* value); virtual void setValue(const void* value); virtual void setValue(const char* value); + virtual void setMemoryBuffer(const unsigned char* value, size_t size); virtual void setObjectPointer(const SimpleString& type, const void* objectPtr); virtual void setSize(size_t size); @@ -132,6 +133,7 @@ class MockNamedValue virtual const char* getStringValue() const; virtual void* getPointerValue() const; virtual const void* getConstPointerValue() const; + virtual const unsigned char* getMemoryBuffer() const; virtual const void* getObjectPointer() const; virtual size_t getSize() const; @@ -151,6 +153,7 @@ class MockNamedValue const char* stringValue_; void* pointerValue_; const void* constPointerValue_; + const unsigned char* memoryBufferValue_; const void* objectPointerValue_; const void* outputPointerValue_; } value_; diff --git a/src/CppUTest/SimpleString.cpp b/src/CppUTest/SimpleString.cpp index b6ed959e2..548aa0f10 100644 --- a/src/CppUTest/SimpleString.cpp +++ b/src/CppUTest/SimpleString.cpp @@ -585,6 +585,23 @@ SimpleString StringFromBinaryOrNull(const unsigned char* value, size_t size) return (value) ? StringFromBinary(value, size) : "(null)"; } +SimpleString StringFromBinaryWithSize(const unsigned char* value, size_t size) +{ + SimpleString result = StringFromFormat("Size = %lu | HexContents = ", size); + size_t displayedSize = ((size > 128) ? 128 : size); + result += StringFromBinaryOrNull(value, size); + if (size > displayedSize) + { + result += " ..."; + } + return result; +} + +SimpleString StringFromBinaryWithSizeOrNull(const unsigned char* value, size_t size) +{ + return (value) ? StringFromBinaryWithSize(value, size) : "(null)"; +} + SimpleString StringFromMaskedBits(unsigned long value, unsigned long mask, size_t byteCount) { SimpleString result; diff --git a/src/CppUTestExt/MockActualCall.cpp b/src/CppUTestExt/MockActualCall.cpp index cfed27bc7..092c08963 100644 --- a/src/CppUTestExt/MockActualCall.cpp +++ b/src/CppUTestExt/MockActualCall.cpp @@ -237,6 +237,14 @@ MockActualCall& MockCheckedActualCall::withConstPointerParameter(const SimpleStr return *this; } +MockActualCall& MockCheckedActualCall::withMemoryBufferParameter(const SimpleString& name, const unsigned char* value, size_t size) +{ + MockNamedValue actualParameter(name); + actualParameter.setMemoryBuffer(value, size); + checkInputParameter(actualParameter); + return *this; +} + MockActualCall& MockCheckedActualCall::withParameterOfType(const SimpleString& type, const SimpleString& name, const void* value) { MockNamedValue actualParameter(name); @@ -555,6 +563,13 @@ MockActualCall& MockActualCallTrace::withConstPointerParameter(const SimpleStrin return *this; } +MockActualCall& MockActualCallTrace::withMemoryBufferParameter(const SimpleString& name, const unsigned char* value, size_t size) +{ + addParameterName(name); + traceBuffer_ += StringFromBinaryWithSizeOrNull(value, size); + return *this; +} + MockActualCall& MockActualCallTrace::withParameterOfType(const SimpleString& typeName, const SimpleString& name, const void* value) { traceBuffer_ += " "; diff --git a/src/CppUTestExt/MockExpectedCall.cpp b/src/CppUTestExt/MockExpectedCall.cpp index 71db1871a..c173d952f 100644 --- a/src/CppUTestExt/MockExpectedCall.cpp +++ b/src/CppUTestExt/MockExpectedCall.cpp @@ -137,6 +137,14 @@ MockExpectedCall& MockCheckedExpectedCall::withConstPointerParameter(const Simpl return *this; } +MockExpectedCall& MockCheckedExpectedCall::withMemoryBufferParameter(const SimpleString& name, const unsigned char* value, size_t size) +{ + MockNamedValue* newParameter = new MockExpectedFunctionParameter(name); + inputParameters_->add(newParameter); + newParameter->setMemoryBuffer(value, size); + return *this; +} + MockExpectedCall& MockCheckedExpectedCall::withParameterOfType(const SimpleString& type, const SimpleString& name, const void* value) { MockNamedValue* newParameter = new MockExpectedFunctionParameter(name); @@ -565,6 +573,13 @@ MockExpectedCall& MockExpectedCallComposite::withConstPointerParameter(const Sim return *this; } +MockExpectedCall& MockExpectedCallComposite::withMemoryBufferParameter(const SimpleString& name, const unsigned char* value, size_t size) +{ + for (MockExpectedCallCompositeNode* node = head_; node != NULL; node = node->next_) + node->call_.withParameter(name, value, size); + return *this; +} + MockExpectedCall& MockExpectedCallComposite::withParameterOfType(const SimpleString& typeName, const SimpleString& name, const void* value) { for (MockExpectedCallCompositeNode* node = head_; node != NULL; node = node->next_) diff --git a/src/CppUTestExt/MockNamedValue.cpp b/src/CppUTestExt/MockNamedValue.cpp index bb49ce861..77749ecce 100644 --- a/src/CppUTestExt/MockNamedValue.cpp +++ b/src/CppUTestExt/MockNamedValue.cpp @@ -94,6 +94,13 @@ void MockNamedValue::setValue(const char* value) value_.stringValue_ = value; } +void MockNamedValue::setMemoryBuffer(const unsigned char* value, size_t size) +{ + type_ = "const unsigned char*"; + value_.memoryBufferValue_ = value; + size_ = size; +} + void MockNamedValue::setObjectPointer(const SimpleString& type, const void* objectPtr) { type_ = type; @@ -194,6 +201,12 @@ const void* MockNamedValue::getConstPointerValue() const return value_.pointerValue_; } +const unsigned char* MockNamedValue::getMemoryBuffer() const +{ + STRCMP_EQUAL("const unsigned char*", type_.asCharString()); + return value_.memoryBufferValue_; +} + const void* MockNamedValue::getObjectPointer() const { return value_.objectPointerValue_; @@ -259,6 +272,13 @@ bool MockNamedValue::equals(const MockNamedValue& p) const return value_.constPointerValue_ == p.value_.constPointerValue_; else if (type_ == "double") return (doubles_equal(value_.doubleValue_, p.value_.doubleValue_, 0.005)); + else if (type_ == "const unsigned char*") + { + if (size_ != p.size_) { + return false; + } + return SimpleString::MemCmp(value_.memoryBufferValue_, p.value_.memoryBufferValue_, size_) == 0; + } if (comparator_) return comparator_->isEqual(value_.objectPointerValue_, p.value_.objectPointerValue_); @@ -294,6 +314,8 @@ SimpleString MockNamedValue::toString() const return StringFrom(value_.constPointerValue_); else if (type_ == "double") return StringFrom(value_.doubleValue_); + else if (type_ == "const unsigned char*") + return StringFromBinaryWithSizeOrNull(value_.memoryBufferValue_, size_); if (comparator_) return comparator_->valueToString(value_.objectPointerValue_); diff --git a/tests/CppUTestExt/MockActualCallTest.cpp b/tests/CppUTestExt/MockActualCallTest.cpp index bb5f205e5..19307452e 100644 --- a/tests/CppUTestExt/MockActualCallTest.cpp +++ b/tests/CppUTestExt/MockActualCallTest.cpp @@ -147,6 +147,7 @@ TEST(MockCheckedActualCall, remainderOfMockActualCallTraceWorksAsItShould) { int value; const int const_value = 1; + const unsigned char mem_buffer[] = { 0xFE, 0x15 }; MockActualCallTrace actual; actual.withName("func"); actual.withCallOrder(1); @@ -157,6 +158,7 @@ TEST(MockCheckedActualCall, remainderOfMockActualCallTraceWorksAsItShould) actual.withLongIntParameter("long_int", (long int) 1); actual.withPointerParameter("pointer", &value); actual.withConstPointerParameter("const_pointer", &const_value); + actual.withMemoryBufferParameter("mem_buffer", mem_buffer, sizeof(mem_buffer)); actual.withParameterOfType("int", "named_type", &const_value); SimpleString expectedString("\nFunction name:func"); @@ -170,6 +172,7 @@ TEST(MockCheckedActualCall, remainderOfMockActualCallTraceWorksAsItShould) expectedString += HexStringFrom(&value); expectedString += " const_pointer:0x"; expectedString += HexStringFrom(&const_value); + expectedString += " mem_buffer:Size = 2 | HexContents = FE 15"; expectedString += " int named_type:0x"; expectedString += HexStringFrom(&const_value); STRCMP_EQUAL(expectedString.asCharString(), actual.getTraceOutput()); diff --git a/tests/CppUTestExt/MockExpectedCallTest.cpp b/tests/CppUTestExt/MockExpectedCallTest.cpp index a3ac1a9e2..d4faa0c14 100644 --- a/tests/CppUTestExt/MockExpectedCallTest.cpp +++ b/tests/CppUTestExt/MockExpectedCallTest.cpp @@ -239,6 +239,15 @@ TEST(MockExpectedCall, callWithConstPointerParameter) POINTERS_EQUAL(ptr, call->getInputParameter("constPointer").getConstPointerValue()); } +TEST(MockExpectedCall, callWithMemoryBuffer) +{ + const unsigned char mem_buffer[] = { 0x12, 0xFE, 0xA1 }; + call->withParameter("memoryBuffer", mem_buffer, sizeof(mem_buffer)); + STRCMP_EQUAL("const unsigned char*", call->getInputParameterType("memoryBuffer").asCharString()); + POINTERS_EQUAL( (void*) mem_buffer, (void*) call->getInputParameter("memoryBuffer").getMemoryBuffer() ); + LONGS_EQUAL(sizeof(mem_buffer), call->getInputParameter("memoryBuffer").getSize()); +} + TEST(MockExpectedCall, callWithObjectParameter) { void* ptr = (void*) 0x123; @@ -546,6 +555,13 @@ TEST(MockExpectedCallComposite, hasConstPointerParameter) STRCMP_EQUAL("name -> const void* param: <0x0>", call.callToString().asCharString()); } +TEST(MockExpectedCallComposite, hasMemoryBufferParameter) +{ + const unsigned char mem_buffer[] = { 0x89, 0xFE, 0x15 }; + composite.withParameter("param", mem_buffer, sizeof(mem_buffer)); + STRCMP_EQUAL("name -> const unsigned char* param: ", call.callToString().asCharString()); +} + TEST(MockExpectedCallComposite, hasParameterOfType) { composite.withParameterOfType("type", "param", (const void*) 0); @@ -656,6 +672,7 @@ TEST(MockIgnoredExpectedCall, worksAsItShould) ignored.withStringParameter("goo", "hello"); ignored.withPointerParameter("pie", (void*) 0); ignored.withConstPointerParameter("woo", (const void*) 0); + ignored.withMemoryBufferParameter("waa", (const unsigned char*) 0, 0); ignored.withParameterOfType("top", "mytype", (const void*) 0); ignored.withOutputParameterReturning("bar", (const void*) 0, 1); ignored.ignoreOtherParameters(); diff --git a/tests/CppUTestExt/MockSupportTest.cpp b/tests/CppUTestExt/MockSupportTest.cpp index 4c4669580..8f3af96f8 100644 --- a/tests/CppUTestExt/MockSupportTest.cpp +++ b/tests/CppUTestExt/MockSupportTest.cpp @@ -436,6 +436,48 @@ TEST(MockSupportTest, expectOneConstPointerParameterAndValue) CHECK_NO_MOCK_FAILURE(); } +TEST(MockSupportTest, expectOneMemBufferParameterAndValue) +{ + unsigned char memBuffer1[] = { 0x12, 0x15, 0xFF }; + unsigned char memBuffer2[] = { 0x12, 0x15, 0xFF }; + mock().expectOneCall("foo").withParameter("parameter", memBuffer1, sizeof(memBuffer1)); + mock().actualCall("foo").withParameter("parameter", memBuffer2, sizeof(memBuffer2)); + mock().checkExpectations(); + CHECK_NO_MOCK_FAILURE(); +} + +TEST(MockSupportTest, expectOneMemBufferParameterAndValueFailsDueToContents) +{ + unsigned char memBuffer1[] = { 0x12, 0x15, 0xFF }; + unsigned char memBuffer2[] = { 0x12, 0x05, 0xFF }; + + MockNamedValue parameter("parameter"); + parameter.setMemoryBuffer( memBuffer2, sizeof(memBuffer2) ); + addFunctionToExpectationsList("foo")->withParameter("parameter", memBuffer1, sizeof(memBuffer1)); + MockUnexpectedInputParameterFailure expectedFailure(mockFailureTest(), "foo", parameter, *expectationsList); + + mock().expectOneCall("foo").withParameter("parameter", memBuffer1, sizeof(memBuffer1)); + mock().actualCall("foo").withParameter("parameter", memBuffer2, sizeof(memBuffer2)); + + CHECK_EXPECTED_MOCK_FAILURE(expectedFailure); +} + +TEST(MockSupportTest, expectOneMemBufferParameterAndValueFailsDueToSize) +{ + unsigned char memBuffer1[] = { 0x12, 0x15, 0xFF }; + unsigned char memBuffer2[] = { 0x12, 0x15, 0xFF, 0x90 }; + + MockNamedValue parameter("parameter"); + parameter.setMemoryBuffer( memBuffer2, sizeof(memBuffer2) ); + addFunctionToExpectationsList("foo")->withParameter("parameter", memBuffer1, sizeof(memBuffer1)); + MockUnexpectedInputParameterFailure expectedFailure(mockFailureTest(), "foo", parameter, *expectationsList); + + mock().expectOneCall("foo").withParameter("parameter", memBuffer1, sizeof(memBuffer1)); + mock().actualCall("foo").withParameter("parameter", memBuffer2, sizeof(memBuffer2)); + + CHECK_EXPECTED_MOCK_FAILURE(expectedFailure); +} + TEST(MockSupportTest, expectOneStringParameterAndValueFails) { MockNamedValue parameter("parameter"); diff --git a/tests/SimpleStringTest.cpp b/tests/SimpleStringTest.cpp index 0f4537977..3736f04a4 100644 --- a/tests/SimpleStringTest.cpp +++ b/tests/SimpleStringTest.cpp @@ -839,6 +839,18 @@ TEST(SimpleString, Binary) STRCMP_EQUAL("(null)", StringFromBinaryOrNull(NULL, 0).asCharString()); } +TEST(SimpleString, BinaryWithSize) +{ + const unsigned char value[] = { 0x12, 0xFE, 0xA1 }; + const char expectedString[] = "Size = 3 | HexContents = 12 FE A1"; + + STRCMP_EQUAL(expectedString, StringFromBinaryWithSize(value, sizeof(value)).asCharString()); + STRCMP_EQUAL(expectedString, StringFromBinaryWithSizeOrNull(value, sizeof(value)).asCharString()); + STRCMP_EQUAL("Size = 0 | HexContents = ", StringFromBinaryWithSize(value, 0).asCharString()); + STRCMP_EQUAL("(null)", StringFromBinaryWithSizeOrNull(NULL, 0).asCharString()); +} + + TEST(SimpleString, MemCmp) { unsigned char smaller[] = { 0x00, 0x01, 0x2A, 0xFF };