From de21ddf821ce073031aa0154874cebcfad7cb481 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Thu, 30 Jul 2020 11:12:13 +0200 Subject: BLI: Initial implementation of generic session UUID API Covers basics like generation of new UUID. Also contains code needed to use the SessionUUID as a key in the Map. --- tests/gtests/blenlib/BLI_session_uuid_test.cc | 20 ++++++++++++++++++++ tests/gtests/blenlib/CMakeLists.txt | 1 + 2 files changed, 21 insertions(+) create mode 100644 tests/gtests/blenlib/BLI_session_uuid_test.cc (limited to 'tests/gtests') diff --git a/tests/gtests/blenlib/BLI_session_uuid_test.cc b/tests/gtests/blenlib/BLI_session_uuid_test.cc new file mode 100644 index 00000000000..1a5f17be06c --- /dev/null +++ b/tests/gtests/blenlib/BLI_session_uuid_test.cc @@ -0,0 +1,20 @@ +/* Apache License, Version 2.0 */ + +#include "testing/testing.h" + +#include "BLI_session_uuid.h" + +TEST(SessionUUID, GenerateBasic) +{ + { + const SessionUUID uuid = BLI_session_uuid_generate(); + EXPECT_TRUE(BLI_session_uuid_is_generated(&uuid)); + } + + { + const SessionUUID uuid1 = BLI_session_uuid_generate(); + const SessionUUID uuid2 = BLI_session_uuid_generate(); + + EXPECT_FALSE(BLI_session_uuid_is_equal(&uuid1, &uuid2)); + } +} diff --git a/tests/gtests/blenlib/CMakeLists.txt b/tests/gtests/blenlib/CMakeLists.txt index d151dacd7a4..937279bceb9 100644 --- a/tests/gtests/blenlib/CMakeLists.txt +++ b/tests/gtests/blenlib/CMakeLists.txt @@ -68,6 +68,7 @@ BLENDER_TEST(BLI_memiter "bf_blenlib") BLENDER_TEST(BLI_memory_utils "bf_blenlib") BLENDER_TEST(BLI_path_util "${BLI_path_util_extra_libs}") BLENDER_TEST(BLI_polyfill_2d "bf_blenlib") +BLENDER_TEST(BLI_session_uuid "bf_blenlib") BLENDER_TEST(BLI_set "bf_blenlib") BLENDER_TEST(BLI_span "bf_blenlib") BLENDER_TEST(BLI_stack "bf_blenlib") -- cgit v1.2.3