MCPcopy Create free account
hub / github.com/apache/arrow / TEST

Function TEST

cpp/src/arrow/util/float16_test.cc:213–236  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

211TYPED_TEST(Float16ConversionTest, RoundTripFromInf) { this->TestRoundTripFromInf(); }
212
213TEST(Float16Test, ConstexprFunctions) {
214 constexpr auto a = Float16::FromBits(0xbc00); // -1.0
215 constexpr auto b = Float16::FromBits(0x3c00); // +1.0
216
217 static_assert(a.bits() == 0xbc00);
218 static_assert(a.signbit() == true);
219 static_assert(a.is_nan() == false);
220 static_assert(a.is_infinity() == false);
221 static_assert(a.is_finite() == true);
222 static_assert(a.is_zero() == false);
223
224 static_assert((a == b) == false);
225 static_assert((a != b) == true);
226 static_assert((a < b) == true);
227 static_assert((a > b) == false);
228 static_assert((a <= b) == true);
229 static_assert((a >= b) == false);
230 static_assert(-a == +b);
231
232 constexpr auto v = Float16::FromBits(0xffff);
233 static_assert(v.ToBytes()[0] == 0xff);
234 static_assert(v.ToLittleEndian()[0] == 0xff);
235 static_assert(v.ToBigEndian()[0] == 0xff);
236}
237
238TEST(Float16Test, Constructors) {
239 // Construction from exact bits

Callers

nothing calls this directly

Calls 10

FromBitsFunction · 0.85
FromBytesFunction · 0.85
signbitMethod · 0.80
ToBytesMethod · 0.80
Float16Function · 0.70
FromLittleEndianFunction · 0.70
FromBigEndianFunction · 0.70
sizeFunction · 0.50
ToFloatMethod · 0.45
dataMethod · 0.45

Tested by

no test coverage detected