34TEST(AXPlatformUniqueIdTest, UnassignedIdsAreReused) {
39 std::unique_ptr<AXTestSmallBankUniqueId> ids[
kMaxId];
41 for (
int i = 0; i <
kMaxId; i++) {
42 ids[i] = std::make_unique<AXTestSmallBankUniqueId>();
45 static int kIdToReplace = 10;
46 int32_t expected_id = ids[kIdToReplace]->Get();
49 ids[kIdToReplace] =
nullptr;
50 ids[kIdToReplace] = std::make_unique<AXTestSmallBankUniqueId>();
53 EXPECT_EQ(ids[kIdToReplace]->Get(), expected_id);
56TEST(AXPlatformUniqueIdTest, DoesCreateCorrectId) {
57 constexpr int kLargerThanMaxId =
kMaxId * 2;
58 std::unique_ptr<AXUniqueId> ids[kLargerThanMaxId];
60 for (
int i = 0; i < kLargerThanMaxId; i++) {
61 ids[i] = std::make_unique<AXUniqueId>();
63 for (
int i = 0; i < kLargerThanMaxId; i++) {
64 ids[i].reset(
nullptr);
68 std::unique_ptr<AXTestSmallBankUniqueId> unique_id =
69 std::make_unique<AXTestSmallBankUniqueId>();
71 EXPECT_LE(unique_id->Get(),
kMaxId);