Why is kMaxCount in gtest-printers.h fixed to 32 ? #4133
Replies: 1 comment 1 reply
-
kMaxCount in gtest-printers.h is a constant used to limit the number of elements that can be printed from a container when using the built-in Google Test (gtest) printer. The value of 32 is arbitrary and was likely chosen as a reasonable default to prevent excessive output when printing large containers. The idea behind this limit is to prevent excessive output when printing large containers, and it also prevents a test from taking too long or causing a crash due to an excessive amount of data. You can configure the kMaxCount value without defining your own printer by modifying the value of kMaxCount in the gtest-printers.h file and then rebuilding the gtest library. However, this is not recommended as it is a global change that may affect other parts of the library. Alternatively, you can define your own printer and use it when you want to print the contents of your container. This allows you to have more control over the output and the limit of elements printed. |
Beta Was this translation helpful? Give feedback.
-
I was wondering why the number of character that can be printed from a container is limited to 32 ?
(see
kMaxCount
in gtest-printers.h in methodPrintValue
ofstruct ContainerPrinter
)Is there a way to configure it without defining my own printer ?
Beta Was this translation helpful? Give feedback.
All reactions