11#include "testing/testing.h"
16namespace blender::fixed_width_int::tests {
18TEST(fixed_width_int, IsZero)
32TEST(fixed_width_int, ToString)
35 const std::string
str =
"4875677549274093345634534";
39 const std::string
str =
"0";
43 const std::string
str =
"4875677549274093345634534";
47 const std::string
str =
"-4875677549274093345634534";
51 const std::string
str =
"0";
56TEST(fixed_width_int, Add256)
59 UInt256(
"236559186774771353723629567597011581379"),
60 UInt256(
"526773185328924664712778992110471189451"));
62 UInt256(
"151035310604094577723885879186052138391"),
63 UInt256(
"362412675776924009416436226790879141685"));
65 UInt256(
"151329651396698072567782489740109235288"),
66 UInt256(
"185820575645612381753473218637403690930"));
68 UInt256(
"242538071468046767660828531945711005380"),
69 UInt256(
"265558862441221011556226541877361860558"));
71 UInt256(
"13817458575896368146281651263001012349"),
72 UInt256(
"233848305295173656907298816541418191868"));
74 UInt256(
"309322190961572274983773819144991425669"),
75 UInt256(
"535281149894295891270622225155134853779"));
77 UInt256(
"85443075281725354911889976920463997722"),
78 UInt256(
"252294445840724461547563623931853010203"));
80 UInt256(
"215279677420695754877443907998549347900"),
81 UInt256(
"489765631937851524181719613147482694292"));
83 UInt256(
"100106234023644716469012457480771518776"),
84 UInt256(
"103628425593490487262536864577414607445"));
86 UInt256(
"263001956277142014131208604303902541977"),
87 UInt256(
"426996263348772668747641960147985454596"));
90TEST(fixed_width_int, Fuzzy)
92 RandomNumberGenerator rng;
93 for ([[maybe_unused]]
const int i : IndexRange(10000)) {
106 EXPECT_FLOAT_EQ(
double(a),
double(
UInt64_8(a)));
107 EXPECT_FLOAT_EQ(
float(a),
float(
UInt64_8(a)));
110 const int64_t a =
int64_t(rng.get_uint64()) * (rng.get_float() < 0.5f ? -1 : 1);
111 const int64_t b =
int64_t(rng.get_uint64()) * (rng.get_float() < 0.5f ? -1 : 1);
125 EXPECT_FLOAT_EQ(
double(a),
double(
Int64_8(a)));
126 EXPECT_FLOAT_EQ(
float(a),
float(
Int64_8(a)));
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
local_group_size(16, 16) .push_constant(Type b
static const char * to_string(const Interpolation &interp)
ccl_device_inline bool is_zero(const float2 a)
IntF< uint8_t, 8 > Int64_8
UIntF< uint8_t, 8 > UInt64_8
bool is_negative(const IntF< T, Size > &a)
unsigned __int64 uint64_t