Please use GitHub pull requests for new patches. Avoid migrating existing patches. Phabricator shutdown timeline
Changeset View
Changeset View
Standalone View
Standalone View
llvm/unittests/Support/Path.cpp
Show First 20 Lines • Show All 721 Lines • ▼ Show 20 Lines | TEST_F(FileSystemTest, TempFileCollisions) { | ||||
// 2191 attempts not producing a given hexadecimal digit is | // 2191 attempts not producing a given hexadecimal digit is | ||||
// (1 - 1/16) ** 2191 or 3.88e-62. | // (1 - 1/16) ** 2191 or 3.88e-62. | ||||
int Successes = 0; | int Successes = 0; | ||||
for (int i = 0; i < 32; ++i) | for (int i = 0; i < 32; ++i) | ||||
if (TryCreateTempFile()) ++Successes; | if (TryCreateTempFile()) ++Successes; | ||||
EXPECT_EQ(Successes, 16); | EXPECT_EQ(Successes, 16); | ||||
for (fs::TempFile &T : TempFiles) | for (fs::TempFile &T : TempFiles) | ||||
cantFail(T.discard()); | llvm_cantFail(T.discard()); | ||||
} | } | ||||
TEST_F(FileSystemTest, CreateDir) { | TEST_F(FileSystemTest, CreateDir) { | ||||
ASSERT_NO_ERROR(fs::create_directory(Twine(TestDirectory) + "foo")); | ASSERT_NO_ERROR(fs::create_directory(Twine(TestDirectory) + "foo")); | ||||
ASSERT_NO_ERROR(fs::create_directory(Twine(TestDirectory) + "foo")); | ASSERT_NO_ERROR(fs::create_directory(Twine(TestDirectory) + "foo")); | ||||
ASSERT_EQ(fs::create_directory(Twine(TestDirectory) + "foo", false), | ASSERT_EQ(fs::create_directory(Twine(TestDirectory) + "foo", false), | ||||
errc::file_exists); | errc::file_exists); | ||||
ASSERT_NO_ERROR(fs::remove(Twine(TestDirectory) + "foo")); | ASSERT_NO_ERROR(fs::remove(Twine(TestDirectory) + "foo")); | ||||
▲ Show 20 Lines • Show All 1,105 Lines • Show Last 20 Lines |