本文整理汇总了C++中AbstractObject::leq方法的典型用法代码示例。如果您正苦于以下问题:C++ AbstractObject::leq方法的具体用法?C++ AbstractObject::leq怎么用?C++ AbstractObject::leq使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AbstractObject
的用法示例。
在下文中一共展示了AbstractObject::leq方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_join_meet
void test_join_meet(const AbstractObject& foo,
const AbstractObject& bar,
const AbstractObject& generic) {
EXPECT_TRUE(generic.leq(generic));
EXPECT_FALSE(generic.leq(foo));
EXPECT_FALSE(generic.leq(bar));
EXPECT_TRUE(foo.leq(generic));
EXPECT_TRUE(foo.leq(foo));
EXPECT_FALSE(foo.leq(bar));
EXPECT_TRUE(bar.leq(generic));
EXPECT_FALSE(bar.leq(foo));
EXPECT_TRUE(bar.leq(bar));
auto join_with_foo = [&foo](auto&& obj) { return obj.join_with(foo); };
auto join_with_bar = [&bar](auto&& obj) { return obj.join_with(bar); };
auto join_with_generic = [&generic](auto&& obj) {
return obj.join_with(generic);
};
test_operation(generic, join_with_generic, generic);
test_operation(generic, join_with_foo, generic);
test_operation(generic, join_with_bar, generic);
test_operation(foo, join_with_generic, generic);
test_operation(foo, join_with_foo, foo);
test_operation(foo, join_with_bar, generic);
test_operation(bar, join_with_generic, generic);
test_operation(bar, join_with_foo, generic);
test_operation(bar, join_with_bar, bar);
auto meet_with_foo = [&foo](auto&& obj) { return obj.meet_with(foo); };
auto meet_with_bar = [&bar](auto&& obj) { return obj.meet_with(bar); };
auto meet_with_generic = [&generic](auto&& obj) {
return obj.meet_with(generic);
};
test_operation(generic, meet_with_generic, generic);
test_operation(generic, meet_with_foo, foo);
test_operation(generic, meet_with_bar, bar);
test_operation(foo, meet_with_generic, foo);
test_operation(foo, meet_with_foo, foo);
test_operation(bar, meet_with_generic, bar);
test_operation(bar, meet_with_bar, bar);
auto foo_copy = foo;
EXPECT_EQ(foo_copy.meet_with(bar), sparta::AbstractValueKind::Bottom);
auto bar_copy = bar;
EXPECT_EQ(bar_copy.meet_with(foo), sparta::AbstractValueKind::Bottom);
}