def test600_080ShouldCalculateLowNHighT2EdgeCase(self): myT = T.TCurve(3) self.assertAlmostEquals(myT.p(5.8409, 2), .99, 3)
def test600_100ShouldCalculateHighHighT2TailEdgeCase(self): myT = T.TCurve(20) self.assertAlmostEquals(myT.p(2.8453, 2), .99, 3)
def test100_010_ShouldConstruct(self): self.assertIsInstance(T.TCurve(self.nominalN), T.TCurve) # additional tests are for boundary value coverage self.assertIsInstance(T.TCurve(2), T.TCurve) self.assertIsInstance(T.TCurve(29), T.TCurve)
def test500_001TDD(self): myT = T.TCurve(self.nominalN) t = 1.0 n = 1234 #n doesnt matter yet integratedVal = 0.85555275 self.assertAlmostEquals(myT.integrate(t, n, myT.f), integratedVal, 3)
def test200_030_ShouldWorkOnHalfX(self): myT = T.TCurve(self.nominalN) self.assertAlmostEquals(myT.gamma(5.0 / 2.0), 1.329, 3)
def test400_010_ShouldCalculateFStarterCase(self): myT = T.TCurve(self.nominalN) self.assertAlmostEquals(myT.f(0, 5), 1, 4)
def test500_030_shouldCalculateIntegrateWhenF3(self): myT = T.TCurve(self.nominalN) self.assertAlmostEquals(myT.integrate(1.0, 5, myT.f3), 0.142857,4)
def test200_020_ShouldReturnLowerTerminationCondition(self): myT = T.TCurve(self.nominalN) self.assertEquals(myT.gamma(1.0 / 2.0), math.sqrt(math.pi))
def test500_010_shouldCalculateIntegrateWhenF1(self): myT = T.TCurve(self.nominalN) self.assertEquals(myT.integrate(1.0, 5, myT.f1), 0.5)
def test500_020_shouldCalculateIntegrateWhenF2(self): myT = T.TCurve(self.nominalN) self.assertAlmostEquals(myT.integrate(1.0, 5, myT.f2), 0.333333,4)
def test600_102ShouldCalculatePTestcase2Tail(self): myT = T.TCurve(9) self.assertAlmostEquals(myT.p(1.8331, 2), .9, 3)
def test600_101ShouldCalculatePTestcase1Tail(self): myT = T.TCurve(5) self.assertAlmostEquals(myT.p(1.1558, 1), .85, 3)
def test500_101IntegrationOnF(self): myT = T.TCurve(self.nominalN) t = 1.8946 n = 7 integratedVal = 1.1694779 self.assertAlmostEquals(myT.integrate(t, n, myT.f), integratedVal, 3)
def test600_930ShouldRaiseExceptionInvalidTails(self): myT = T.TCurve(self.nominalN) with self.assertRaises(ValueError) as context: myT.p(t=self.nominalT, tails=0)
def test500_040_shouldCalculateIntegrateWhenF4(self): myT = T.TCurve(self.nominalN) self.assertAlmostEquals(myT.integrate(1.0, 5, myT.f4), 0.009901,4)
def test200_010_ShouldReturnUpperTerminationCondition(self): myT = T.TCurve(self.nominalN) self.assertEquals(myT.gamma(1), 1)
def test600_930ShouldRaiseExceptionOnNonNumericT(self): expectedString = "TCurve.p:" myT = T.TCurve(self.nominalN) with self.assertRaises(ValueError) as context: myT.p(t= "abc", tails=1) self.assertEquals(expectedString, context.exception.args[0][0:len(expectedString)])
def test200_030_ShouldWorkOnIntegerX(self): myT = T.TCurve(self.nominalN) self.assertEquals(myT.gamma(5), 24)
def test600_020ShouldCalculateNominalCase2Tail(self): myT = T.TCurve(7) self.assertAlmostEquals(myT.p(1.8946, 2), .90, 3)
def test300_010_ShouldCalculateLHP(self): myT = T.TCurve(self.nominalN) self.assertAlmostEquals(myT.calculateConstant(5), 0.37960669, 4)
def test600_040ShouldCalculateLowNLowT2TailEdgeCase(self): myT = T.TCurve(3) self.assertAlmostEquals(myT.p(0.2767, 2), 0.2, 3)
def test400_020_ShouldCalculateF(self): myT = T.TCurve(self.nominalN) self.assertAlmostEquals(myT.f(1, 5), 0.578703704)
def test600_060ShouldCalculateHighNLowT2TailEdgeCase(self): myT = T.TCurve(20) self.assertAlmostEquals(myT.p(0.2567, 2), 0.2, 3)
def test100_940_ShouldRaiseExceptionOnMissingN(self): expectedString = "TCurve.__init__:" with self.assertRaises(ValueError) as context: T.TCurve() self.assertEquals(expectedString, context.exception.args[0][0:len(expectedString)])
def test501_003IntegrationOnF2(self): myT = T.TCurve(self.nominalN) t = 16.0 n = 1234 #n doesnt matter for f2 integratedVal = 1365.3333333 self.assertAlmostEquals(myT.integrate(t, n, myT.f2), integratedVal, 3)