Skip to content

Commit

Permalink
[unittest] String compare any operator[] type
Browse files Browse the repository at this point in the history
  • Loading branch information
salkinium committed Jul 31, 2020
1 parent 8820d6b commit 339cbc7
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/unittest/harness.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,16 +117,20 @@ namespace unittest
}

// ------------------------------------------------------------------------
inline void
printString(modm::IOStream& stream, const char* a, const char* b, size_t pos)
template <typename A, typename B>
void
printString(modm::IOStream& stream, const A& a, const B& b, size_t pos)
{
stream << modm::endl << a << modm::endl << b << modm::endl;
stream << modm::endl;
size_t ii=0; while(a[ii]) stream << a[ii++]; stream << modm::endl;
ii=0; while(b[ii]) stream << b[ii++]; stream << modm::endl;
for(size_t ii = 0; ii < pos; ++ii) { stream << " "; }
stream << "^" << modm::endl;
}

inline bool
checkString(const char* a, const char* b, unsigned int line)
template <typename A, typename B>
bool
checkString(const A& a, const B& b, unsigned int line)
{
size_t ii = 0;
while(a[ii] != '\0' && b[ii] != '\0') {
Expand Down

0 comments on commit 339cbc7

Please sign in to comment.