Bump version to 19.1.0-rc3
[llvm-project.git] / llvm / unittests / Support / FSUniqueIDTest.cpp
blob81e5088bf24cbbc103147b45135464bf0e263b9f
1 //===- llvm/unittest/Support/FSUniqueIDTest.cpp - Test sys::fs::UniqueID --===//
2 //
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
6 //
7 //===----------------------------------------------------------------------===//
9 #include "llvm/Support/FileSystem/UniqueID.h"
10 #include "gtest/gtest.h"
12 using namespace llvm;
13 using namespace llvm::sys::fs;
15 namespace {
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