From f845de272dbfef738dd8525f3f4e07884685bcd0 Mon Sep 17 00:00:00 2001 From: Chad Condon Date: Tue, 20 Sep 2022 00:39:37 -0700 Subject: [PATCH 1/6] Test w/o long long --- .github/workflows/extended.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/extended.yml b/.github/workflows/extended.yml index 45a673886..b4d9cf78b 100644 --- a/.github/workflows/extended.yml +++ b/.github/workflows/extended.yml @@ -155,3 +155,19 @@ jobs: run: cmake --build cpputest_build - name: Test run: ctest --test-dir cpputest_build + + no-long-long: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@main + - name: Configure + run: > + cmake + -B cpputest_build + -D CPPUTEST_USE_LONG_LONG=NO + -D CMAKE_CXX_COMPILER=clang++ + - name: Build + run: cmake --build cpputest_build -j + - name: Test + run: ctest --test-dir cpputest_build -j From dac3c9c76f763b6711fea9d8d97f433ee76959c7 Mon Sep 17 00:00:00 2001 From: Chad Condon Date: Sun, 30 Oct 2022 13:49:30 -0700 Subject: [PATCH 2/6] Include automake build --- .github/workflows/extended.yml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/.github/workflows/extended.yml b/.github/workflows/extended.yml index b4d9cf78b..09be38d62 100644 --- a/.github/workflows/extended.yml +++ b/.github/workflows/extended.yml @@ -156,7 +156,19 @@ jobs: - name: Test run: ctest --test-dir cpputest_build - no-long-long: + automake-no-long-long: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@main + - name: Configure + run: | + autoreconf -i . + ./configure --disable-longlong + - name: Build and test + run: make tdd + + cmake-no-long-long: runs-on: ubuntu-latest steps: - name: Checkout From 1ee7b00ce5d34d4377267d99e821a30c1c2436db Mon Sep 17 00:00:00 2001 From: Chad Condon Date: Tue, 27 Sep 2022 19:32:59 -0700 Subject: [PATCH 3/6] Use #if CPPUTEST_USE_LONG_LONG --- include/CppUTestExt/MockNamedValue.h | 2 +- include/CppUTestExt/MockSupport_c.h | 2 +- src/CppUTest/SimpleString.cpp | 2 +- src/CppUTest/Utest.cpp | 4 ++-- src/CppUTestExt/MockActualCall.cpp | 8 ++++---- src/CppUTestExt/MockExpectedCall.cpp | 4 ++-- src/CppUTestExt/MockNamedValue.cpp | 10 +++++----- src/CppUTestExt/MockSupport.cpp | 2 +- src/CppUTestExt/MockSupport_c.cpp | 10 +++++----- tests/CppUTest/SimpleStringTest.cpp | 6 +++--- tests/CppUTest/TestFailureTest.cpp | 4 ++-- tests/CppUTest/TestHarness_cTest.cpp | 2 +- tests/CppUTest/TestUTestMacro.cpp | 2 +- tests/CppUTestExt/MockActualCallTest.cpp | 8 ++++---- tests/CppUTestExt/MockExpectedCallTest.cpp | 6 +++--- tests/CppUTestExt/MockParameterTest.cpp | 6 +++--- tests/CppUTestExt/MockReturnValueTest.cpp | 6 +++--- tests/CppUTestExt/MockSupport_cTest.cpp | 4 ++-- tests/CppUTestExt/MockSupport_cTestCFile.c | 8 ++++---- 19 files changed, 48 insertions(+), 48 deletions(-) diff --git a/include/CppUTestExt/MockNamedValue.h b/include/CppUTestExt/MockNamedValue.h index 426b70c9d..413ef48ab 100644 --- a/include/CppUTestExt/MockNamedValue.h +++ b/include/CppUTestExt/MockNamedValue.h @@ -167,7 +167,7 @@ class MockNamedValue unsigned int unsignedIntValue_; long int longIntValue_; unsigned long int unsignedLongIntValue_; -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG cpputest_longlong longLongIntValue_; cpputest_ulonglong unsignedLongLongIntValue_; #else diff --git a/include/CppUTestExt/MockSupport_c.h b/include/CppUTestExt/MockSupport_c.h index 32f2b7d40..5bc9fc1fb 100644 --- a/include/CppUTestExt/MockSupport_c.h +++ b/include/CppUTestExt/MockSupport_c.h @@ -61,7 +61,7 @@ typedef struct SMockValue_c unsigned int unsignedIntValue; long int longIntValue; unsigned long int unsignedLongIntValue; -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG cpputest_longlong longLongIntValue; cpputest_ulonglong unsignedLongLongIntValue; #else diff --git a/src/CppUTest/SimpleString.cpp b/src/CppUTest/SimpleString.cpp index 02898cd4d..0a789d725 100644 --- a/src/CppUTest/SimpleString.cpp +++ b/src/CppUTest/SimpleString.cpp @@ -781,7 +781,7 @@ SimpleString StringFrom(const std::nullptr_t value) } #endif -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG SimpleString StringFrom(cpputest_longlong value) { diff --git a/src/CppUTest/Utest.cpp b/src/CppUTest/Utest.cpp index 7209b420e..05718003f 100644 --- a/src/CppUTest/Utest.cpp +++ b/src/CppUTest/Utest.cpp @@ -486,7 +486,7 @@ void UtestShell::assertUnsignedLongsEqual(unsigned long expected, unsigned long void UtestShell::assertLongLongsEqual(cpputest_longlong expected, cpputest_longlong actual, const char* text, const char* fileName, size_t lineNumber, const TestTerminator& testTerminator) { getTestResult()->countCheck(); -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG if (expected != actual) failWith(LongLongsEqualFailure(this, fileName, lineNumber, expected, actual, text), testTerminator); #else @@ -499,7 +499,7 @@ void UtestShell::assertLongLongsEqual(cpputest_longlong expected, cpputest_longl void UtestShell::assertUnsignedLongLongsEqual(cpputest_ulonglong expected, cpputest_ulonglong actual, const char* text, const char* fileName, size_t lineNumber, const TestTerminator& testTerminator) { getTestResult()->countCheck(); -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG if (expected != actual) failWith(UnsignedLongLongsEqualFailure(this, fileName, lineNumber, expected, actual, text), testTerminator); #else diff --git a/src/CppUTestExt/MockActualCall.cpp b/src/CppUTestExt/MockActualCall.cpp index 1b5e0394f..0d93e1ce4 100644 --- a/src/CppUTestExt/MockActualCall.cpp +++ b/src/CppUTestExt/MockActualCall.cpp @@ -241,7 +241,7 @@ MockActualCall& MockCheckedActualCall::withLongIntParameter(const SimpleString& return *this; } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG MockActualCall& MockCheckedActualCall::withUnsignedLongLongIntParameter(const SimpleString& name, cpputest_ulonglong value) { @@ -472,7 +472,7 @@ long int MockCheckedActualCall::returnLongIntValueOrDefault(long int default_val return returnLongIntValue(); } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG cpputest_ulonglong MockCheckedActualCall::returnUnsignedLongLongIntValue() { @@ -727,7 +727,7 @@ MockActualCall& MockActualCallTrace::withLongIntParameter(const SimpleString& na return *this; } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG MockActualCall& MockActualCallTrace::withUnsignedLongLongIntParameter(const SimpleString& name, cpputest_ulonglong value) { @@ -856,7 +856,7 @@ long int MockActualCallTrace::returnLongIntValueOrDefault(long int) return 0; } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG cpputest_longlong MockActualCallTrace::returnLongLongIntValue() { diff --git a/src/CppUTestExt/MockExpectedCall.cpp b/src/CppUTestExt/MockExpectedCall.cpp index a2cc8823e..867cb2706 100644 --- a/src/CppUTestExt/MockExpectedCall.cpp +++ b/src/CppUTestExt/MockExpectedCall.cpp @@ -125,7 +125,7 @@ MockExpectedCall& MockCheckedExpectedCall::withUnsignedLongIntParameter(const Si return *this; } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG MockExpectedCall& MockCheckedExpectedCall::withLongLongIntParameter(const SimpleString& name, cpputest_longlong value) { @@ -514,7 +514,7 @@ MockExpectedCall& MockCheckedExpectedCall::andReturnValue(unsigned long int valu return *this; } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG MockExpectedCall& MockCheckedExpectedCall::andReturnValue(cpputest_longlong value) { diff --git a/src/CppUTestExt/MockNamedValue.cpp b/src/CppUTestExt/MockNamedValue.cpp index 50fe209d1..b5eed42bb 100644 --- a/src/CppUTestExt/MockNamedValue.cpp +++ b/src/CppUTestExt/MockNamedValue.cpp @@ -82,7 +82,7 @@ void MockNamedValue::setValue(unsigned long int value) value_.unsignedLongIntValue_ = value; } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG void MockNamedValue::setValue(cpputest_longlong value) { @@ -246,7 +246,7 @@ unsigned long int MockNamedValue::getUnsignedLongIntValue() const } } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG cpputest_longlong MockNamedValue::getLongLongIntValue() const { @@ -393,7 +393,7 @@ bool MockNamedValue::equals(const MockNamedValue& p) const return (value_.longIntValue_ >= 0) && ((unsigned long)value_.longIntValue_ == p.value_.unsignedLongIntValue_); else if((type_ == "unsigned long int") && (p.type_ == "long int")) return (p.value_.longIntValue_ >= 0) && (value_.unsignedLongIntValue_ == (unsigned long) p.value_.longIntValue_); -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG else if ((type_ == "long long int") && (p.type_ == "int")) return value_.longLongIntValue_ == p.value_.intValue_; else if ((type_ == "int") && (p.type_ == "long long int")) @@ -444,7 +444,7 @@ bool MockNamedValue::equals(const MockNamedValue& p) const return value_.longIntValue_ == p.value_.longIntValue_; else if (type_ == "unsigned long int") return value_.unsignedLongIntValue_ == p.value_.unsignedLongIntValue_; -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG else if (type_ == "long long int") return value_.longLongIntValue_ == p.value_.longLongIntValue_; else if (type_ == "unsigned long long int") @@ -496,7 +496,7 @@ SimpleString MockNamedValue::toString() const return StringFrom(value_.longIntValue_) + " " + BracketsFormattedHexStringFrom(value_.longIntValue_); else if (type_ == "unsigned long int") return StringFrom(value_.unsignedLongIntValue_) + " " + BracketsFormattedHexStringFrom(value_.unsignedLongIntValue_); -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG else if (type_ == "long long int") return StringFrom(value_.longLongIntValue_) + " " + BracketsFormattedHexStringFrom(value_.longLongIntValue_); else if (type_ == "unsigned long long int") diff --git a/src/CppUTestExt/MockSupport.cpp b/src/CppUTestExt/MockSupport.cpp index 45f58b4eb..f55c96af7 100644 --- a/src/CppUTestExt/MockSupport.cpp +++ b/src/CppUTestExt/MockSupport.cpp @@ -546,7 +546,7 @@ unsigned long int MockSupport::unsignedLongIntReturnValue() return returnValue().getUnsignedLongIntValue(); } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG cpputest_longlong MockSupport::longLongIntReturnValue() { diff --git a/src/CppUTestExt/MockSupport_c.cpp b/src/CppUTestExt/MockSupport_c.cpp index ddfd24070..0a4f0cbca 100644 --- a/src/CppUTestExt/MockSupport_c.cpp +++ b/src/CppUTestExt/MockSupport_c.cpp @@ -408,7 +408,7 @@ MockExpectedCall_c* withUnsignedLongIntParameters_c(const char* name, unsigned l return &gExpectedCall; } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG MockExpectedCall_c* withLongLongIntParameters_c(const char* name, cpputest_longlong value) { @@ -540,7 +540,7 @@ MockExpectedCall_c* andReturnUnsignedLongIntValue_c(unsigned long int value) return &gExpectedCall; } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG MockExpectedCall_c* andReturnLongLongIntValue_c(cpputest_longlong value) { @@ -623,7 +623,7 @@ static MockValue_c getMockValueCFromNamedValue(const MockNamedValue& namedValue) returnValue.type = MOCKVALUETYPE_UNSIGNED_LONG_INTEGER; returnValue.value.unsignedLongIntValue = namedValue.getUnsignedLongIntValue(); } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG else if (SimpleString::StrCmp(namedValue.getType().asCharString(), "long long int") == 0) { returnValue.type = MOCKVALUETYPE_LONG_LONG_INTEGER; returnValue.value.longLongIntValue = namedValue.getLongLongIntValue(); @@ -722,7 +722,7 @@ MockActualCall_c* withActualUnsignedLongIntParameters_c(const char* name, unsign return &gActualCall; } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG MockActualCall_c* withActualLongLongIntParameters_c(const char* name, cpputest_longlong value) { @@ -876,7 +876,7 @@ unsigned long int returnUnsignedLongIntValueOrDefault_c(unsigned long int defaul return unsignedLongIntReturnValue_c(); } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG cpputest_longlong longLongIntReturnValue_c() { diff --git a/tests/CppUTest/SimpleStringTest.cpp b/tests/CppUTest/SimpleStringTest.cpp index cf65d6053..f5372e7cb 100644 --- a/tests/CppUTest/SimpleStringTest.cpp +++ b/tests/CppUTest/SimpleStringTest.cpp @@ -640,7 +640,7 @@ TEST(SimpleString, UnsignedLongInts) CHECK(s == s2); } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG TEST(SimpleString, LongLongInts) { @@ -710,7 +710,7 @@ TEST(SimpleString, HexStrings) SimpleString h1 = HexStringFrom(0xffffL); STRCMP_EQUAL("ffff", h1.asCharString()); -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG SimpleString h15 = HexStringFrom(0xffffLL); STRCMP_EQUAL("ffff", h15.asCharString()); #endif @@ -1246,7 +1246,7 @@ TEST(SimpleString, BracketsFormattedHexStringFromForLong) STRCMP_EQUAL("(0x1)", BracketsFormattedHexStringFrom(value).asCharString()); } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG TEST(SimpleString, BracketsFormattedHexStringFromForLongLong) { diff --git a/tests/CppUTest/TestFailureTest.cpp b/tests/CppUTest/TestFailureTest.cpp index 60a465b66..e1c33d587 100644 --- a/tests/CppUTest/TestFailureTest.cpp +++ b/tests/CppUTest/TestFailureTest.cpp @@ -141,7 +141,7 @@ TEST(TestFailure, LongsEqualFailure) TEST(TestFailure, LongLongsEqualFailure) { -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG LongLongsEqualFailure f(test, failFileName, failLineNumber, 1, 2, ""); FAILURE_EQUAL("expected <1 (0x1)>\n\tbut was <2 (0x2)>", f); #else @@ -153,7 +153,7 @@ TEST(TestFailure, LongLongsEqualFailure) TEST(TestFailure, UnsignedLongLongsEqualFailure) { -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG UnsignedLongLongsEqualFailure f(test, failFileName, failLineNumber, 1, 2, ""); FAILURE_EQUAL("expected <1 (0x1)>\n\tbut was <2 (0x2)>", f); #else diff --git a/tests/CppUTest/TestHarness_cTest.cpp b/tests/CppUTest/TestHarness_cTest.cpp index 08be8400e..1f9b86cde 100644 --- a/tests/CppUTest/TestHarness_cTest.cpp +++ b/tests/CppUTest/TestHarness_cTest.cpp @@ -251,7 +251,7 @@ TEST(TestHarness_c, checkUnsignedLongIntText) CHECK(!hasDestructorOfTheDestructorCheckedBeenCalled); } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG static void failLongLongIntMethod_() { diff --git a/tests/CppUTest/TestUTestMacro.cpp b/tests/CppUTest/TestUTestMacro.cpp index 4084c8bec..dce3aa17d 100644 --- a/tests/CppUTest/TestUTestMacro.cpp +++ b/tests/CppUTest/TestUTestMacro.cpp @@ -128,7 +128,7 @@ IGNORE_TEST(UnitTestMacros, UNSIGNED_LONGS_EQUAL_TEXTWorksInAnIgnoredTest) UNSIGNED_LONGS_EQUAL_TEXT(1, 0, "Failed because it failed"); // LCOV_EXCL_LINE } // LCOV_EXCL_LINE -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG static void LONGLONGS_EQUALTestMethod_() { diff --git a/tests/CppUTestExt/MockActualCallTest.cpp b/tests/CppUTestExt/MockActualCallTest.cpp index 56e65f5ba..8fe720177 100644 --- a/tests/CppUTestExt/MockActualCallTest.cpp +++ b/tests/CppUTestExt/MockActualCallTest.cpp @@ -164,7 +164,7 @@ TEST(MockCheckedActualCall, MockIgnoredActualCallWorksAsItShould) CHECK(1l == actual.returnLongIntValueOrDefault(1l)); CHECK(0 == actual.returnUnsignedIntValue()); CHECK(1u == actual.returnUnsignedIntValueOrDefault(1u)); -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG CHECK(0 == actual.returnLongLongIntValue()); CHECK(1ll == actual.returnLongLongIntValueOrDefault(1ll)); CHECK(0 == actual.returnUnsignedLongLongIntValue()); @@ -199,7 +199,7 @@ TEST(MockCheckedActualCall, remainderOfMockActualCallTraceWorksAsItShould) actual.withUnsignedIntParameter("unsigned_int", (unsigned int) 1); actual.withUnsignedLongIntParameter("unsigned_long", (unsigned long)1); actual.withLongIntParameter("long_int", (long int) 1); -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG actual.withLongLongIntParameter("long_long_int", (long long int) 1); actual.withUnsignedLongLongIntParameter("unsigned_long_long_int", (unsigned long long int) 1); #endif @@ -217,7 +217,7 @@ TEST(MockCheckedActualCall, remainderOfMockActualCallTraceWorksAsItShould) expectedString += " unsigned_int:1 (0x1)"; expectedString += " unsigned_long:1 (0x1)"; expectedString += " long_int:1 (0x1)"; -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG expectedString += " long_long_int:1 (0x1)"; expectedString += " unsigned_long_long_int:1 (0x1)"; #endif @@ -243,7 +243,7 @@ TEST(MockCheckedActualCall, remainderOfMockActualCallTraceWorksAsItShould) CHECK(0 == actual.returnIntValueOrDefault(1)); CHECK(0 == actual.returnLongIntValue()); CHECK(0 == actual.returnLongIntValueOrDefault(1l)); -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG CHECK(0 == actual.returnLongLongIntValue()); CHECK(0 == actual.returnLongLongIntValueOrDefault(1ll)); CHECK(0 == actual.returnUnsignedLongLongIntValue()); diff --git a/tests/CppUTestExt/MockExpectedCallTest.cpp b/tests/CppUTestExt/MockExpectedCallTest.cpp index 0fb52cd97..d8af458cc 100644 --- a/tests/CppUTestExt/MockExpectedCallTest.cpp +++ b/tests/CppUTestExt/MockExpectedCallTest.cpp @@ -232,7 +232,7 @@ TEST(MockExpectedCall, callWithLongIntegerParameter) STRCMP_CONTAINS("funcName -> long int paramName: <777 (0x309)>", call->callToString().asCharString()); } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG TEST(MockExpectedCall, callWithUnsignedLongLongIntegerParameter) { @@ -780,7 +780,7 @@ TEST(MockIgnoredExpectedCall, worksAsItShould) ignored.withUnsignedIntParameter("foo", (unsigned int) 1); ignored.withLongIntParameter("hey", (long int) 1); ignored.withUnsignedLongIntParameter("bah", (unsigned long int) 1); -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG ignored.withLongLongIntParameter("yo", (long long int) 1); ignored.withUnsignedLongLongIntParameter("grr", (unsigned long long int) 1); #endif @@ -802,7 +802,7 @@ TEST(MockIgnoredExpectedCall, worksAsItShould) ignored.andReturnValue((int) 1); ignored.andReturnValue((unsigned long int) 1); ignored.andReturnValue((long int) 1); -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG ignored.andReturnValue((unsigned long long int) 1); ignored.andReturnValue((long long int) 1); #endif diff --git a/tests/CppUTestExt/MockParameterTest.cpp b/tests/CppUTestExt/MockParameterTest.cpp index 828d4e59b..1bad85998 100644 --- a/tests/CppUTestExt/MockParameterTest.cpp +++ b/tests/CppUTestExt/MockParameterTest.cpp @@ -63,7 +63,7 @@ TEST(MockParameterTest, expectOneIntegerParameterAndValue) mock().checkExpectations(); } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG TEST(MockParameterTest, expectOneUnsignedLongLongIntegerParameterAndValue) { @@ -152,7 +152,7 @@ TEST(MockParameterTest, mismatchedIntegerTypesLongAndUnsignedLongAreAllowed) mock().checkExpectations(); } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG TEST(MockParameterTest, mismatchedIntegerTypesIntAndLongLongAreAllowed) { @@ -889,7 +889,7 @@ TEST(MockParameterTest, ignoreOtherCallsIgnoresWithAllKindsOfParameters) .withParameter("bar", 1u) .withParameter("foo", 1l) .withParameter("hey", 1ul) -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG .withParameter("ick", 1ll) .withParameter("grr", 1ull) #endif diff --git a/tests/CppUTestExt/MockReturnValueTest.cpp b/tests/CppUTestExt/MockReturnValueTest.cpp index f8c271c94..6bb4be15f 100644 --- a/tests/CppUTestExt/MockReturnValueTest.cpp +++ b/tests/CppUTestExt/MockReturnValueTest.cpp @@ -106,7 +106,7 @@ TEST(MockReturnValueTest, UnsignedIntReturnValueCanBeRetrievedAsUnsignedLongInt) UNSIGNED_LONGS_EQUAL(expected_value, mock().actualCall("foo").returnValue().getUnsignedLongIntValue()); } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG TEST(MockReturnValueTest, PositiveIntReturnValueCanBeRetrievedAsUnsignedLongLongInt) { @@ -284,7 +284,7 @@ TEST(MockReturnValueTest, WhenNoLongIntegerReturnValueIsExpectedButThereIsADefau LONGS_EQUAL(default_return_value, mock().returnLongIntValueOrDefault(default_return_value)); } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG TEST(MockReturnValueTest, WhenAUnsignedLongLongIntegerReturnValueIsExpectedAndAlsoThereIsADefaultShouldlIgnoreTheDefault) { @@ -518,7 +518,7 @@ TEST(MockReturnValueTest, UnsignedLongIntegerReturnValueSetsDifferentValuesWhile LONGS_EQUAL(another_ret_value, mock().returnValue().getUnsignedLongIntValue()); } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG TEST(MockReturnValueTest, LongLongIntegerReturnValue) { diff --git a/tests/CppUTestExt/MockSupport_cTest.cpp b/tests/CppUTestExt/MockSupport_cTest.cpp index 1d1a5aa99..d088b664b 100644 --- a/tests/CppUTestExt/MockSupport_cTest.cpp +++ b/tests/CppUTestExt/MockSupport_cTest.cpp @@ -164,7 +164,7 @@ TEST(MockSupport_c, doubleParameterWithTolerance) mock_c( )->actualCall("foo")->withDoubleParameters("p", 1.9); } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG TEST(MockSupport_c, longLongIntParameter) { @@ -369,7 +369,7 @@ TEST(MockSupport_c, whenNoReturnValueIsGivenReturnUnsignedLongIntValueOrDefaultS LONGS_EQUAL(defaultValue, mock_c()->returnUnsignedLongIntValueOrDefault(defaultValue)); } -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG TEST(MockSupport_c, returnLongLongIntValue) { diff --git a/tests/CppUTestExt/MockSupport_cTestCFile.c b/tests/CppUTestExt/MockSupport_cTestCFile.c index 77e4bdabd..be68819f8 100644 --- a/tests/CppUTestExt/MockSupport_cTestCFile.c +++ b/tests/CppUTestExt/MockSupport_cTestCFile.c @@ -53,7 +53,7 @@ void all_mock_support_c_calls(void) withUnsignedIntParameters("unsigned", 1)-> withLongIntParameters("long int", (long int) -1)-> withUnsignedLongIntParameters("unsigned long int", (unsigned long int) 1)-> -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG withLongLongIntParameters("long long int", (long long int) -1)-> withUnsignedLongLongIntParameters("unsigned long long int", (unsigned long long int) 1)-> #endif @@ -72,7 +72,7 @@ void all_mock_support_c_calls(void) withUnsignedIntParameters("unsigned", 1)-> withLongIntParameters("long int", (long int) -1)-> withUnsignedLongIntParameters("unsigned long int", (unsigned long int) 1)-> -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG withLongLongIntParameters("long long int", (long long int) -1)-> withUnsignedLongLongIntParameters("unsigned long long int", (unsigned long long int) 1)-> #endif @@ -123,7 +123,7 @@ void all_mock_support_c_calls(void) mock_c()->actualCall("boo3")->unsignedLongIntReturnValue(); mock_c()->unsignedLongIntReturnValue(); -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG mock_c()->expectOneCall("mgrgrgr1")->andReturnLongLongIntValue(1); mock_c()->actualCall("mgrgrgr1")->longLongIntReturnValue(); mock_c()->longLongIntReturnValue(); @@ -189,7 +189,7 @@ void all_mock_support_c_calls(void) mock_c()->returnUnsignedIntValueOrDefault(1); mock_c()->returnLongIntValueOrDefault(-1L); mock_c()->returnUnsignedLongIntValueOrDefault(1L); -#ifdef CPPUTEST_USE_LONG_LONG +#if CPPUTEST_USE_LONG_LONG mock_c()->returnLongLongIntValueOrDefault(-1LL); mock_c()->returnUnsignedLongLongIntValueOrDefault(1ULL); #endif From 9b9519c775d7fe78aa4daaece8f50c0676b3fd30 Mon Sep 17 00:00:00 2001 From: Chad Condon Date: Tue, 27 Sep 2022 20:14:26 -0700 Subject: [PATCH 4/6] Ensure CPPUTEST_USE_LONG_LONG is defined --- include/CppUTest/CppUTestConfig.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/include/CppUTest/CppUTestConfig.h b/include/CppUTest/CppUTestConfig.h index 399198d30..2286b98e1 100644 --- a/include/CppUTest/CppUTestConfig.h +++ b/include/CppUTest/CppUTestConfig.h @@ -274,10 +274,11 @@ * LLONG_MAX is set in limits.h. This is a crude attempt to detect long long support when no configure is used * */ - -#if !defined(CPPUTEST_LONG_LONG_DISABLED) && !defined(CPPUTEST_USE_LONG_LONG) -#if defined(CPPUTEST_HAVE_LONG_LONG_INT) || defined(LLONG_MAX) +#ifndef CPPUTEST_USE_LONG_LONG +#if !defined(CPPUTEST_LONG_LONG_DISABLED) && (defined(CPPUTEST_HAVE_LONG_LONG_INT) || defined(LLONG_MAX)) #define CPPUTEST_USE_LONG_LONG 1 +#else +#define CPPUTEST_USE_LONG_LONG 0 #endif #endif From bc829cce5366783fbc950074883f05b8fb4254f1 Mon Sep 17 00:00:00 2001 From: Chad Condon Date: Tue, 27 Sep 2022 22:03:46 -0700 Subject: [PATCH 5/6] Reconcile C and C++ long long dummy typedefs We can't return C++ classes (i.e. with constructors) from functions with C linkage. --- include/CppUTest/CppUTestConfig.h | 23 ++++++++------------ include/CppUTest/UtestMacros.h | 2 ++ include/CppUTestExt/MockCheckedActualCall.h | 22 +++++++++++++++++-- src/CppUTestExt/MockActualCall.cpp | 18 ++++++++++------ src/CppUTestExt/MockNamedValue.cpp | 6 ++++-- src/CppUTestExt/MockSupport.cpp | 6 ++++-- src/CppUTestExt/MockSupport_c.cpp | 12 +++++++---- tests/CppUTest/SimpleStringTest.cpp | 4 ++-- tests/CppUTest/TestUTestMacro.cpp | 24 --------------------- 9 files changed, 61 insertions(+), 56 deletions(-) diff --git a/include/CppUTest/CppUTestConfig.h b/include/CppUTest/CppUTestConfig.h index 2286b98e1..48213a416 100644 --- a/include/CppUTest/CppUTestConfig.h +++ b/include/CppUTest/CppUTestConfig.h @@ -296,27 +296,22 @@ typedef unsigned long long cpputest_ulonglong; #define CPPUTEST_SIZE_OF_FAKE_LONG_LONG_TYPE 8 #endif -struct cpputest_longlong -{ #if defined(__cplusplus) - cpputest_longlong() {} - cpputest_longlong(int) {} +extern "C" { #endif + +typedef struct +{ char dummy[CPPUTEST_SIZE_OF_FAKE_LONG_LONG_TYPE]; -}; +} cpputest_longlong; -struct cpputest_ulonglong +typedef struct { -#if defined(__cplusplus) - cpputest_ulonglong() {} - cpputest_ulonglong(int) {} -#endif char dummy[CPPUTEST_SIZE_OF_FAKE_LONG_LONG_TYPE]; -}; +} cpputest_ulonglong; -#if !defined(__cplusplus) -typedef struct cpputest_longlong cpputest_longlong; -typedef struct cpputest_ulonglong cpputest_ulonglong; +#if defined(__cplusplus) +} /* extern "C" */ #endif #endif diff --git a/include/CppUTest/UtestMacros.h b/include/CppUTest/UtestMacros.h index e47bfa649..249ff7c40 100644 --- a/include/CppUTest/UtestMacros.h +++ b/include/CppUTest/UtestMacros.h @@ -226,6 +226,7 @@ #define UNSIGNED_LONGS_EQUAL_LOCATION(expected, actual, text, file, line)\ do { UtestShell::getCurrent()->assertUnsignedLongsEqual((unsigned long)expected, (unsigned long)actual, text, file, line); } while(0) +#if CPPUTEST_USE_LONG_LONG #define LONGLONGS_EQUAL(expected, actual)\ LONGLONGS_EQUAL_LOCATION(expected, actual, NULLPTR, __FILE__, __LINE__) @@ -243,6 +244,7 @@ #define UNSIGNED_LONGLONGS_EQUAL_LOCATION(expected, actual, text, file, line)\ do { UtestShell::getCurrent()->assertUnsignedLongLongsEqual((cpputest_ulonglong)expected, (cpputest_ulonglong)actual, text, file, line); } while(0) +#endif // CPPUTEST_USE_LONG_LONG #define BYTES_EQUAL(expected, actual)\ LONGS_EQUAL((expected) & 0xff,(actual) & 0xff) diff --git a/include/CppUTestExt/MockCheckedActualCall.h b/include/CppUTestExt/MockCheckedActualCall.h index 68982780a..637661403 100644 --- a/include/CppUTestExt/MockCheckedActualCall.h +++ b/include/CppUTestExt/MockCheckedActualCall.h @@ -269,10 +269,28 @@ class MockIgnoredActualCall: public MockActualCall virtual long int returnLongIntValue() _override { return 0; } virtual long int returnLongIntValueOrDefault(long int value) _override { return value; } - virtual cpputest_ulonglong returnUnsignedLongLongIntValue() _override { return 0; } + virtual cpputest_ulonglong returnUnsignedLongLongIntValue() _override + { +#if CPPUTEST_USE_LONG_LONG + return 0; +#else + cpputest_ulonglong ret; + return ret; +#endif + } + virtual cpputest_ulonglong returnUnsignedLongLongIntValueOrDefault(cpputest_ulonglong value) _override { return value; } - virtual cpputest_longlong returnLongLongIntValue() _override { return 0; } + virtual cpputest_longlong returnLongLongIntValue() _override + { +#if CPPUTEST_USE_LONG_LONG + return 0; +#else + cpputest_longlong ret; + return ret; +#endif + } + virtual cpputest_longlong returnLongLongIntValueOrDefault(cpputest_longlong value) _override { return value; } virtual unsigned int returnUnsignedIntValue() _override { return 0; } diff --git a/src/CppUTestExt/MockActualCall.cpp b/src/CppUTestExt/MockActualCall.cpp index 0d93e1ce4..fd165947c 100644 --- a/src/CppUTestExt/MockActualCall.cpp +++ b/src/CppUTestExt/MockActualCall.cpp @@ -505,7 +505,8 @@ cpputest_longlong MockCheckedActualCall::returnLongLongIntValueOrDefault(cpputes cpputest_ulonglong MockCheckedActualCall::returnUnsignedLongLongIntValue() { FAIL("Unsigned Long Long type is not supported"); - return cpputest_ulonglong(0); + cpputest_ulonglong ret; + return ret; } cpputest_ulonglong MockCheckedActualCall::returnUnsignedLongLongIntValueOrDefault(cpputest_ulonglong default_value) @@ -517,7 +518,8 @@ cpputest_ulonglong MockCheckedActualCall::returnUnsignedLongLongIntValueOrDefaul cpputest_longlong MockCheckedActualCall::returnLongLongIntValue() { FAIL("Long Long type is not supported"); - return cpputest_longlong(0); + cpputest_longlong ret; + return ret; } cpputest_longlong MockCheckedActualCall::returnLongLongIntValueOrDefault(cpputest_longlong default_value) @@ -883,25 +885,29 @@ cpputest_longlong MockActualCallTrace::returnLongLongIntValueOrDefault(cpputest_ cpputest_longlong MockActualCallTrace::returnLongLongIntValue() { FAIL("Long Long type is not supported"); - return cpputest_longlong(0); + cpputest_longlong ret; + return ret; } cpputest_ulonglong MockActualCallTrace::returnUnsignedLongLongIntValue() { FAIL("Unsigned Long Long type is not supported"); - return cpputest_ulonglong(0); + cpputest_ulonglong ret; + return ret; } cpputest_ulonglong MockActualCallTrace::returnUnsignedLongLongIntValueOrDefault(cpputest_ulonglong) { FAIL("Unsigned Long Long type is not supported"); - return cpputest_ulonglong(0); + cpputest_ulonglong ret; + return ret; } cpputest_longlong MockActualCallTrace::returnLongLongIntValueOrDefault(cpputest_longlong) { FAIL("Long Long type is not supported"); - return cpputest_longlong(0); + cpputest_longlong ret; + return ret; } #endif diff --git a/src/CppUTestExt/MockNamedValue.cpp b/src/CppUTestExt/MockNamedValue.cpp index b5eed42bb..5ef0dff79 100644 --- a/src/CppUTestExt/MockNamedValue.cpp +++ b/src/CppUTestExt/MockNamedValue.cpp @@ -289,13 +289,15 @@ cpputest_ulonglong MockNamedValue::getUnsignedLongLongIntValue() const cpputest_longlong MockNamedValue::getLongLongIntValue() const { FAIL("Long Long type is not supported"); - return cpputest_longlong(0); + cpputest_longlong ret; + return ret; } cpputest_ulonglong MockNamedValue::getUnsignedLongLongIntValue() const { FAIL("Unsigned Long Long type is not supported"); - return cpputest_ulonglong(0); + cpputest_ulonglong ret; + return ret; } #endif diff --git a/src/CppUTestExt/MockSupport.cpp b/src/CppUTestExt/MockSupport.cpp index f55c96af7..44e307c43 100644 --- a/src/CppUTestExt/MockSupport.cpp +++ b/src/CppUTestExt/MockSupport.cpp @@ -579,13 +579,15 @@ cpputest_ulonglong MockSupport::returnUnsignedLongLongIntValueOrDefault(cpputest cpputest_longlong MockSupport::longLongIntReturnValue() { FAIL("Long Long type is not supported"); - return cpputest_longlong(0); + cpputest_longlong ret; + return ret; } cpputest_ulonglong MockSupport::unsignedLongLongIntReturnValue() { FAIL("Unsigned Long Long type is not supported"); - return cpputest_ulonglong(0); + cpputest_ulonglong ret; + return ret; } cpputest_longlong MockSupport::returnLongLongIntValueOrDefault(cpputest_longlong defaultValue) diff --git a/src/CppUTestExt/MockSupport_c.cpp b/src/CppUTestExt/MockSupport_c.cpp index 0a4f0cbca..cd04f13b1 100644 --- a/src/CppUTestExt/MockSupport_c.cpp +++ b/src/CppUTestExt/MockSupport_c.cpp @@ -909,25 +909,29 @@ cpputest_ulonglong returnUnsignedLongLongIntValueOrDefault_c(cpputest_ulonglong cpputest_longlong longLongIntReturnValue_c() { FAIL("Long Long type is not supported"); - return cpputest_longlong(0); + cpputest_longlong ret; + return ret; } cpputest_longlong returnLongLongIntValueOrDefault_c(cpputest_longlong) { FAIL("Long Long type is not supported"); - return cpputest_longlong(0); + cpputest_longlong ret; + return ret; } cpputest_ulonglong unsignedLongLongIntReturnValue_c() { FAIL("Unsigned Long Long type is not supported"); - return cpputest_ulonglong(0); + cpputest_ulonglong ret; + return ret; } cpputest_ulonglong returnUnsignedLongLongIntValueOrDefault_c(cpputest_ulonglong) { FAIL("Unsigned Long Long type is not supported"); - return cpputest_ulonglong(0); + cpputest_ulonglong ret; + return ret; } #endif diff --git a/tests/CppUTest/SimpleStringTest.cpp b/tests/CppUTest/SimpleStringTest.cpp index f5372e7cb..f8c303daf 100644 --- a/tests/CppUTest/SimpleStringTest.cpp +++ b/tests/CppUTest/SimpleStringTest.cpp @@ -1263,13 +1263,13 @@ TEST(SimpleString, BracketsFormattedHexStringFromForULongLong) #else TEST(SimpleString, BracketsFormattedHexStringFromForLongLong) { - cpputest_longlong value = 1; + cpputest_longlong value; STRCMP_EQUAL("", BracketsFormattedHexStringFrom(value).asCharString()); } TEST(SimpleString, BracketsFormattedHexStringFromForULongLong) { - cpputest_ulonglong value = 1; + cpputest_ulonglong value; STRCMP_EQUAL("", BracketsFormattedHexStringFrom(value).asCharString()); } diff --git a/tests/CppUTest/TestUTestMacro.cpp b/tests/CppUTest/TestUTestMacro.cpp index dce3aa17d..27521d70f 100644 --- a/tests/CppUTest/TestUTestMacro.cpp +++ b/tests/CppUTest/TestUTestMacro.cpp @@ -226,30 +226,6 @@ IGNORE_TEST(UnitTestMacros, UNSIGNED_LONGLONGS_EQUAL_TEXTWorksInAnIgnoredTest) UNSIGNED_LONGLONGS_EQUAL_TEXT(1, 0, "Failed because it failed"); // LCOV_EXCL_LINE } // LCOV_EXCL_LINE -#else - -static void LONGLONGS_EQUALFailsWithUnsupportedFeatureTestMethod_() -{ - LONGLONGS_EQUAL(1, 1); -} // LCOV_EXCL_LINE - -static void UNSIGNED_LONGLONGS_EQUALFailsWithUnsupportedFeatureTestMethod_() -{ - UNSIGNED_LONGLONGS_EQUAL(1, 1); -} // LCOV_EXCL_LINE - -TEST(UnitTestMacros, LONGLONGS_EQUALFailsWithUnsupportedFeature) -{ - fixture.runTestWithMethod(LONGLONGS_EQUALFailsWithUnsupportedFeatureTestMethod_); - CHECK_TEST_FAILS_PROPER_WITH_TEXT("\"CPPUTEST_USE_LONG_LONG\" is not supported"); -} - -TEST(UnitTestMacros, UNSIGNED_LONGLONGS_EQUALFailsWithUnsupportedFeature) -{ - fixture.runTestWithMethod(UNSIGNED_LONGLONGS_EQUALFailsWithUnsupportedFeatureTestMethod_); - CHECK_TEST_FAILS_PROPER_WITH_TEXT("\"CPPUTEST_USE_LONG_LONG\" is not supported"); -} - #endif /* CPPUTEST_USE_LONG_LONG */ static void failingTestMethodWithCHECK_() From ccae5bec8cfbd7e526f4bfd1981adcb3f2cf5c91 Mon Sep 17 00:00:00 2001 From: Chad Condon Date: Mon, 31 Oct 2022 12:18:01 -0700 Subject: [PATCH 6/6] Resolve GCC warnings --- include/CppUTestExt/MockCheckedActualCall.h | 4 ++-- src/CppUTestExt/MockActualCall.cpp | 12 ++++++------ src/CppUTestExt/MockNamedValue.cpp | 4 ++-- src/CppUTestExt/MockSupport.cpp | 4 ++-- src/CppUTestExt/MockSupport_c.cpp | 8 ++++---- 5 files changed, 16 insertions(+), 16 deletions(-) diff --git a/include/CppUTestExt/MockCheckedActualCall.h b/include/CppUTestExt/MockCheckedActualCall.h index 637661403..48c3807bb 100644 --- a/include/CppUTestExt/MockCheckedActualCall.h +++ b/include/CppUTestExt/MockCheckedActualCall.h @@ -274,7 +274,7 @@ class MockIgnoredActualCall: public MockActualCall #if CPPUTEST_USE_LONG_LONG return 0; #else - cpputest_ulonglong ret; + cpputest_ulonglong ret = {}; return ret; #endif } @@ -286,7 +286,7 @@ class MockIgnoredActualCall: public MockActualCall #if CPPUTEST_USE_LONG_LONG return 0; #else - cpputest_longlong ret; + cpputest_longlong ret = {}; return ret; #endif } diff --git a/src/CppUTestExt/MockActualCall.cpp b/src/CppUTestExt/MockActualCall.cpp index fd165947c..bd8cbddd0 100644 --- a/src/CppUTestExt/MockActualCall.cpp +++ b/src/CppUTestExt/MockActualCall.cpp @@ -505,7 +505,7 @@ cpputest_longlong MockCheckedActualCall::returnLongLongIntValueOrDefault(cpputes cpputest_ulonglong MockCheckedActualCall::returnUnsignedLongLongIntValue() { FAIL("Unsigned Long Long type is not supported"); - cpputest_ulonglong ret; + cpputest_ulonglong ret = {}; return ret; } @@ -518,7 +518,7 @@ cpputest_ulonglong MockCheckedActualCall::returnUnsignedLongLongIntValueOrDefaul cpputest_longlong MockCheckedActualCall::returnLongLongIntValue() { FAIL("Long Long type is not supported"); - cpputest_longlong ret; + cpputest_longlong ret = {}; return ret; } @@ -885,28 +885,28 @@ cpputest_longlong MockActualCallTrace::returnLongLongIntValueOrDefault(cpputest_ cpputest_longlong MockActualCallTrace::returnLongLongIntValue() { FAIL("Long Long type is not supported"); - cpputest_longlong ret; + cpputest_longlong ret = {}; return ret; } cpputest_ulonglong MockActualCallTrace::returnUnsignedLongLongIntValue() { FAIL("Unsigned Long Long type is not supported"); - cpputest_ulonglong ret; + cpputest_ulonglong ret = {}; return ret; } cpputest_ulonglong MockActualCallTrace::returnUnsignedLongLongIntValueOrDefault(cpputest_ulonglong) { FAIL("Unsigned Long Long type is not supported"); - cpputest_ulonglong ret; + cpputest_ulonglong ret = {}; return ret; } cpputest_longlong MockActualCallTrace::returnLongLongIntValueOrDefault(cpputest_longlong) { FAIL("Long Long type is not supported"); - cpputest_longlong ret; + cpputest_longlong ret = {}; return ret; } diff --git a/src/CppUTestExt/MockNamedValue.cpp b/src/CppUTestExt/MockNamedValue.cpp index 5ef0dff79..f7bc0565f 100644 --- a/src/CppUTestExt/MockNamedValue.cpp +++ b/src/CppUTestExt/MockNamedValue.cpp @@ -289,14 +289,14 @@ cpputest_ulonglong MockNamedValue::getUnsignedLongLongIntValue() const cpputest_longlong MockNamedValue::getLongLongIntValue() const { FAIL("Long Long type is not supported"); - cpputest_longlong ret; + cpputest_longlong ret = {}; return ret; } cpputest_ulonglong MockNamedValue::getUnsignedLongLongIntValue() const { FAIL("Unsigned Long Long type is not supported"); - cpputest_ulonglong ret; + cpputest_ulonglong ret = {}; return ret; } diff --git a/src/CppUTestExt/MockSupport.cpp b/src/CppUTestExt/MockSupport.cpp index 44e307c43..1c76c9a73 100644 --- a/src/CppUTestExt/MockSupport.cpp +++ b/src/CppUTestExt/MockSupport.cpp @@ -579,14 +579,14 @@ cpputest_ulonglong MockSupport::returnUnsignedLongLongIntValueOrDefault(cpputest cpputest_longlong MockSupport::longLongIntReturnValue() { FAIL("Long Long type is not supported"); - cpputest_longlong ret; + cpputest_longlong ret = {}; return ret; } cpputest_ulonglong MockSupport::unsignedLongLongIntReturnValue() { FAIL("Unsigned Long Long type is not supported"); - cpputest_ulonglong ret; + cpputest_ulonglong ret = {}; return ret; } diff --git a/src/CppUTestExt/MockSupport_c.cpp b/src/CppUTestExt/MockSupport_c.cpp index cd04f13b1..52e7b9018 100644 --- a/src/CppUTestExt/MockSupport_c.cpp +++ b/src/CppUTestExt/MockSupport_c.cpp @@ -909,28 +909,28 @@ cpputest_ulonglong returnUnsignedLongLongIntValueOrDefault_c(cpputest_ulonglong cpputest_longlong longLongIntReturnValue_c() { FAIL("Long Long type is not supported"); - cpputest_longlong ret; + cpputest_longlong ret = {}; return ret; } cpputest_longlong returnLongLongIntValueOrDefault_c(cpputest_longlong) { FAIL("Long Long type is not supported"); - cpputest_longlong ret; + cpputest_longlong ret = {}; return ret; } cpputest_ulonglong unsignedLongLongIntReturnValue_c() { FAIL("Unsigned Long Long type is not supported"); - cpputest_ulonglong ret; + cpputest_ulonglong ret = {}; return ret; } cpputest_ulonglong returnUnsignedLongLongIntValueOrDefault_c(cpputest_ulonglong) { FAIL("Unsigned Long Long type is not supported"); - cpputest_ulonglong ret; + cpputest_ulonglong ret = {}; return ret; }