本文整理汇总了C++中openstudio::isQuantity方法的典型用法代码示例。如果您正苦于以下问题:C++ openstudio::isQuantity方法的具体用法?C++ openstudio::isQuantity怎么用?C++ openstudio::isQuantity使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openstudio
的用法示例。
在下文中一共展示了openstudio::isQuantity方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: aQuantity
TEST_F(UnitsFixture,QuantityRegex_Quantities) {
// quantity
std::string aQuantity("3 m");
EXPECT_TRUE(isQuantity(aQuantity));
aQuantity = ".1E-4 kJ*m/s"; EXPECT_TRUE(isQuantity(aQuantity));
aQuantity = "0.321 \\mu(ft^{-2}/ms*PJ)"; EXPECT_TRUE(isQuantity(aQuantity));
aQuantity = "19856D19867 kN/short"; EXPECT_TRUE(isQuantity(aQuantity));
aQuantity = "141.21 kBtu/ft^2*yr"; EXPECT_TRUE(isQuantity(aQuantity));
aQuantity = "1.1 MJ/s"; EXPECT_TRUE(isQuantity(aQuantity));
aQuantity = "61 M(J)"; EXPECT_TRUE(isQuantity(aQuantity));
// not a quantity
std::string notAQuantity("3 m^^2");
EXPECT_FALSE(isQuantity(notAQuantity));
notAQuantity = "300. ft"; EXPECT_FALSE(isQuantity(notAQuantity));
notAQuantity = "21E-2 ft^21/s)"; EXPECT_FALSE(isQuantity(notAQuantity));
notAQuantity = " 300 m"; EXPECT_FALSE(isQuantity(notAQuantity));
notAQuantity = "2 ft "; EXPECT_FALSE(isQuantity(notAQuantity));
notAQuantity = "k300/s"; EXPECT_FALSE(isQuantity(notAQuantity));
notAQuantity = "text only"; EXPECT_FALSE(isQuantity(notAQuantity));
// contains a quantity
std::string includesQuantity("The building has a floor area of 3000 ft^2.");
EXPECT_TRUE(containsQuantity(includesQuantity));
includesQuantity = "2.0E-4 kN"; EXPECT_TRUE(containsQuantity(includesQuantity));
includesQuantity = " 91.38967D-002 bats/s; "; EXPECT_TRUE(containsQuantity(includesQuantity));
includesQuantity = "A 2 var model is parsimonious."; EXPECT_TRUE(containsQuantity(includesQuantity));
includesQuantity = "Down to 31 bottles of beer on the wall."; EXPECT_TRUE(containsQuantity(includesQuantity));
includesQuantity = "Energy use: 250 kWh/yr"; EXPECT_TRUE(containsQuantity(includesQuantity));
// does not contain a quantity
std::string noQuantityHere("The building has a floor area of 3,000 ft^2.");
EXPECT_FALSE(containsQuantity(noQuantityHere));
noQuantityHere = "just text"; EXPECT_FALSE(containsQuantity(noQuantityHere));
noQuantityHere = "kJ/s"; EXPECT_FALSE(containsQuantity(noQuantityHere));
noQuantityHere = "32~0 kJ/"; EXPECT_FALSE(containsQuantity(noQuantityHere));
noQuantityHere = "3 m+"; EXPECT_FALSE(containsQuantity(noQuantityHere));
}