1 //===- llvm/unittest/Support/FSUniqueIDTest.cpp - Test sys::fs::UniqueID --===//
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
7 //===----------------------------------------------------------------------===//
9 #include "llvm/Support/FileSystem/UniqueID.h"
10 #include "gtest/gtest.h"
13 using namespace llvm::sys::fs
;
17 TEST(FSUniqueIDTest
, construct
) {
18 EXPECT_EQ(20u, UniqueID(20, 10).getDevice());
19 EXPECT_EQ(10u, UniqueID(20, 10).getFile());
22 TEST(FSUniqueIDTest
, equals
) {
23 EXPECT_EQ(UniqueID(20, 10), UniqueID(20, 10));
24 EXPECT_NE(UniqueID(20, 20), UniqueID(20, 10));
25 EXPECT_NE(UniqueID(10, 10), UniqueID(20, 10));
28 TEST(FSUniqueIDTest
, less
) {
29 EXPECT_FALSE(UniqueID(20, 2) < UniqueID(20, 2));
30 EXPECT_FALSE(UniqueID(20, 3) < UniqueID(20, 2));
31 EXPECT_FALSE(UniqueID(30, 2) < UniqueID(20, 2));
32 EXPECT_FALSE(UniqueID(30, 2) < UniqueID(20, 40));
33 EXPECT_TRUE(UniqueID(20, 2) < UniqueID(20, 3));
34 EXPECT_TRUE(UniqueID(20, 2) < UniqueID(30, 2));
35 EXPECT_TRUE(UniqueID(20, 40) < UniqueID(30, 2));
38 } // anonymous namespace