2 #include "testing/testing.h"
9 TEST(BLI_uuid, generate_random)
22 TEST(BLI_uuid, generate_many_random)
27 for (
int i = 0; i < 1000000; ++i) {
29 EXPECT_NE(first_uuid, uuid);
42 const bUUID zeroes_uuid{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
43 const bUUID default_constructed{};
48 <<
"Default constructor should produce the nil value.";
50 std::string
buffer(36,
'\0');
61 EXPECT_NE(uuid1, uuid2);
64 TEST(BLI_uuid, comparison_trivial)
67 const bUUID uuid1(
"11111111-1111-1111-1111-111111111111");
68 const bUUID uuid2(
"22222222-2222-2222-2222-222222222222");
70 EXPECT_LT(uuid0, uuid1);
71 EXPECT_LT(uuid0, uuid2);
72 EXPECT_LT(uuid1, uuid2);
75 TEST(BLI_uuid, comparison_byte_order_check)
79 const bUUID uuid12(
"12222222-2222-2222-2222-222222222222");
80 const bUUID uuid21(
"21111111-1111-1111-1111-111111111111");
82 EXPECT_LT(uuid0, uuid12);
83 EXPECT_LT(uuid0, uuid21);
84 EXPECT_LT(uuid12, uuid21);
87 TEST(BLI_uuid, string_formatting)
90 std::string
buffer(36,
'\0');
92 memset(&uuid, 0,
sizeof(uuid));
108 const bUUID uuid1 = {3540651616, 5282, 4588, 139, 153, 0xf7, 0x73, 0x69, 0x44, 0xdb, 0x8b};
113 const bUUID namespace_dns = {
114 0x6ba7b810, 0x9dad, 0x11d1, 0x80, 0xb4, 0x00, 0xc0, 0x4f, 0xd4, 0x30, 0xc8};
119 TEST(BLI_uuid, string_parsing_ok)
122 std::string
buffer(36,
'\0');
125 EXPECT_TRUE(parsed_ok);
130 TEST(BLI_uuid, string_parsing_capitalisation)
133 std::string
buffer(36,
'\0');
137 EXPECT_TRUE(parsed_ok);
144 TEST(BLI_uuid, string_parsing_fail)
147 std::string
buffer(36,
'\0');
150 EXPECT_FALSE(parsed_ok);
153 TEST(BLI_uuid, stream_operator)
155 std::stringstream ss;
156 const bUUID uuid = {3540651616, 5282, 4588, 139, 153, 0xf7, 0x73, 0x69, 0x44, 0xdb, 0x8b};
158 EXPECT_EQ(ss.str(),
"d30a0e60-14a2-11ec-8b99-f7736944db8b");
EXPECT_EQ(BLI_expr_pylike_eval(expr, nullptr, 0, &result), EXPR_PYLIKE_INVALID)
bool BLI_uuid_parse_string(bUUID *uuid, const char *buffer) ATTR_NONNULL()
bool BLI_uuid_is_nil(bUUID uuid)
bUUID BLI_uuid_generate_random(void)
void BLI_uuid_format(char *buffer, bUUID uuid) ATTR_NONNULL()
ccl_global float * buffer
TEST(any, DefaultConstructor)
Universally Unique Identifier according to RFC4122.
uint8_t clock_seq_hi_and_reserved
uint16_t time_hi_and_version