本文整理汇总了C++中openstudio::isScientificNotationValue方法的典型用法代码示例。如果您正苦于以下问题:C++ openstudio::isScientificNotationValue方法的具体用法?C++ openstudio::isScientificNotationValue怎么用?C++ openstudio::isScientificNotationValue使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类openstudio
的用法示例。
在下文中一共展示了openstudio::isScientificNotationValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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));
}