Skip to content

Commit 0aa18e1

Browse files
nodejs-github-botrichardlau
authored andcommitted
deps: update googletest to 6a59382
PR-URL: #51580 Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Mohammed Keyvanzadeh <[email protected]> Reviewed-By: Marco Ippolito <[email protected]> Reviewed-By: Benjamin Gruenbaum <[email protected]>
1 parent b3157a0 commit 0aa18e1

File tree

2 files changed

+29
-22
lines changed

2 files changed

+29
-22
lines changed

deps/googletest/include/gtest/gtest-printers.h

+28-21
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@
124124

125125
#if GTEST_INTERNAL_HAS_STD_SPAN
126126
#include <span> // NOLINT
127-
#endif // GTEST_INTERNAL_HAS_STD_SPAN
127+
#endif // GTEST_INTERNAL_HAS_STD_SPAN
128128

129129
namespace testing {
130130

@@ -241,8 +241,8 @@ struct StreamPrinter {
241241
// ADL (possibly involving implicit conversions).
242242
// (Use SFINAE via return type, because it seems GCC < 12 doesn't handle name
243243
// lookup properly when we do it in the template parameter list.)
244-
static auto PrintValue(const T& value, ::std::ostream* os)
245-
-> decltype((void)(*os << value)) {
244+
static auto PrintValue(const T& value,
245+
::std::ostream* os) -> decltype((void)(*os << value)) {
246246
// Call streaming operator found by ADL, possibly with implicit conversions
247247
// of the arguments.
248248
*os << value;
@@ -558,43 +558,50 @@ int AppropriateResolution(FloatType val) {
558558
#endif
559559
if (val < 1000000) {
560560
FloatType mulfor6 = 1e10;
561-
if (val >= 100000.0) { // 100,000 to 999,999
561+
// Without these static casts, the template instantiation for float would
562+
// fail to compile when -Wdouble-promotion is enabled, as the arithmetic and
563+
// comparison logic would promote floats to doubles.
564+
if (val >= static_cast<FloatType>(100000.0)) { // 100,000 to 999,999
562565
mulfor6 = 1.0;
563-
} else if (val >= 10000.0) {
566+
} else if (val >= static_cast<FloatType>(10000.0)) {
564567
mulfor6 = 1e1;
565-
} else if (val >= 1000.0) {
568+
} else if (val >= static_cast<FloatType>(1000.0)) {
566569
mulfor6 = 1e2;
567-
} else if (val >= 100.0) {
570+
} else if (val >= static_cast<FloatType>(100.0)) {
568571
mulfor6 = 1e3;
569-
} else if (val >= 10.0) {
572+
} else if (val >= static_cast<FloatType>(10.0)) {
570573
mulfor6 = 1e4;
571-
} else if (val >= 1.0) {
574+
} else if (val >= static_cast<FloatType>(1.0)) {
572575
mulfor6 = 1e5;
573-
} else if (val >= 0.1) {
576+
} else if (val >= static_cast<FloatType>(0.1)) {
574577
mulfor6 = 1e6;
575-
} else if (val >= 0.01) {
578+
} else if (val >= static_cast<FloatType>(0.01)) {
576579
mulfor6 = 1e7;
577-
} else if (val >= 0.001) {
580+
} else if (val >= static_cast<FloatType>(0.001)) {
578581
mulfor6 = 1e8;
579-
} else if (val >= 0.0001) {
582+
} else if (val >= static_cast<FloatType>(0.0001)) {
580583
mulfor6 = 1e9;
581584
}
582-
if (static_cast<FloatType>(static_cast<int32_t>(val * mulfor6 + 0.5)) /
585+
if (static_cast<FloatType>(static_cast<int32_t>(
586+
val * mulfor6 + (static_cast<FloatType>(0.5)))) /
583587
mulfor6 ==
584588
val)
585589
return 6;
586-
} else if (val < 1e10) {
587-
FloatType divfor6 = 1.0;
588-
if (val >= 1e9) { // 1,000,000,000 to 9,999,999,999
590+
} else if (val < static_cast<FloatType>(1e10)) {
591+
FloatType divfor6 = static_cast<FloatType>(1.0);
592+
if (val >= static_cast<FloatType>(1e9)) { // 1,000,000,000 to 9,999,999,999
589593
divfor6 = 10000;
590-
} else if (val >= 1e8) { // 100,000,000 to 999,999,999
594+
} else if (val >=
595+
static_cast<FloatType>(1e8)) { // 100,000,000 to 999,999,999
591596
divfor6 = 1000;
592-
} else if (val >= 1e7) { // 10,000,000 to 99,999,999
597+
} else if (val >=
598+
static_cast<FloatType>(1e7)) { // 10,000,000 to 99,999,999
593599
divfor6 = 100;
594-
} else if (val >= 1e6) { // 1,000,000 to 9,999,999
600+
} else if (val >= static_cast<FloatType>(1e6)) { // 1,000,000 to 9,999,999
595601
divfor6 = 10;
596602
}
597-
if (static_cast<FloatType>(static_cast<int32_t>(val / divfor6 + 0.5)) *
603+
if (static_cast<FloatType>(static_cast<int32_t>(
604+
val / divfor6 + (static_cast<FloatType>(0.5)))) *
598605
divfor6 ==
599606
val)
600607
return 6;

deps/googletest/include/gtest/internal/gtest-internal.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,7 @@ struct SuiteApiResolver : T {
555555
// type_param: the name of the test's type parameter, or NULL if
556556
// this is not a typed or a type-parameterized test.
557557
// value_param: text representation of the test's value parameter,
558-
// or NULL if this is not a type-parameterized test.
558+
// or NULL if this is not a value-parameterized test.
559559
// code_location: code location where the test is defined
560560
// fixture_class_id: ID of the test fixture class
561561
// set_up_tc: pointer to the function that sets up the test suite

0 commit comments

Comments
 (0)