• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ openstudio类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: FileLogSink

void EnergyPlusFixture::SetUpTestCase() {
  // set up logging
  logFile = FileLogSink(toPath("./EnergyPlusFixture.log"));
  logFile->setLogLevel(Debug);
  openstudio::Logger::instance().standardOutLogger().disable();

  // initialize component paths
  openstudio::path basePath = resourcesPath()/openstudio::toPath("energyplus/Components/");
  // idfComponents consists of .first = path to directory, .second = component type
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_roof_1"),"roof"));
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_roof_2"),"roof"));
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_roof_3"),"roof"));
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_roof_4"),"roof"));
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_roof_5"),"roof"));
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_designday_1"),"designday"));
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_designday_2"),"designday"));
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_designday_3"),"designday"));
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_designday_4"),"designday"));
  idfComponents.push_back(std::pair<openstudio::path,std::string>(basePath/openstudio::toPath("idf_designday_5"),"designday"));

  // delete translated components
  BOOST_FOREACH(const ComponentDirectoryAndType& idfComponent,idfComponents) {
    // delete any *.osc and oscomponent.xml files in the directory
    for (openstudio::directory_iterator it(idfComponent.first), itEnd; it != itEnd; ++it) {
      if (boost::filesystem::is_regular_file(it->status())) {
        std::string ext = openstudio::toString(boost::filesystem::extension(*it));
        if (ext == ".osc") { boost::filesystem::remove(it->path()); }
        if ((ext == ".xml") && (openstudio::toString(it->filename()) == "oscomponent")) { 
          boost::filesystem::remove(it->path()); 
        }
      }
    } // for iterator over directory
  } // foreach component

}
开发者ID:CraigCasey,项目名称:OpenStudio,代码行数:35,代码来源:EnergyPlusFixture.cpp


示例2: TEST

TEST(Table, Serialization)
{
  // construct table
  openstudio::path p = resourcesPath()/toPath("utilities/Table/EUI.csv");
  Table table = Table::load(p);
  table.setTitle("EUIs");
  table.setCaption("EUIs of several buildings");
  table.setNHead(2);
  table.setNLeft(2);
  p = resourcesPath()/toPath("utilities/Table/EUI.ost");

  // serialize
  openstudio::Time start = openstudio::Time::currentTime();
  table.save(p);
  openstudio::Time totalTime = openstudio::Time::currentTime() - start;
  LOG_FREE(Info, "openstudio.Table", "Time to serialize a small table = " << totalTime);

  // [email protected] Uncommenting this line results in a compiler error that I haven't been
  // able to debug.
  // OptionalTable ot;

  // deserialize
  start = openstudio::Time::currentTime();
  Table loaded = Table::load(p);
  totalTime = openstudio::Time::currentTime() - start;
  LOG_FREE(Info, "openstudio.Table", "Time to deserialize a small table = " << totalTime);
  ASSERT_EQ(static_cast<unsigned>(10),loaded.nRows());
  ASSERT_EQ(static_cast<unsigned>(6),loaded.nCols());
  std::stringstream ss;
  ss << std::fixed << std::setprecision(0) << table[2][2];
  EXPECT_EQ("120",ss.str()); ss.str("");
}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:32,代码来源:Table_GTest.cpp


示例3: TEST_F

TEST_F(CoreFixture, PathWatcher_Dir)
{
  Application::instance().application();

  openstudio::path path = toPath("./");
  ASSERT_TRUE(boost::filesystem::exists(path));

  openstudio::path filePath = toPath("./PathWatcher_Dir");
  if (boost::filesystem::exists(filePath)){
    boost::filesystem::remove(filePath);
  }
  ASSERT_FALSE(boost::filesystem::exists(filePath));

  TestPathWatcher watcher(path);
  EXPECT_FALSE(watcher.changed);

  EXPECT_EQ(path.string(), watcher.path().string());

  // catches the file addition
  TestFileWriter w1(filePath, "test 1"); w1.start(); 
  while (!w1.isFinished()){  
    // do not call process events
    QThread::yieldCurrentThread();
  }
  EXPECT_TRUE(boost::filesystem::exists(filePath));

  // calls processEvents
  System::msleep(10);

  EXPECT_TRUE(watcher.changed);
  watcher.changed = false;
  EXPECT_FALSE(watcher.changed);

  // does not catch changes to the file
  TestFileWriter w2(filePath, "test 2"); w2.start(); 
  while (!w2.isFinished()){  
    // do not call process events
    QThread::yieldCurrentThread();
  }
  EXPECT_TRUE(boost::filesystem::exists(filePath));

  // calls processEvents
  System::msleep(10);

  EXPECT_FALSE(watcher.changed);
  
  // catches file removal
  TestFileRemover r1(filePath); r1.start();
  while (!r1.isFinished()){  
    // do not call process events
    QThread::yieldCurrentThread();
  }
  EXPECT_FALSE(boost::filesystem::exists(filePath));

  // calls processEvents
  System::msleep(10);

  EXPECT_TRUE(watcher.changed);
}
开发者ID:CUEBoxer,项目名称:OpenStudio,代码行数:59,代码来源:PathWatcher_GTest.cpp


示例4: TEST

TEST(EnumHelpers, isMember)
{
  openstudio::enums::TestEnum te("third");
  openstudio::StringVector members;
  members.push_back("first");
  members.push_back("elephant"); // bad values are ignored
  EXPECT_FALSE(isMember(te,members));
  members.push_back("third");
  EXPECT_TRUE(isMember(te,members));
}
开发者ID:airguider,项目名称:OpenStudio,代码行数:10,代码来源:EnumHelpers_GTest.cpp


示例5: FileLogSink

void SqlFileFixture::SetUpTestCase()
{
  logFile = FileLogSink(toPath("./SqlFileFixture.log"));
  logFile->setLogLevel(Debug);

  openstudio::path path;
  path = resourcesPath()/toPath("energyplus/5ZoneAirCooled/eplusout.sql");
  sqlFile = openstudio::SqlFile(path);
  ASSERT_TRUE(sqlFile.connectionOpen());
}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:10,代码来源:SqlFileFixture.cpp


示例6: FileLogSink

void ProjectFixture::SetUpTestCase() {
  // set up logging
  logFile = FileLogSink(toPath("./ProjectFixture.log"));
  logFile->setLogLevel(Info);
  openstudio::Logger::instance().standardOutLogger().disable();

  // set up data folder
  if (!boost::filesystem::exists(toPath("ProjectFixtureData"))) {
    boost::filesystem::create_directory(toPath("ProjectFixtureData"));
  }

}
开发者ID:pepsi7959,项目名称:OpenStudio,代码行数:12,代码来源:ProjectFixture.cpp


示例7: FileLogSink

// initialize static members
void UnitsFixture::SetUpTestCase() 
{
  logFile = FileLogSink(toPath("./UnitsFixture.log"));
  logFile->setLogLevel(Debug);
  Logger::instance().standardOutLogger().disable();
  
  tol = 1.0E-8;

  openstudio::DoubleVector vals = openstudio::toStandardVector(openstudio::randVector(0.0,1000.0,8760u));
  openstudio::Unit u = openstudio::createSIPower();
  for (double val : vals) {
    testQuantityVector.push_back(openstudio::Quantity(val,u));
  }
  testOSQuantityVector = openstudio::OSQuantityVector(u,vals);
}
开发者ID:pepsi7959,项目名称:OpenStudio,代码行数:16,代码来源:UnitsFixture.cpp


示例8: TEST_F

TEST_F(UnitsFixture,QuantityRegex_DecomposeAtomicUnits) {
  std::string uStr("m");
  std::pair<std::string,int> result;
  result = decomposeAtomicUnitString(uStr);
  EXPECT_EQ("m",result.first); EXPECT_EQ(1,result.second);

  uStr = "kg^3"; result = decomposeAtomicUnitString(uStr);
  EXPECT_EQ("kg",result.first); EXPECT_EQ(3,result.second);

  uStr = "short^{-3291}"; result = decomposeAtomicUnitString(uStr);
  EXPECT_EQ("short",result.first); EXPECT_EQ(-3291,result.second);

  EXPECT_THROW(decomposeAtomicUnitString("kg^{2}"),openstudio::Exception);
  EXPECT_THROW(decomposeAtomicUnitString("kg/s"),openstudio::Exception);
}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:15,代码来源:QuantityRegex_GTest.cpp


示例9: FileLogSink

void IddFixture::SetUpTestCase()
{
  // set up logging
  logFile = FileLogSink(toPath("./IddFixture.log"));
  logFile->setLogLevel(Debug);

  // load from factory and time it
  openstudio::Time start = openstudio::Time::currentTime();
  epIddFile = openstudio::IddFactory::instance().getIddFile(openstudio::IddFileType::EnergyPlus);
  iddLoadTime = openstudio::Time::currentTime() - start;

  LOG(Info, "EnergyPlus IddFile load time (from IddFactory) = " << iddLoadTime);

  start = openstudio::Time::currentTime();
  osIddFile = openstudio::IddFactory::instance().getIddFile(openstudio::IddFileType::OpenStudio);
  iddLoadTime = openstudio::Time::currentTime() - start;

  LOG(Info, "OpenStudio IddFile load time (from IddFactory) = " << iddLoadTime);
}
开发者ID:pepsi7959,项目名称:OpenStudio,代码行数:19,代码来源:IddFixture.cpp


示例10: LOG

TEST_F(UnitsFixture,IPUnit_ArithmeticOperators)
{
    LOG(Debug,"IPUnit_ArithmeticOperators");

    IPUnit u1;
    IPUnit u2 = createIPForce();
    IPUnit u3(IPExpnt(1));

    u1 *= u3;
    testStreamOutput("lb_m",u1);
    Unit u4 = u2*u3;
    ASSERT_TRUE(u4.system() == UnitSystem::IP);
    testStreamOutput("lb_m*lb_f",u4);
    u4.cast<IPUnit>().lbfToLbm();
    testStreamOutput("lb_m^2*ft/s^2",u4);

    Unit u5 = u4/u3;
    EXPECT_TRUE(u5.system() == UnitSystem::IP);
    EXPECT_TRUE(u5 == u2);

    Unit u6 = pow(u5,-6);
    EXPECT_TRUE(u6.system() == UnitSystem::IP);
    testStreamOutput("s^12/lb_m^6*ft^6",u6);
    u6.pow(1,3);
    testStreamOutput("s^4/lb_m^2*ft^2",u6);
}
开发者ID:BIMDataHub,项目名称:OpenStudio-IFC-Importer,代码行数:26,代码来源:IPUnit_GTest.cpp


示例11: checksum

TEST(Checksum, Streams)
{
  stringstream ss;
  EXPECT_EQ(istream::goodbit, ss.rdstate());
  EXPECT_EQ("00000000", checksum(ss));

  // checksum tried to read from empty stream and both eof and fail bits are set
  EXPECT_EQ(istream::failbit | istream::eofbit, ss.rdstate());

  // need to clear the eofbit that was set when checksum read all the way through
  ss.clear();
  EXPECT_EQ(istream::goodbit, ss.rdstate());

  // write some more to the stringstream
  ss << "Hi there";
  EXPECT_EQ(istream::goodbit, ss.rdstate());
  EXPECT_EQ("1AD514BA", checksum(ss));

  // checksum read all the way through and eofbit is set
  EXPECT_EQ(istream::failbit | istream::eofbit, ss.rdstate());
  EXPECT_EQ("00000000", checksum(ss));
  EXPECT_EQ(istream::failbit | istream::eofbit, ss.rdstate());

  // need to clear the eofbit that was set when checksum read all the way through
  ss.clear();
  EXPECT_EQ(istream::goodbit, ss.rdstate());
  EXPECT_EQ("00000000", checksum(ss));
}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:28,代码来源:Checksum_GTest.cpp


示例12: LOG

TEST_F(UnitsFixture,BTUUnit_ArithmeticOperators)
{
  LOG(Debug,"BTUUnit_ArithmeticOperators");

  // /=
  BTUUnit P1(BTUExpnt(1));
  BTUUnit t1(BTUExpnt(0,0,1));
  P1 /= t1;
  EXPECT_EQ("Btu/h",P1.standardString(false));
  EXPECT_EQ(1,P1.baseUnitExponent("Btu"));
  EXPECT_EQ(-1,P1.baseUnitExponent("h"));
  EXPECT_EQ(0,P1.baseUnitExponent("ft"));
  EXPECT_EQ(0,P1.baseUnitExponent("m"));

  // *
  Unit E1 = P1 * t1;
  EXPECT_TRUE(E1.system() == UnitSystem::BTU);
  EXPECT_EQ("Btu",E1.standardString(false));
  EXPECT_EQ("",E1.prettyString());

  // /
  Unit u = P1/E1;
  u /= t1;
  EXPECT_TRUE(u.system() == UnitSystem::BTU);
  EXPECT_EQ("1/h^2",u.standardString(false));
  EXPECT_EQ(-2,u.baseUnitExponent("h"));
  EXPECT_EQ(0,u.baseUnitExponent("Btu"));

  // pow
  u.pow(-1,2);
  EXPECT_EQ("h",u.standardString(false));
  EXPECT_EQ(1,u.baseUnitExponent("h"));

}
开发者ID:jtanaa,项目名称:OpenStudio,代码行数:34,代码来源:BTUUnit_GTest.cpp


示例13: LOG

TEST_F(UnitsFixture,SIUnit_ArithmeticOperators)
{
    LOG(Debug,"SIUnit_ArithmeticOperators");

    SIUnit u1;
    SIUnit u2(SIExpnt(1,1,-2,0),0,"N");
    SIUnit u3(SIExpnt(1)); // kg
    SIUnit u4(SIExpnt(0,1,0,0),-2); // cm

    // multiplication
    u1 *= u3; // kg
    testStreamOutput("kg",u1);
    Unit u5 = u2*u3; // N*kg
    EXPECT_TRUE(u5.system() == UnitSystem::SI);
    testStreamOutput("N*kg",u5);
    Unit u6 = u2*u4; // cJ
    EXPECT_TRUE(u6.system() == UnitSystem::SI);
    testStreamOutput("cJ",u6);

    // division
    u6 /= u4;
    EXPECT_TRUE(u6 == u2);

    // power
    Unit u7 = pow(u4,6); // (cm)^6
    EXPECT_TRUE(u7.system() == UnitSystem::SI);
    testStreamOutput("cm^6",u7);
    EXPECT_EQ("p",u7.scale().abbr);
    u7.pow(1,3); // (cm)^2
    testStreamOutput("m(m^2)",u7); // no 10^-4 scale--moves to 10^-3
}
开发者ID:,项目名称:,代码行数:31,代码来源:


示例14: decomposeAtomicUnitString

TEST_F(UnitsFixture,QuantityRegex_PumpFields) {

  std::string aUnit;
  // Design Shaft Power per Unit Flow Rate per Unit Head is posing problems
  // After trial and error, I can format the IDD so it works: No parenthesis, one divisor
  // Currently this is the only one that passes
  aUnit = "W*s/m^3*Pa"; EXPECT_TRUE(isUnit(aUnit));
  aUnit = "W*min/gal*ftH_{2}O"; EXPECT_TRUE(isUnit(aUnit));


  std::pair<std::string,int> atomicDecomp;

  aUnit = "ftH_{2}O";
  // this shouldn't be an atomic unit!
  // EXPECT_FALSE(isAtomicUnit(aUnit));

  // But we can at least make sure that the decomposition at least returns the right exponent (1...)
  atomicDecomp = decomposeAtomicUnitString(aUnit);
  EXPECT_EQ("ftH_{2}O", atomicDecomp.first);
  EXPECT_EQ(1, atomicDecomp.second);

  aUnit = "1/ftH_{2}O";
  EXPECT_FALSE(containsScientificNotationValue(aUnit));
  // There is no multiplier (km, ms, etc)
  // This returns TRUE, like above... but we'll make sure it ends up fine...
  // EXPECT_FALSE(containsAtomicUnit(aUnit));

  // 1 over something is a Compound Unit)
  EXPECT_TRUE(containsCompoundUnit(aUnit));

  EXPECT_FALSE(containsScaledUnit(aUnit));
  EXPECT_FALSE(containsDirectScaledUnit(aUnit));
  EXPECT_TRUE(isUnit(aUnit));

  ASSERT_TRUE(isCompoundUnit(aUnit));

  std::pair< std::vector<std::string>,std::vector<std::string> > result;

  result = decomposeCompoundUnitString(aUnit);
  // Nothing on numerator
  ASSERT_EQ(static_cast<size_t>(0),result.first.size());
  // Should have one unit on the denominator
  ASSERT_EQ(static_cast<size_t>(1),result.second.size());
  EXPECT_EQ("ftH_{2}O",result.second[0]);


  // All of these variations do fail
/*
 *  aUnit = "(W*s)/(m^3*Pa)"; EXPECT_TRUE(isUnit(aUnit));
 *  aUnit = "(W*s)/(m^3*Pa)"; EXPECT_TRUE(isUnit(aUnit));
 *
 *  aUnit = "(W*min)/(gal*ftH_{2}O)"; EXPECT_TRUE(isUnit(aUnit));
 *  aUnit = "W*min/(gal*ftH_{2}O)"; EXPECT_TRUE(isUnit(aUnit));
 *
 *  aUnit = "W/((m^3/s)*Pa)"; EXPECT_TRUE(isUnit(aUnit));
 *  aUnit = "W/((gal/min)*ftH_{2}O)"; EXPECT_TRUE(isUnit(aUnit));
 */

}
开发者ID:NREL,项目名称:OpenStudio,代码行数:59,代码来源:QuantityRegex_GTest.cpp


示例15: logBeforeAndAfterPathInformation

void logBeforeAndAfterPathInformation(const std::string& functionName,
                                      const path& before,const path& after) {
  std::stringstream ssb,ssa;
  
  printPathInformation(ssb,before);
  printPathInformation(ssa,after);
  
  LOG_FREE(Debug,"CoreFixture","Before " << functionName << ": " << ssb.str() << std::endl 
           << "After " << functionName << ": " << ssa.str() << std::endl);
}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:10,代码来源:Path_GTest.cpp


示例16:

TEST(Compare, EqualityForOneHalfOfPair)
{
  std::pair<std::string,int> p1("Employee",32);
  std::pair<int,bool> p2(-246,true);
  std::pair<bool,std::string> p3(false,"Hello");

  ASSERT_TRUE(firstOfPairEqual(p1,std::string("Employee")));
  ASSERT_FALSE(secondOfPairEqual(p1,55));
  ASSERT_TRUE(secondOfPairEqual(p2,true));
  ASSERT_FALSE(secondOfPairEqual(p3,std::string("World")));
  ASSERT_FALSE(firstOfPairEqual(p2,0));
}
开发者ID:jtanaa,项目名称:OpenStudio,代码行数:12,代码来源:Compare_GTest.cpp


示例17:

TEST(Checksum, UUIDs) {
  StringVector checksums;
  for (unsigned i = 0, n = 1000; i < n; ++i) {
    checksums.push_back(checksum(toString(createUUID())));
  }
  auto itStart = checksums.begin();
  ++itStart;
  for (auto it = checksums.begin(), itEnd = checksums.end(); 
       itStart != itEnd; ++it, ++itStart) {
    EXPECT_TRUE(std::find(itStart,itEnd,*it) == itEnd);
  }
}
开发者ID:MatthewSteen,项目名称:OpenStudio,代码行数:12,代码来源:Checksum_GTest.cpp


示例18: SetUpTestCase

void DocumentFixture::SetUpTestCase() {
  // set up logging
  logFile = FileLogSink(toPath("./DocumentFixture.log"));
  logFile->setLogLevel(Info);

  // set up doc
  doc.setTitle("Excerpt from 2009 Grocery TSD");
  doc.addAuthor("Matthew Leach");
  doc.addAuthor("Elaine Hale");
  doc.addAuthor("Adam Hirsch");
  doc.addAuthor("Paul Torcellini");
  doc.setTopHeadingLevel(1u);
  Section section = doc.appendSection("Building Economic Parameters");
  Text txt;
  std::stringstream ss;
  ss << "Our statement of work mandates that the design recommendations be analyzed for cost "
     << "effectiveness based on a five-year analysis period, which is assumed acceptable to a "
     << "majority of developers and owners. The other basic economic parameters required for the "
     << "5-TLCC calculation were taken from RSMeans and the Office of Management and Budget "
     << "(OMB) (CITATIONS).";
  txt.append(ss.str()); ss.str("");
  ss << "This analysis uses the real discount rate, which accounts for the projected rate of "
     << "general inflation found in the Report of the President's Economic Advisors, Analytical "
     << "Perpectives, and is equal to 2.3% for a five-year analysis period (CITATION). By using "
     << "this rate, we do not have to explicitly account for energy and product inflation rates.";
  txt.append(ss.str()); ss.str("");
  ss << "Regional capital cost modifiers are used to convert national averages to regional "
     << "values. These are available from the RSMeans data sets and are applied before any of the "
     << "additional fees listed in TABLE REF, three of which are also provided by RSMeans "
     << "(CITATION).";
  txt.append(ss.str()); ss.str("");
  Table tbl;
  tbl.setTitle("Economic Parameter Values");
  std::vector<std::string> row;
  row.push_back("Economic Parameter");
  row.push_back("Value");
  row.push_back("Data Source");
  tbl.appendRow(row);
  tbl.setNHead(1);
  row[0] = "Analysis Period";            row[1] = "5 Years"; row[2] = "DOE";        tbl.appendRow(row);
  row[0] = "Discount Rate";              row[1] = "2.3%";    row[2] = "OMB";        tbl.appendRow(row);
  row[0] = "O&M Cost Inflation";         row[1] = "0%";      row[2] = "OMB";        tbl.appendRow(row);
  row[0] = "Gas Cost Inflation";         row[1] = "0%";      row[2] = "OMB";        tbl.appendRow(row);
  row[0] = "Electricity Cost Inflation"; row[1] = "0%";      row[2] = "OMB";        tbl.appendRow(row);
  row[0] = "Bond Fee";                   row[1] = "10%";     row[2] = "RSMeans";    tbl.appendRow(row);
  row[0] = "Contractor Fee";             row[1] = "10%";     row[2] = "RSMeans";    tbl.appendRow(row);
  row[0] = "Contingency Fee";            row[1] = "12%";     row[2] = "RSMeans";    tbl.appendRow(row);
  row[0] = "Commissioning Fee";          row[1] = "0.5%";    row[2] = "Assumption"; tbl.appendRow(row);
  section.append(txt);
  section.append(tbl);
}
开发者ID:airguider,项目名称:OpenStudio,代码行数:51,代码来源:DocumentFixture.cpp


示例19: firstParagraph

TEST(Text, ConstructGetSet)
{
  std::string firstParagraph("Let me not stay a jot for dinner; go get it ready.");
  StringVector paragraphs;
  paragraphs.push_back("How now! what art thou?");
  paragraphs.push_back("A man, sir.");
  paragraphs.push_back("What dost thou profess? what wouldst thou with us?");
  std::string lastParagraph("I do profess to be no less than I seem; to serve<br/> \
                            him truly that will put me in trust: to love him<br/> \
                            that is honest; to converse with him that is wise,<br/> \
                            and says little; to fear judgment; to fight when I<br/> \
                            cannot choose; and to eat no fist.");
  
  Text text(firstParagraph);
  StringVector textParagraphs = text.paragraphs();
  ASSERT_EQ(static_cast<unsigned>(1),textParagraphs.size());
  EXPECT_EQ("Let me not stay a jot for dinner; go get it ready.",textParagraphs[0]);

  text = Text(paragraphs);
  text.insert(0,firstParagraph);
  textParagraphs = text.paragraphs();
  EXPECT_EQ(static_cast<unsigned>(4),textParagraphs.size());
  EXPECT_EQ(firstParagraph,textParagraphs[0]);
  text.replace(textParagraphs.size(),lastParagraph);
  textParagraphs = text.paragraphs();
  EXPECT_EQ(static_cast<unsigned>(5),textParagraphs.size());
  EXPECT_ANY_THROW(text.insert(textParagraphs.size() + 2,lastParagraph));
}
开发者ID:airguider,项目名称:OpenStudio,代码行数:28,代码来源:Text_GTest.cpp


示例20: toPath

TEST_F(CoreFixture, Path_RelativePathToFile) 
{
  path relPath = toPath("energyplus/5ZoneAirCooled/eplusout.sql");
  path fullPath = resourcesPath() / relPath;
  EXPECT_EQ(toString(relPath),toString(relativePath(fullPath,resourcesPath())));

  EXPECT_EQ("eplusout.sql",toString(relativePath(relPath,toPath("energyplus/5ZoneAirCooled/"))));
}
开发者ID:ChengXinDL,项目名称:OpenStudio,代码行数:8,代码来源:Path_GTest.cpp



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ operation类代码示例发布时间:2022-05-31
下一篇:
C++ op_queue类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap