googletest - Google Test is not finding my user defined stream operator -
i've tried making minimal working example, haven't been able make issue show within mwe, i'll describe problem , has run across before.
i did see teach google-test how print eigen matrix seems similar issue, not quite because i'm not using custom matcher or templates.
my issue types (std::chrono, enum class s:i:ssk, etc), when google mock assertion fails, doesn't find correct stream operator , defaults byte dump.
e.g.
assert_that(st, eq(s::i::sk::required));
generates output:
test.cpp(262): error: value of: st expected: equal 4-byte object <02-00 00-00> actual: 4-byte object <03-00 00-00> (of type enum s::i::sk)
however, if provide additional output chaining stream operators so:
assert_that(st, eq(s::i::sk::required)) << "expected: " << s::i::sk::required << " received: " << st;
i this: test.cpp(262): error: value of: st expected: equal 4-byte object <02-00 00-00> actual: 4-byte object <03-00 00-00> (of type enum s::i::sk) expected: required received: ready
so appears me user-defined stream operator visible @ call site, expect_that macro somehow causing google test default printer suitable match.
i don't see of user-defined types, many of them print out expect, don't, it's annoying need add explicit output.
i've tried explicitly bringing out stream operator using s::i::operator<<
and in case of std::chrono, tried opening std namespace. use howard hinnant's date library printing, e.g.
#include <date/date.h> namespace std { using date::operator<<; }
that doesn't seem within google's printing mechanism adding streams after expect_that() macro works fine.
Comments
Post a Comment