@@ -68,12 +68,29 @@ void assert_eq(const std::vector<T>& result,
68
68
const size_t max_length = SIZE_MAX)
69
69
{
70
70
if (max_length == SIZE_MAX || max_length > expected.size ())
71
+ {
71
72
ASSERT_EQ (result.size (), expected.size ());
73
+ }
72
74
for (size_t i = 0 ; i < std::min (result.size (), max_length); i++)
73
75
{
74
76
if (bit_equal (result[i], expected[i]))
75
77
continue ; // Check bitwise equality for +NaN, -NaN, +0.0, -0.0, +inf, -inf.
78
+ #if defined(_WIN32)
79
+ // GTest's ASSERT_EQ prints the values if the test fails. On Windows, the version of GTest provided by vcpkg doesn't
80
+ // provide overloads for printing 128 bit types, resulting in linker errors.
81
+ // Check if we're testing with 128 bit types. If so, test using bools so GTest doesn't try to print them on failure.
82
+ if (test_utils::is_int128<T>::value || test_utils::is_uint128<T>::value || (typeid (T) == typeid (common::custom_type<double ,double ,1 >)))
83
+ {
84
+ const bool values_equal = (result[i] == expected[i]);
85
+ ASSERT_EQ (values_equal, true ) << " where index = " << i;
86
+ }
87
+ else
88
+ {
89
+ ASSERT_EQ (result[i], expected[i]) << " where index = " << i;
90
+ }
91
+ #else
76
92
ASSERT_EQ (result[i], expected[i]) << " where index = " << i;
93
+ #endif
77
94
}
78
95
}
79
96
@@ -90,7 +107,15 @@ void assert_eq(const std::vector<common::custom_type<T, T, true>>& result,
90
107
{
91
108
if (bit_equal (result[i].x , expected[i].x ) && bit_equal (result[i].y , expected[i].y ))
92
109
continue ; // Check bitwise equality for +NaN, -NaN, +0.0, -0.0, +inf, -inf.
110
+ #if defined(_WIN32)
111
+ // GTest's ASSERT_EQ prints the values if the test fails. On Windows, the version of GTest provided by vcpkg doesn't
112
+ // provide overloads for printing 128 bit types, resulting in linker errors.
113
+ // Check if we're testing with 128 bit types. If so, test using bools so GTest doesn't try to print them on failure.
114
+ const bool values_equal = (result[i] == expected[i]);
115
+ ASSERT_EQ (values_equal, true ) << " where index = " << i;
116
+ #else
93
117
ASSERT_EQ (result[i], expected[i]) << " where index = " << i;
118
+ #endif
94
119
}
95
120
}
96
121
@@ -130,7 +155,22 @@ void assert_eq(const T& result, const T& expected)
130
155
{
131
156
if (bit_equal (result, expected))
132
157
return ; // Check bitwise equality for +NaN, -NaN, +0.0, -0.0, +inf, -inf.
158
+ #if defined(_WIN32)
159
+ // GTest's ASSERT_EQ prints the values if the test fails. On Windows, the version of GTest provided by vcpkg doesn't
160
+ // provide overloads for printing 128 bit types, resulting in linker errors.
161
+ // Check if we're testing with 128 bit types. If so, test using bools so GTest doesn't try to print them on failure.
162
+ if (test_utils::is_int128<T>::value || test_utils::is_uint128<T>::value)
163
+ {
164
+ const bool values_equal = (result == expected);
165
+ ASSERT_EQ (values_equal, true );
166
+ }
167
+ else
168
+ {
169
+ ASSERT_EQ (result, expected);
170
+ }
171
+ #else
133
172
ASSERT_EQ (result, expected);
173
+ #endif
134
174
}
135
175
136
176
template <class T >
0 commit comments