updated build system
	
		
			
	
		
	
	
		
	
		
			Some checks failed
		
		
	
	
		
			
				
	
				BlockStorage/repertory/pipeline/head There was a failure building this commit
				
			
		
		
	
	
				
					
				
			
		
			Some checks failed
		
		
	
	BlockStorage/repertory/pipeline/head There was a failure building this commit
				
			This commit is contained in:
		| @@ -25,12 +25,24 @@ | ||||
|  | ||||
| namespace repertory { | ||||
| TEST(utils_hash, hash_type_sizes) { | ||||
|   EXPECT_EQ(4U, utils::hash::hash_32_t{}.size()); | ||||
|   EXPECT_EQ(8U, utils::hash::hash_64_t{}.size()); | ||||
|   EXPECT_EQ(16U, utils::hash::hash_128_t{}.size()); | ||||
|   EXPECT_EQ(32U, utils::hash::hash_256_t{}.size()); | ||||
|   EXPECT_EQ(48U, utils::hash::hash_384_t{}.size()); | ||||
|   EXPECT_EQ(64U, utils::hash::hash_512_t{}.size()); | ||||
| } | ||||
|  | ||||
| TEST(utils_hash, default_hasher_is_blake2b) { | ||||
|   EXPECT_EQ(&utils::hash::blake2b_32_hasher, | ||||
|             &utils::hash::default_create_hash<utils::hash::hash_32_t>()); | ||||
|  | ||||
|   EXPECT_EQ(&utils::hash::blake2b_64_hasher, | ||||
|             &utils::hash::default_create_hash<utils::hash::hash_64_t>()); | ||||
|  | ||||
|   EXPECT_EQ(&utils::hash::blake2b_128_hasher, | ||||
|             &utils::hash::default_create_hash<utils::hash::hash_128_t>()); | ||||
|  | ||||
|   EXPECT_EQ(&utils::hash::blake2b_256_hasher, | ||||
|             &utils::hash::default_create_hash<utils::hash::hash_256_t>()); | ||||
|  | ||||
| @@ -41,6 +53,60 @@ TEST(utils_hash, default_hasher_is_blake2b) { | ||||
|             &utils::hash::default_create_hash<utils::hash::hash_512_t>()); | ||||
| } | ||||
|  | ||||
| TEST(utils_hash, blake2b_32) { | ||||
|   auto hash = utils::collection::to_hex_string( | ||||
|       utils::hash::create_hash_blake2b_32("a")); | ||||
|   EXPECT_STREQ("ca234c55", hash.c_str()); | ||||
|  | ||||
|   hash = utils::collection::to_hex_string( | ||||
|       utils::hash::create_hash_blake2b_32(L"a")); | ||||
| #if defined(_WIN32) | ||||
|   EXPECT_STREQ("4c368117", hash.c_str()); | ||||
| #else // !defined(_WIN32) | ||||
|   EXPECT_STREQ("02a631b8", hash.c_str()); | ||||
| #endif | ||||
|  | ||||
|   hash = utils::collection::to_hex_string( | ||||
|       utils::hash::create_hash_blake2b_32({1U})); | ||||
|   EXPECT_STREQ("593bda73", hash.c_str()); | ||||
| } | ||||
|  | ||||
| TEST(utils_hash, blake2b_64) { | ||||
|   auto hash = utils::collection::to_hex_string( | ||||
|       utils::hash::create_hash_blake2b_64("a")); | ||||
|   EXPECT_STREQ("40f89e395b66422f", hash.c_str()); | ||||
|  | ||||
|   hash = utils::collection::to_hex_string( | ||||
|       utils::hash::create_hash_blake2b_64(L"a")); | ||||
| #if defined(_WIN32) | ||||
|   EXPECT_STREQ("4dd0bb1c45b748c1", hash.c_str()); | ||||
| #else // !defined(_WIN32) | ||||
|   EXPECT_STREQ("85ff8cc55b79d38a", hash.c_str()); | ||||
| #endif | ||||
|  | ||||
|   hash = utils::collection::to_hex_string( | ||||
|       utils::hash::create_hash_blake2b_64({1U})); | ||||
|   EXPECT_STREQ("00e83d0a3f7519ad", hash.c_str()); | ||||
| } | ||||
|  | ||||
| TEST(utils_hash, blake2b_128) { | ||||
|   auto hash = utils::collection::to_hex_string( | ||||
|       utils::hash::create_hash_blake2b_128("a")); | ||||
|   EXPECT_STREQ("27c35e6e9373877f29e562464e46497e", hash.c_str()); | ||||
|  | ||||
|   hash = utils::collection::to_hex_string( | ||||
|       utils::hash::create_hash_blake2b_128(L"a")); | ||||
| #if defined(_WIN32) | ||||
|   EXPECT_STREQ("396660e76c84bb7786f979f10b58fa79", hash.c_str()); | ||||
| #else // !defined(_WIN32) | ||||
|   EXPECT_STREQ("dae64afb310a3426ad84f0739fde5cef", hash.c_str()); | ||||
| #endif | ||||
|  | ||||
|   hash = utils::collection::to_hex_string( | ||||
|       utils::hash::create_hash_blake2b_128({1U})); | ||||
|   EXPECT_STREQ("4a9e6f9b8d43f6ad008f8c291929dee2", hash.c_str()); | ||||
| } | ||||
|  | ||||
| TEST(utils_hash, blake2b_256) { | ||||
|   auto hash = utils::collection::to_hex_string( | ||||
|       utils::hash::create_hash_blake2b_256("a")); | ||||
|   | ||||
| @@ -134,4 +134,10 @@ TEST(utils_string, to_bool) { | ||||
|   EXPECT_FALSE(utils::string::to_bool("0")); | ||||
|   EXPECT_FALSE(utils::string::to_bool("00000.00000")); | ||||
| } | ||||
|  | ||||
| TEST(utils_string, utf8_string_conversion) { | ||||
|   std::wstring ws = L"Hello 🌍 — 𝄞 漢字"; | ||||
|   std::wstring ws2 = utils::string::from_utf8(utils::string::to_utf8(ws)); | ||||
|   EXPECT_STREQ(ws.c_str(), ws2.c_str()); | ||||
| } | ||||
| } // namespace repertory | ||||
|   | ||||
| @@ -150,7 +150,7 @@ TEST(utils_ttl_cache, can_handle_concurrent_access) { | ||||
|     for (std::uint8_t ttl = 0U; ttl < 100U; ++ttl) { | ||||
|       auto data = cache.get("/key"); | ||||
|       if (data) { | ||||
|         (void)data->load(); | ||||
|         [[maybe_unused]] auto res = data->load(); | ||||
|       } | ||||
|       std::this_thread::yield(); | ||||
|     } | ||||
| @@ -162,7 +162,7 @@ TEST(utils_ttl_cache, can_handle_concurrent_access) { | ||||
|  | ||||
|   auto data = cache.get("/key"); | ||||
|   ASSERT_NE(data, nullptr); | ||||
|   (void)data->load(); | ||||
|   [[maybe_unused]] auto res = data->load(); | ||||
| } | ||||
|  | ||||
| TEST(utils_ttl_cache, can_handle_custom_atomic) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user