diff options
Diffstat (limited to 'clang/unittests')
-rw-r--r-- | clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp b/clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp index d59de0a..6b9321b 100644 --- a/clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp +++ b/clang/unittests/Analysis/FlowSensitive/DebugSupportTest.cpp @@ -188,6 +188,31 @@ TEST(BoolValueDebugStringTest, ComplexBooleanWithSomeNames) { StrEq(Expected)); } +TEST(ConstraintSetDebugStringTest, Empty) { + llvm::DenseSet<BoolValue *> Constraints; + EXPECT_THAT(debugString(Constraints), StrEq("")); +} + +TEST(ConstraintSetDebugStringTest, Simple) { + ConstraintContext Ctx; + llvm::DenseSet<BoolValue *> Constraints; + auto X = cast<AtomicBoolValue>(Ctx.atom()); + auto Y = cast<AtomicBoolValue>(Ctx.atom()); + Constraints.insert(Ctx.disj(X, Y)); + Constraints.insert(Ctx.disj(X, Ctx.neg(Y))); + + auto Expected = R"((or + X + (not + Y)) +(or + X + Y) +)"; + EXPECT_THAT(debugString(Constraints, {{X, "X"}, {Y, "Y"}}), + StrEq(Expected)); +} + Solver::Result CheckSAT(std::vector<BoolValue *> Constraints) { llvm::DenseSet<BoolValue *> ConstraintsSet(Constraints.begin(), Constraints.end()); |