jeudi 5 février 2015

GoogleTest test error print of enum class

I'm using GoogleTest version 1.7.0 to test my C++ application. I have an enum defined as following



namespace MyNamespace {
enum class MyEnum {
MyEnumValue,
MyEnumValue2
}
}


GoogleTest incorrectly prints it's value, resulting in this error message when the test fails:



Value of: MyClass.MyMethodThatReturnsEnum()


Actual: 4-byte object


Expected: MyEnum::MyEnumValue


Which is: 4-byte object <02-00 00-00>



Removing the class keyword produces the correct error message with the real value of the enum. Is this a known behaviour/bug of GoogleTest? Is there a way to fix the problem?


Aucun commentaire:

Enregistrer un commentaire