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


C++ ProjectDatabase::timestampCreate方法代码示例

本文整理汇总了C++中ProjectDatabase::timestampCreate方法的典型用法代码示例。如果您正苦于以下问题:C++ ProjectDatabase::timestampCreate方法的具体用法?C++ ProjectDatabase::timestampCreate怎么用?C++ ProjectDatabase::timestampCreate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ProjectDatabase的用法示例。


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

示例1: problem

TEST_F(ProjectFixture, WorkflowRecord_Base) {
  ProjectDatabase database = getCleanDatabase("WorkflowRecord_Base");
  EXPECT_EQ(database.timestampCreate(), database.timestampLast());
  EXPECT_EQ(database.handle(), database.uuidLast());

  openstudio::System::msleep(1000);

  EXPECT_EQ(static_cast<unsigned>(0), WorkflowRecord::getWorkflowRecords(database).size());

  openstudio::runmanager::Workflow rmWorkflow;
  rmWorkflow.addJob(openstudio::runmanager::JobType::Null, "");

  // Fake ProblemRecord so can test WorkflowRecord
  Problem problem("Dummy",WorkflowStepVector());
  ProblemRecord problemRecord = ProblemRecord::factoryFromProblem(problem,database);

  WorkflowRecord workflowRecord(rmWorkflow, problemRecord, 0);
  EXPECT_EQ("", workflowRecord.name());
  EXPECT_EQ("", workflowRecord.displayName());
  EXPECT_EQ("", workflowRecord.description());
  EXPECT_TRUE(workflowRecord.timestampCreate() > database.timestampCreate());
  EXPECT_EQ(workflowRecord.timestampCreate(), workflowRecord.timestampLast());
  EXPECT_EQ(workflowRecord.handle(), rmWorkflow.uuid());

  EXPECT_EQ(database.timestampLast(), database.timestampCreate());
  EXPECT_EQ(database.handle(), database.uuidLast());

  openstudio::System::msleep(1000);

  database.save();

  EXPECT_TRUE(database.timestampLast() > database.timestampCreate());
  EXPECT_NE(database.handle(), database.uuidLast());

  DateTime databaseTimestampLast = database.timestampLast();
  UUID databaseUUIDLast = database.uuidLast();

  openstudio::System::msleep(1000);

  database.save();

  EXPECT_EQ(database.timestampLast(), databaseTimestampLast);
  EXPECT_EQ(database.uuidLast(), databaseUUIDLast);

  EXPECT_EQ(static_cast<unsigned>(1), WorkflowRecord::getWorkflowRecords(database).size());

  EXPECT_EQ(database.timestampLast(), databaseTimestampLast);
  EXPECT_EQ(database.uuidLast(), databaseUUIDLast);
  EXPECT_EQ(workflowRecord.timestampCreate(), workflowRecord.timestampLast());
  EXPECT_EQ(workflowRecord.handle(), rmWorkflow.uuid());

  EXPECT_TRUE(workflowRecord.setDescription("A simple workflowRecord"));

  EXPECT_EQ(database.timestampLast(), databaseTimestampLast);
  EXPECT_EQ(database.uuidLast(), databaseUUIDLast);
  EXPECT_TRUE(workflowRecord.timestampCreate() < workflowRecord.timestampLast());
  EXPECT_NE(workflowRecord.handle(), workflowRecord.uuidLast());

  openstudio::System::msleep(1000);

  database.save();

  EXPECT_TRUE(databaseTimestampLast < database.timestampLast());
  EXPECT_NE(database.uuidLast(), databaseUUIDLast);
  EXPECT_TRUE(workflowRecord.timestampCreate() < workflowRecord.timestampLast());
  EXPECT_NE(workflowRecord.handle(), workflowRecord.uuidLast());

  databaseTimestampLast = database.timestampLast();
  databaseUUIDLast = database.uuidLast();
  DateTime workflowTimestampLast = workflowRecord.timestampLast();
  UUID workflowUUIDLast = workflowRecord.uuidLast();

  EXPECT_EQ(static_cast<unsigned>(1), WorkflowRecord::getWorkflowRecords(database).size());

  EXPECT_EQ(database.timestampLast(), databaseTimestampLast);
  EXPECT_EQ(database.uuidLast(), databaseUUIDLast);
  EXPECT_EQ(workflowRecord.timestampLast(), workflowTimestampLast);
  EXPECT_EQ(workflowRecord.uuidLast(), workflowUUIDLast);

  EXPECT_TRUE(database.removeRecord(workflowRecord));

  EXPECT_EQ(static_cast<unsigned>(0), WorkflowRecord::getWorkflowRecords(database).size());

  EXPECT_EQ(database.timestampLast(), databaseTimestampLast);
  EXPECT_EQ(database.uuidLast(), databaseUUIDLast);
  EXPECT_EQ(workflowTimestampLast, workflowRecord.timestampLast());
  EXPECT_EQ(workflowUUIDLast, workflowRecord.uuidLast());

  openstudio::System::msleep(1000);

  database.save();

  EXPECT_TRUE(databaseTimestampLast < database.timestampLast());
  EXPECT_NE(database.uuidLast(), databaseUUIDLast);
  EXPECT_EQ(workflowTimestampLast, workflowRecord.timestampLast());
  EXPECT_EQ(workflowUUIDLast, workflowRecord.uuidLast());

}
开发者ID:ORNL-BTRIC,项目名称:OpenStudio,代码行数:98,代码来源:WorkflowRecord_GTest.cpp


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