本文整理匯總了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);
//.........這裏部分代碼省略.........
示例2: tvEqual
HOT_FUNC
bool tvEqual(TypedValue tv1, TypedValue tv2) {
return tvRelOp(Eq(), tv1, tv2);
}
示例3: cellEqual
bool cellEqual(Cell cell, bool val) {
return cellRelOp(Eq(), cell, val);
}
示例4: cellEqual
bool cellEqual(Cell cell, const StringData* val) {
return cellRelOp(Eq(), cell, val);
}
示例5: TEST_F
TEST_F(TextToBinaryTest, OpLine) {
EXPECT_THAT(CompiledInstructions("OpLine %srcfile 42 99"),
Eq(MakeInstruction(SpvOpLine, {1, 42, 99})));
}
示例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()))));
}
示例7: return
bool wxRichTextBoxStyleDefinition::operator ==(const wxRichTextBoxStyleDefinition& def) const
{
return (Eq(def));
}
示例8: TEST_F
TEST_F(TestCaseIdCreatorTests, Creation_Sample_Base) {
EXPECT_THAT(TestCaseIdCreator::createBaseId("foo", 0), Eq("foo_sample"));
}
示例9: lua_pushboolean
int SOPAngle::__eq(lua_State *L) {
lua_pushboolean(L, Eq(Lunar<SOPAngle>::check(L, 1)));
return 1;
}
示例10: cellEqual
bool cellEqual(Cell cell, const ResourceHdr* val) {
return cellRelOp(Eq(), cell, val);
}
示例11: TEST_F
TEST_F(ScalarTests, Parsing) {
istringstream in("42");
A->parseFrom(&in);
EXPECT_THAT(a, Eq(42));
}
示例12: TEST_F
TEST_F(TestCaseIdCreatorTests, SampleTestCaseIdCreation) {
EXPECT_THAT(TestCaseIdCreator::create("foo", 0, 42), Eq("foo_sample_42"));
}
示例13: TEST_F
TEST_F(ToDoTest, constructor_createsEmptyList)
{
EXPECT_THAT(list.size(), Eq(size_t(0)));
}
示例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);
}
}