aboutsummaryrefslogtreecommitdiff
path: root/llvm/unittests/Support/JSONTest.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'llvm/unittests/Support/JSONTest.cpp')
-rw-r--r--llvm/unittests/Support/JSONTest.cpp86
1 files changed, 43 insertions, 43 deletions
diff --git a/llvm/unittests/Support/JSONTest.cpp b/llvm/unittests/Support/JSONTest.cpp
index 8d90a70..bbd69f5 100644
--- a/llvm/unittests/Support/JSONTest.cpp
+++ b/llvm/unittests/Support/JSONTest.cpp
@@ -49,7 +49,7 @@ TEST(JSONTest, Constructors) {
EXPECT_EQ("null", s(llvm::Optional<double>()));
EXPECT_EQ("2.5", s(llvm::Optional<double>(2.5)));
EXPECT_EQ("[[2.5,null]]", s(std::vector<std::vector<llvm::Optional<double>>>{
- {2.5, llvm::None}}));
+ {2.5, std::nullopt}}));
}
TEST(JSONTest, StringOwnership) {
@@ -301,49 +301,49 @@ TEST(JSONTest, Integers) {
llvm::Optional<int64_t> AsInt;
llvm::Optional<double> AsNumber;
} TestCases[] = {
- {
- "Non-integer. Stored as double, not convertible.",
- double{1.5},
- "1.5",
- llvm::None,
- 1.5,
- },
+ {
+ "Non-integer. Stored as double, not convertible.",
+ double{1.5},
+ "1.5",
+ std::nullopt,
+ 1.5,
+ },
- {
- "Integer, not exact double. Stored as int64, convertible.",
- int64_t{0x4000000000000001},
- "4611686018427387905",
- int64_t{0x4000000000000001},
- double{0x4000000000000000},
- },
+ {
+ "Integer, not exact double. Stored as int64, convertible.",
+ int64_t{0x4000000000000001},
+ "4611686018427387905",
+ int64_t{0x4000000000000001},
+ double{0x4000000000000000},
+ },
- {
- "Negative integer, not exact double. Stored as int64, convertible.",
- int64_t{-0x4000000000000001},
- "-4611686018427387905",
- int64_t{-0x4000000000000001},
- double{-0x4000000000000000},
- },
+ {
+ "Negative integer, not exact double. Stored as int64, convertible.",
+ int64_t{-0x4000000000000001},
+ "-4611686018427387905",
+ int64_t{-0x4000000000000001},
+ double{-0x4000000000000000},
+ },
// PR46470,
// https://developercommunity.visualstudio.com/content/problem/1093399/incorrect-result-when-printing-6917529027641081856.html
#if !defined(_MSC_VER) || _MSC_VER < 1926
- {
- "Dynamically exact integer. Stored as double, convertible.",
- double{0x6000000000000000},
- "6.9175290276410819e+18",
- int64_t{0x6000000000000000},
- double{0x6000000000000000},
- },
+ {
+ "Dynamically exact integer. Stored as double, convertible.",
+ double{0x6000000000000000},
+ "6.9175290276410819e+18",
+ int64_t{0x6000000000000000},
+ double{0x6000000000000000},
+ },
#endif
- {
- "Dynamically integer, >64 bits. Stored as double, not convertible.",
- 1.5 * double{0x8000000000000000},
- "1.3835058055282164e+19",
- llvm::None,
- 1.5 * double{0x8000000000000000},
- },
+ {
+ "Dynamically integer, >64 bits. Stored as double, not convertible.",
+ 1.5 * double{0x8000000000000000},
+ "1.3835058055282164e+19",
+ std::nullopt,
+ 1.5 * double{0x8000000000000000},
+ },
};
for (const auto &T : TestCases) {
EXPECT_EQ(T.Str, s(T.Val)) << T.Desc;
@@ -382,7 +382,7 @@ TEST(JSONTest, U64Integers) {
EXPECT_TRUE(!!Doc);
EXPECT_EQ(Doc->getAsInteger(), int64_t{-78278238238328222});
- EXPECT_EQ(Doc->getAsUINT64(), llvm::None);
+ EXPECT_EQ(Doc->getAsUINT64(), std::nullopt);
}
// Test with the largest 64 signed int.
@@ -401,7 +401,7 @@ TEST(JSONTest, U64Integers) {
llvm::Expected<Value> Doc = parse(Str);
EXPECT_TRUE(!!Doc);
- EXPECT_EQ(Doc->getAsInteger(), None);
+ EXPECT_EQ(Doc->getAsInteger(), std::nullopt);
EXPECT_EQ(Doc->getAsUINT64(), uint64_t{18446744073709551615u});
}
@@ -411,8 +411,8 @@ TEST(JSONTest, U64Integers) {
llvm::Expected<Value> Doc = parse(Str);
EXPECT_TRUE(!!Doc);
- EXPECT_EQ(Doc->getAsInteger(), None);
- EXPECT_EQ(Doc->getAsUINT64(), None);
+ EXPECT_EQ(Doc->getAsInteger(), std::nullopt);
+ EXPECT_EQ(Doc->getAsUINT64(), std::nullopt);
// The number was parsed as a double.
EXPECT_TRUE(!!Doc->getAsNumber());
}
@@ -423,8 +423,8 @@ TEST(JSONTest, U64Integers) {
llvm::Expected<Value> Doc = parse(Str);
EXPECT_TRUE(!!Doc);
- EXPECT_EQ(Doc->getAsInteger(), None);
- EXPECT_EQ(Doc->getAsUINT64(), None);
+ EXPECT_EQ(Doc->getAsInteger(), std::nullopt);
+ EXPECT_EQ(Doc->getAsUINT64(), std::nullopt);
// The number was parsed as a double.
EXPECT_TRUE(!!Doc->getAsNumber());
}
@@ -483,7 +483,7 @@ TEST(JSONTest, Deserialize) {
}}};
Expected["foo"] = {
CustomStruct("foo", 42, true),
- CustomStruct("bar", llvm::None, false),
+ CustomStruct("bar", std::nullopt, false),
};
Path::Root Root("CustomStruct");
ASSERT_TRUE(fromJSON(J, R, Root));