def test_FahToKelTemp(self): self.assertAlmostEqual(Temperature.FahrenheitToKelvin(0), (5 / 9) * (-32) + 273.15) self.assertAlmostEqual(Temperature.FahrenheitToKelvin(2.5), (5 / 9) * (2.5 - 32) + 273.15) self.assertAlmostEqual(Temperature.FahrenheitToKelvin(-200), (5 / 9) * (-200 - 32) + 273.15)
def test_FahToCelTemp(self): self.assertAlmostEqual(Temperature.FahrenheitToCelsius(0), (5 / 9) * -32) self.assertAlmostEqual(Temperature.FahrenheitToCelsius(2.5), (5 / 9) * (2.5 - 32)) self.assertAlmostEqual(Temperature.FahrenheitToCelsius(-200), (5 / 9) * (-200 - 32))
def test_KelToFahTemp(self): self.assertAlmostEqual(Temperature.KelvinToFahrenheit(0), (9 / 5) * (-273.15) + 32) self.assertAlmostEqual(Temperature.KelvinToFahrenheit(2.5), (9 / 5) * (2.5 - 273.15) + 32) self.assertAlmostEqual(Temperature.KelvinToFahrenheit(-200), (9 / 5) * (-200 - 273.15) + 32)
def test_CelToFahTemp(self): self.assertAlmostEqual(Temperature.CelsiusToFahrenheit(0), 32) self.assertAlmostEqual(Temperature.CelsiusToFahrenheit(1), 32 + (9 / 5)) self.assertAlmostEqual(Temperature.CelsiusToFahrenheit(2.5), (9 / 5) * 2.5 + 32) self.assertAlmostEqual(Temperature.CelsiusToFahrenheit(-200), (9 / 5) * -200 + 32)
def test_Gas(self): self.assertAlmostEqual(Temperature.Gas(0, 1, 1, 1), 0) self.assertAlmostEqual(Temperature.Gas(-200, 2, 2, 2), (-200 * 2) / (2 * 2)) self.assertAlmostEqual(Temperature.Gas(200, 2, 2, 2), (200 * 2) / (2 * 2))
def test_KelToCelTemp(self): self.assertAlmostEqual(Temperature.KelvinToCelsius(0), -273.15) self.assertAlmostEqual(Temperature.KelvinToCelsius(2.5), 2.5 - 273.15) self.assertAlmostEqual(Temperature.KelvinToCelsius(-200), -200 - 273.15)
def test_CelToKelTemp(self): self.assertAlmostEqual(Temperature.CelsiusToKelvin(0), 273.15) self.assertAlmostEqual(Temperature.CelsiusToKelvin(2.5), 2.5 + 273.15) self.assertAlmostEqual(Temperature.CelsiusToKelvin(-200), -200 + 273.15)