TEST_F(AnalysisFixture, NormalDistribution) { //Check default constructor NormalDistribution defaultDistribution; EXPECT_EQ(defaultDistribution.mean(),0.0); EXPECT_EQ(defaultDistribution.standardDeviation(),1.0); EXPECT_EQ(defaultDistribution.lowerBound(),boost::none); //Check normal constructor NormalDistribution distribution(2.0,3.0); distribution.setLowerBound(0.0); distribution.setUpperBound(4.0); EXPECT_EQ(distribution.mean(),2.0); EXPECT_EQ(distribution.standardDeviation(),3.0); EXPECT_EQ(distribution.lowerBound(),0.0); EXPECT_EQ(distribution.upperBound(),4.0); }
TEST_F(AnalysisFixture,UncertaintyDescription_ConstructionCopyingAndCasting) { NormalDistribution stdNormal; { UncertaintyDescription baseCopy = stdNormal; // copies impl } // calls destructor EXPECT_DOUBLE_EQ(0.0,stdNormal.mean()); EXPECT_DOUBLE_EQ(1.0,stdNormal.standardDeviation()); EXPECT_FALSE(stdNormal.lowerBound()); EXPECT_FALSE(stdNormal.upperBound()); { UncertaintyDescription baseCopy(stdNormal); NormalDistribution stdNormalCopy = baseCopy.cast<NormalDistribution>(); EXPECT_EQ(UncertaintyDescriptionType(UncertaintyDescriptionType::normal_uncertain),baseCopy.type()); } { GenericUncertaintyDescription genericCopy = stdNormal.cast<GenericUncertaintyDescription>(); EXPECT_EQ(2u,genericCopy.attributes().size()); } }