当前位置: 首页>>代码示例>>C++>>正文


C++ AbstractObject::leq方法代码示例

本文整理汇总了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);
}
开发者ID:JoelMarcey,项目名称:redex,代码行数:45,代码来源:ReflectionAnalysisTestVerify.cpp


注:本文中的AbstractObject::leq方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。