本文整理汇总了C++中openstudio::containsScientificNotationValue方法的典型用法代码示例。如果您正苦于以下问题:C++ openstudio::containsScientificNotationValue方法的具体用法?C++ openstudio::containsScientificNotationValue怎么用?C++ openstudio::containsScientificNotationValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openstudio
的用法示例。
在下文中一共展示了openstudio::containsScientificNotationValue方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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));
*/
}
示例2: fixedValue
TEST_F(UnitsFixture,QuantityRegex_Values) {
// strings that should be FixedPrecisionValues
std::string fixedValue("0.321");
EXPECT_TRUE(isFixedPrecisionValue(fixedValue));
fixedValue = "20"; EXPECT_TRUE(isFixedPrecisionValue(fixedValue));
fixedValue = ".3120"; EXPECT_TRUE(isFixedPrecisionValue(fixedValue));
fixedValue = "1020.185961"; EXPECT_TRUE(isFixedPrecisionValue(fixedValue));
fixedValue = ".1"; EXPECT_TRUE(isFixedPrecisionValue(fixedValue));
fixedValue = "3.1"; EXPECT_TRUE(isFixedPrecisionValue(fixedValue));
fixedValue = "-0.12"; EXPECT_TRUE(isFixedPrecisionValue(fixedValue));
// strings that should not be FixedPrecisionValues
std::string notFixedValue("0 ");
EXPECT_FALSE(isFixedPrecisionValue(notFixedValue));
notFixedValue = "."; EXPECT_FALSE(isFixedPrecisionValue(notFixedValue));
notFixedValue = "1.1 "; EXPECT_FALSE(isFixedPrecisionValue(notFixedValue));
notFixedValue = "1.0E000"; EXPECT_FALSE(isFixedPrecisionValue(notFixedValue));
notFixedValue = ".3D-32"; EXPECT_FALSE(isFixedPrecisionValue(notFixedValue));
notFixedValue = "5 N"; EXPECT_FALSE(isFixedPrecisionValue(notFixedValue));
notFixedValue = "5,000"; EXPECT_FALSE(isFixedPrecisionValue(notFixedValue));
notFixedValue = "5000."; EXPECT_FALSE(isFixedPrecisionValue(notFixedValue));
// strings that should contain FixedPrecisionValues
std::string containsFixedValue("5 ");
EXPECT_TRUE(containsFixedPrecisionValue(containsFixedValue));
containsFixedValue = "23856.21865 kN*m/s^2 more text"; EXPECT_TRUE(containsFixedPrecisionValue(containsFixedValue));
containsFixedValue = ".1 J"; EXPECT_TRUE(containsFixedPrecisionValue(containsFixedValue));
containsFixedValue = "32 farkles"; EXPECT_TRUE(containsFixedPrecisionValue(containsFixedValue));
containsFixedValue = "text from an article. 532 elephants."; EXPECT_TRUE(containsFixedPrecisionValue(containsFixedValue));
containsFixedValue = "0"; EXPECT_TRUE(containsFixedPrecisionValue(containsFixedValue));
containsFixedValue = "-3200.1"; EXPECT_TRUE(containsFixedPrecisionValue(containsFixedValue));
containsFixedValue = "The number of elements is 532."; EXPECT_TRUE(containsFixedPrecisionValue(containsFixedValue));
containsFixedValue = "321.225;-32.2896"; EXPECT_TRUE(containsFixedPrecisionValue(containsFixedValue));
containsFixedValue = "Some text 321.25."; EXPECT_TRUE(containsFixedPrecisionValue(containsFixedValue));
// strings that should not contain FixedPrecisionValues
std::string doesNotContainFixedValue("5.0E32");
EXPECT_FALSE(containsFixedPrecisionValue(doesNotContainFixedValue));
doesNotContainFixedValue = "32kN"; EXPECT_FALSE(containsFixedPrecisionValue(doesNotContainFixedValue));
doesNotContainFixedValue = "1.0E2 Btu/h"; EXPECT_FALSE(containsFixedPrecisionValue(doesNotContainFixedValue));
doesNotContainFixedValue = "myFunction_32"; EXPECT_FALSE(containsFixedPrecisionValue(doesNotContainFixedValue));
doesNotContainFixedValue = "12.Text"; EXPECT_FALSE(containsFixedPrecisionValue(doesNotContainFixedValue));
// should be ScientificNotationValues
std::string scientificValue("1.0E0");
EXPECT_TRUE(isScientificNotationValue(scientificValue));
scientificValue = "1.0D+000"; EXPECT_TRUE(isScientificNotationValue(scientificValue));
scientificValue = "32E1"; EXPECT_TRUE(isScientificNotationValue(scientificValue));
scientificValue = ".3298D-3"; EXPECT_TRUE(isScientificNotationValue(scientificValue));
scientificValue = "3.2E13"; EXPECT_TRUE(isScientificNotationValue(scientificValue));
scientificValue = "0.111198766D+010"; EXPECT_TRUE(isScientificNotationValue(scientificValue));
scientificValue = "1867.201E-001"; EXPECT_TRUE(isScientificNotationValue(scientificValue));
scientificValue = "-3.2E-002"; EXPECT_TRUE(isScientificNotationValue(scientificValue));
scientificValue = "-.01E3"; EXPECT_TRUE(isScientificNotationValue(scientificValue));
scientificValue = "2.0e+002"; EXPECT_TRUE(isScientificNotationValue(scientificValue));
scientificValue = "-1.298619d-003"; EXPECT_TRUE(isScientificNotationValue(scientificValue));
// should not be ScientificNotationValues
std::string notSciValue("2.1");
EXPECT_FALSE(isScientificNotationValue(notSciValue));
notSciValue = "text"; EXPECT_FALSE(isScientificNotationValue(notSciValue));
notSciValue = "3.1E-1 "; EXPECT_FALSE(isScientificNotationValue(notSciValue));
notSciValue = "s3.2D+000"; EXPECT_FALSE(isScientificNotationValue(notSciValue));
notSciValue = ".1.E+01"; EXPECT_FALSE(isScientificNotationValue(notSciValue));
notSciValue = "hi 1.2D0"; EXPECT_FALSE(isScientificNotationValue(notSciValue));
notSciValue = ".E-1"; EXPECT_FALSE(isScientificNotationValue(notSciValue));
// should contain ScientificNotationValues
std::string containsSciValue("3.1E-1 ");
EXPECT_TRUE(containsScientificNotationValue(containsSciValue));
containsSciValue = "0E0 J"; EXPECT_TRUE(containsScientificNotationValue(containsSciValue));
containsSciValue = "500D-3 m^2/s"; EXPECT_TRUE(containsScientificNotationValue(containsSciValue));
containsSciValue = " 12657.0E+0001 kBtu/ft^2"; EXPECT_TRUE(containsScientificNotationValue(containsSciValue));
containsSciValue = ".1E-2 text"; EXPECT_TRUE(containsScientificNotationValue(containsSciValue));
containsSciValue = "1.0E-3; 2.1D+001"; EXPECT_TRUE(containsScientificNotationValue(containsSciValue));
// should not contain ScientificNotationValues
std::string doesNotContainSciValue("some text");
EXPECT_FALSE(containsScientificNotationValue(doesNotContainSciValue));
doesNotContainSciValue = "3 N"; EXPECT_FALSE(containsScientificNotationValue(doesNotContainSciValue));
doesNotContainSciValue = "3.0D01kN"; EXPECT_FALSE(containsScientificNotationValue(doesNotContainSciValue));
doesNotContainSciValue = "fruity5.0E-3"; EXPECT_FALSE(containsScientificNotationValue(doesNotContainSciValue));
doesNotContainSciValue = "186967.19867"; EXPECT_FALSE(containsScientificNotationValue(doesNotContainSciValue));
}