Lines Matching defs:value
32 // This file implements a universal value printer that can print a
33 // value of any type T:
35 // void ::testing::internal::UniversalPrinter<T>::Print(value, ostream_ptr);
55 // the value if it is a protocol buffer, or print the raw bytes in the
56 // value otherwise.
59 // value is also printed; when T is a (const) char pointer, both the
60 // pointer value and the NUL-terminated string it points to are
65 // // Prints a value to a string. For a (const or not) char
68 // std::string ::testing::PrintToString(const T& value);
70 // // Prints a value tersely: for a reference type, the referenced
71 // // value (but not the address) is printed; for a (const or not) char
74 // void ::testing::internal::UniversalTersePrint(const T& value, ostream*);
76 // // Prints value using the type inferred by the compiler. The difference
79 // void ::testing::internal::UniversalPrint(const T& value, ostream*);
85 // const Tuple& value);
136 void UniversalPrint(const T& value, ::std::ostream* os);
140 static constexpr bool value = false;
146 static constexpr bool value = true;
162 !IsRecursiveContainer<T>::value) ||
163 IsStdSpan<T>::value>::type>
198 std::is_function<T>::value>::type>
239 !std::is_member_pointer<T>::value>::type>
244 static auto PrintValue(const T& value, ::std::ostream* os)
245 -> decltype((void)(*os << value)) {
248 *os << value;
262 internal::HasDebugStringAndShortDebugString<T>::value>::type>
263 static void PrintValue(const T& value, ::std::ostream* os) {
264 std::string pretty_str = value.ShortDebugString();
266 pretty_str = "\n" + value.DebugString();
280 static void PrintValue(internal::BiggestInt value, ::std::ostream* os) {
281 *os << value;
287 static void PrintValue(internal::StringView value, ::std::ostream* os) {
288 internal::UniversalPrint(value, os);
297 absl::HasAbslStringify<T>::value>::type> // NOLINT
298 static void PrintValue(const T& value, ::std::ostream* os) {
299 *os << absl::StrCat(value);
311 static void PrintValue(const T& value, ::std::ostream* os) {
315 reinterpret_cast<const void*>(std::addressof(value))),
316 sizeof(value), os);
348 void PrintWithFallback(const T& value, ::std::ostream* os) {
358 Printer::PrintValue(value, os);
361 // FormatForComparison<ToPrint, OtherOperand>::Format(value) formats a
362 // value of type ToPrint that is an operand of a comparison assertion
365 // format the value. In particular, when the value is a C string
368 // compared by value with the string object. If the value is a char
379 static ::std::string Format(const ToPrint& value) {
380 return ::testing::PrintToString(value);
388 static ::std::string Format(const ToPrint* value) {
389 return FormatForComparison<const ToPrint*, OtherOperand>::Format(value);
400 static ::std::string Format(CharType* value) { \
401 return ::testing::PrintToString(static_cast<const void*>(value)); \
427 static ::std::string Format(CharType* value) { \
428 return ::testing::PrintToString(value); \
451 // operand to be used in a failure message. The type (but not value)
459 std::string FormatForComparisonFailureMessage(const T1& value,
461 return FormatForComparison<T1, T2>::Format(value);
464 // UniversalPrinter<T>::Print(value, ostream_ptr) prints the given
465 // value to the given ostream. The caller must ensure that
474 // Prints the given value using the << operator if it has one;
486 void PrintTo(const T& value, ::std::ostream* os) {
487 internal::PrintWithFallback(value, os);
538 // However if the value is something simple like 1.1, full will print a
542 // max_digits10 value (full precision) if it won't, for values between
546 // see if gets the original value back.
549 // then multiply to possibly get the original value again.
744 // We can't print the value. Just print the pointer..
749 typename = typename std::enable_if<!std::is_void<T>::value &&
750 !std::is_array<T>::value>::type>
755 *os << "(ptr = " << (VoidifyPointer)(ptr.get()) << ", value = ";
799 void PrintTo(const ::std::pair<T1, T2>& value, ::std::ostream* os) {
801 // We cannot use UniversalPrint(value.first, os) here, as T1 may be
802 // a reference type. The same for printing value.second.
803 UniversalPrinter<T1>::Print(value.first, os);
805 UniversalPrinter<T2>::Print(value.second, os);
821 static void Print(const T& value, ::std::ostream* os) {
823 // the value.
830 PrintTo(value, os);
847 static void Print(const Any& value, ::std::ostream* os) {
848 if (value.has_value()) {
849 *os << "value of type " << GetTypeName(value);
851 *os << "no value";
856 static std::string GetTypeName(const Any& value) {
858 return internal::GetTypeName(value.type());
860 static_cast<void>(value); // possibly unused
875 static void Print(const Optional<T>& value, ::std::ostream* os) {
877 if (!value) {
880 UniversalPrint(*value, os);
903 static void Print(const Variant<T...>& value, ::std::ostream* os) {
906 absl::visit(Visitor{os, value.index()}, value);
908 std::visit(Visitor{os, value.index()}, value);
918 << ")' with value ";
992 static void Print(const T& value, ::std::ostream* os) {
993 // Prints the address of the value. We use reinterpret_cast here
995 *os << "@" << reinterpret_cast<const void*>(&value) << " ";
997 // Then prints the value itself.
998 UniversalPrint(value, os);
1004 // Prints a value tersely: for a reference type, the referenced value
1011 static void Print(const T& value, ::std::ostream* os) {
1012 UniversalPrint(value, os);
1018 static void Print(const T& value, ::std::ostream* os) {
1019 UniversalPrint(value, os);
1025 static void Print(std::reference_wrapper<T> value, ::std::ostream* os) {
1026 UniversalTersePrinter<T>::Print(value.get(), os);
1032 static void Print(const T (&value)[N], ::std::ostream* os) {
1033 UniversalPrinter<T[N]>::Print(value, os);
1121 void UniversalTersePrint(const T& value, ::std::ostream* os) {
1122 UniversalTersePrinter<T>::Print(value, os);
1125 // Prints a value using the type inferred by the compiler. The
1130 void UniversalPrint(const T& value, ::std::ostream* os) {
1134 UniversalPrinter<T1>::Print(value, os);
1159 Strings UniversalTersePrintTupleFieldsToStrings(const Tuple& value) {
1162 value, std::integral_constant<size_t, std::tuple_size<Tuple>::value>(),
1170 ::std::string PrintToString(const T& value) {
1172 internal::UniversalTersePrinter<T>::Print(value, &ss);