mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 07:49:11 +03:00
078d57c4ee
Summary: Add a very cheap unique ID allocator designed for extremely low-latency uses like D10384071. Differential Revision: D10501712 fbshipit-source-id: 15a0b7a2d344c0f6100082850dd967c585f3e2da
24 lines
616 B
C++
24 lines
616 B
C++
/*
|
|
* Copyright (c) 2018-present, Facebook, Inc.
|
|
* All rights reserved.
|
|
*
|
|
* This source code is licensed under the BSD-style license found in the
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
*
|
|
*/
|
|
|
|
#include "eden/fs/utils/IDGen.h"
|
|
#include <gtest/gtest.h>
|
|
|
|
using namespace facebook::eden;
|
|
|
|
TEST(IDGenTest, producesUniqueIDs) {
|
|
auto id1 = generateUniqueID();
|
|
auto id2 = generateUniqueID();
|
|
auto id3 = generateUniqueID();
|
|
EXPECT_NE(id1, id2);
|
|
EXPECT_NE(id2, id3);
|
|
EXPECT_NE(id2, id3);
|
|
}
|