Skip to content

assertEqual does not support nullptr #102

Closed
@hlovdal

Description

@hlovdal

Trying to test that a function returns a null pointer, e.g.

	assertEqual(nullptr, result);

does not work

.../ArduinoUnitTests.h:69:56: error: ambiguous overload for ‘operator<< (operand types are ‘std::basic_ostream<char>’ and ‘std::nullptr_t’)
               cerr << "      " << lhsRelevance << ": " << lhs << endl;

I tried to fix it by extracting that line into a template function and then make a template specialisation for nullptr but did not get the compiler to select it, and have put that on ice for now since there is a simple workaround, just adding

#define nullptr (void *)NULL

at the top of the test file. But it would be nice to eventually have this fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    arduino mocksCompilation mocks for the Arduino librarybugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions