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


C++ Eq函数代码示例

本文整理汇总了C++中Eq函数的典型用法代码示例。如果您正苦于以下问题:C++ Eq函数的具体用法?C++ Eq怎么用?C++ Eq使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了Eq函数的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TEST_F

// The purpose of this test is to ensure that when slaves are removed
// from the master, and then attempt to re-register, we deny the
// re-registration by sending a ShutdownMessage to the slave.
// Why? Because during a network partition, the master will remove a
// partitioned slave, thus sending its tasks to LOST. At this point,
// when the partition is removed, the slave will attempt to
// re-register with its running tasks. We've already notified
// frameworks that these tasks were LOST, so we have to have the slave
// slave shut down.
TEST_F(PartitionTest, PartitionedSlaveReregistration)
{
  master::Flags masterFlags = CreateMasterFlags();
  Try<PID<Master>> master = StartMaster(masterFlags);
  ASSERT_SOME(master);

  // Allow the master to PING the slave, but drop all PONG messages
  // from the slave. Note that we don't match on the master / slave
  // PIDs because it's actually the SlaveObserver Process that sends
  // the pings.
  Future<Message> ping = FUTURE_MESSAGE(Eq("PING"), _, _);
  DROP_MESSAGES(Eq("PONG"), _, _);

  MockExecutor exec(DEFAULT_EXECUTOR_ID);

  StandaloneMasterDetector detector(master.get());

  Try<PID<Slave>> slave = StartSlave(&exec, &detector);
  ASSERT_SOME(slave);

  MockScheduler sched;
  MesosSchedulerDriver driver(
      &sched, DEFAULT_FRAMEWORK_INFO, master.get(), DEFAULT_CREDENTIAL);

  EXPECT_CALL(sched, registered(&driver, _, _));

  Future<vector<Offer>> offers;
  EXPECT_CALL(sched, resourceOffers(&driver, _))
    .WillOnce(FutureArg<1>(&offers))
    .WillRepeatedly(Return());

  driver.start();

  AWAIT_READY(offers);
  ASSERT_NE(0u, offers.get().size());

  // Launch a task. This is to ensure the task is killed by the slave,
  // during shutdown.
  TaskID taskId;
  taskId.set_value("1");

  TaskInfo task;
  task.set_name("");
  task.mutable_task_id()->MergeFrom(taskId);
  task.mutable_slave_id()->MergeFrom(offers.get()[0].slave_id());
  task.mutable_resources()->MergeFrom(offers.get()[0].resources());
  task.mutable_executor()->MergeFrom(DEFAULT_EXECUTOR_INFO);
  task.mutable_executor()->mutable_command()->set_value("sleep 60");

  // Set up the expectations for launching the task.
  EXPECT_CALL(exec, registered(_, _, _, _));
  EXPECT_CALL(exec, launchTask(_, _))
    .WillOnce(SendStatusUpdateFromTask(TASK_RUNNING));

  Future<TaskStatus> runningStatus;
  EXPECT_CALL(sched, statusUpdate(&driver, _))
    .WillOnce(FutureArg<1>(&runningStatus));

  Future<Nothing> statusUpdateAck = FUTURE_DISPATCH(
      slave.get(), &Slave::_statusUpdateAcknowledgement);

  driver.launchTasks(offers.get()[0].id(), {task});

  AWAIT_READY(runningStatus);
  EXPECT_EQ(TASK_RUNNING, runningStatus.get().state());

  // Wait for the slave to have handled the acknowledgment prior
  // to pausing the clock.
  AWAIT_READY(statusUpdateAck);

  // Drop the first shutdown message from the master (simulated
  // partition), allow the second shutdown message to pass when
  // the slave re-registers.
  Future<ShutdownMessage> shutdownMessage =
    DROP_PROTOBUF(ShutdownMessage(), _, slave.get());

  Future<TaskStatus> lostStatus;
  EXPECT_CALL(sched, statusUpdate(&driver, _))
    .WillOnce(FutureArg<1>(&lostStatus));

  Future<Nothing> slaveLost;
  EXPECT_CALL(sched, slaveLost(&driver, _))
    .WillOnce(FutureSatisfy(&slaveLost));

  Clock::pause();

  // Now, induce a partition of the slave by having the master
  // timeout the slave.
  size_t pings = 0;
  while (true) {
    AWAIT_READY(ping);
//.........这里部分代码省略.........
开发者ID:CodeTickler,项目名称:mesos,代码行数:101,代码来源:partition_tests.cpp

示例2: tvEqual

HOT_FUNC
bool tvEqual(TypedValue tv1, TypedValue tv2) {
  return tvRelOp(Eq(), tv1, tv2);
}
开发者ID:vincentbdb,项目名称:hiphop-php,代码行数:4,代码来源:tv_comparisons.cpp

示例3: cellEqual

bool cellEqual(Cell cell, bool val) {
  return cellRelOp(Eq(), cell, val);
}
开发者ID:HendrikGrunstra,项目名称:hiphop-php,代码行数:3,代码来源:tv_comparisons.cpp

示例4: cellEqual

bool cellEqual(Cell cell, const StringData* val) {
  return cellRelOp(Eq(), cell, val);
}
开发者ID:vincentbdb,项目名称:hiphop-php,代码行数:3,代码来源:tv_comparisons.cpp

示例5: TEST_F

TEST_F(TextToBinaryTest, OpLine) {
  EXPECT_THAT(CompiledInstructions("OpLine %srcfile 42 99"),
              Eq(MakeInstruction(SpvOpLine, {1, 42, 99})));
}
开发者ID:Dagarman,项目名称:mame,代码行数:4,代码来源:text_to_binary.debug_test.cpp

示例6: TEST_P

TEST_P(OpNameTest, AnyString) {
  const std::string input =
      std::string("OpName %target \"") + GetParam() + "\"";
  EXPECT_THAT(CompiledInstructions(input),
              Eq(MakeInstruction(SpvOpName, {1}, MakeVector(GetParam()))));
}
开发者ID:Dagarman,项目名称:mame,代码行数:6,代码来源:text_to_binary.debug_test.cpp

示例7: return

bool wxRichTextBoxStyleDefinition::operator ==(const wxRichTextBoxStyleDefinition& def) const
{
    return (Eq(def));
}
开发者ID:3v1n0,项目名称:wxWidgets,代码行数:4,代码来源:richtextstyles.cpp

示例8: TEST_F

TEST_F(TestCaseIdCreatorTests, Creation_Sample_Base) {
    EXPECT_THAT(TestCaseIdCreator::createBaseId("foo", 0), Eq("foo_sample"));
}
开发者ID:jonathanirvings,项目名称:tcframe,代码行数:3,代码来源:TestCaseIdCreatorTests.cpp

示例9: lua_pushboolean

int SOPAngle::__eq(lua_State *L) {
    lua_pushboolean(L, Eq(Lunar<SOPAngle>::check(L, 1)));
    return 1;
}
开发者ID:apaloma,项目名称:sourceop,代码行数:4,代码来源:l_class_angle.cpp

示例10: cellEqual

bool cellEqual(Cell cell, const ResourceHdr* val) {
  return cellRelOp(Eq(), cell, val);
}
开发者ID:c9s,项目名称:hhvm,代码行数:3,代码来源:tv-comparisons.cpp

示例11: TEST_F

TEST_F(ScalarTests, Parsing) {
    istringstream in("42");
    A->parseFrom(&in);
    EXPECT_THAT(a, Eq(42));
}
开发者ID:jonathanirvings,项目名称:tcframe,代码行数:5,代码来源:ScalarTests.cpp

示例12: TEST_F

TEST_F(TestCaseIdCreatorTests, SampleTestCaseIdCreation) {
    EXPECT_THAT(TestCaseIdCreator::create("foo", 0, 42), Eq("foo_sample_42"));
}
开发者ID:frarteaga,项目名称:tcframe,代码行数:3,代码来源:TestCaseIdCreatorTests.cpp

示例13: TEST_F

 TEST_F(ToDoTest, constructor_createsEmptyList)
 {
     EXPECT_THAT(list.size(), Eq(size_t(0)));
 }
开发者ID:jensBrunel,项目名称:TestRepo,代码行数:4,代码来源:ToDoTest.cpp

示例14: begin

void
begin (int argc, const char * argv[])
{
  size_t infile;
  size_t n_fields;
  size_t field;
  size_t n_params;
  size_t param;
  const char * comment;
  int mer_field[256] = {0, };

  infile = Infile ("-");
  File_fix (infile, 1, 0);

  puts ("#: taql-0.1/text");

  n_fields = N_fields (infile);
  for (field = 0; field < n_fields; ++field)
    {
      Taql name;
      Taql type;

      fputs ("# field ", stdout);
      name = Field_name (infile, field);
      Fprint (stdout, name);
      fputs (" ", stdout);
      type = Field_type (infile, field);
      Fprint (stdout, type);
      fputc ('\n', stdout);

      if (   Eq (type, Sym ("uint64"))
          && ('m' == Sym_ref(name, 0))
          && ('e' == Sym_ref(name, 1))
          && ('r' == Sym_ref(name, 2))
          && isdigit (Sym_ref(name, 3)))
        {
          mer_field[field] = 1;
        }
    }

  n_params = N_params (infile);
  for (param = 0; param < n_params; ++param)
    {
      fputs ("# param ", stdout);
      Fprint (stdout, Param_name (infile, param));
      fputs (" ", stdout);
      Fprint (stdout, Param_value (infile, param));
      fputc ('\n', stdout);
    }

  comment = Comment (infile);
  if (!comment || !comment[0])
    {
      fputs ("#.\n", stdout);
    }
  else
    {
      const char * c;
      fputs ("#-\n# ", stdout);

      for (c = comment; *c; ++c)
        {
          if (*c == '\n')
            fputs ("\n# ", stdout);
          else
            fputc (*c, stdout);
        }
      fputs ("\n#.\n", stdout);
    }

  while (N_ahead (infile))
    {
      for (field = 0; field < n_fields; ++field)
        {
          Taql value;

          if (field)
            fputc (' ', stdout);

          value = Peek (infile, 0, field);

          if (!mer_field [field])
            {
              Fprint (stdout, value);
            }
          else
            {
              t_taql_uint64 mer;
              char in_ascii[17];

              mer = as_uInt64 (value);
              mer_to_ascii (in_ascii, mer);
              fputs (in_ascii, stdout);
            }
        }
      fputc ('\n', stdout);
      Advance (infile, 1);
    }
}
开发者ID:curoverse,项目名称:warehouse-apps,代码行数:99,代码来源:gprint.c


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