From ecb6c75cc8a82d8e5abbc09491eea5c29841c688 Mon Sep 17 00:00:00 2001 From: Ray Speth Date: Fri, 11 Jan 2013 22:55:56 +0000 Subject: [PATCH] [Test] Added outline for tests of ThermoPhase constructors --- test/data/LiFixed.xml | 49 +++++++++++++++++++++++++++++++ test/thermo/phaseConstructors.cpp | 31 +++++++++++++++++++ 2 files changed, 80 insertions(+) create mode 100644 test/data/LiFixed.xml create mode 100644 test/thermo/phaseConstructors.cpp diff --git a/test/data/LiFixed.xml b/test/data/LiFixed.xml new file mode 100644 index 000000000..d7dea7cfe --- /dev/null +++ b/test/data/LiFixed.xml @@ -0,0 +1,49 @@ + + + + + + + Li + + + LiFixed + + + -2.3E7 + + + + + + + + Li + + + LiFixed + + + -2.3E7 + + + + + + + + + + Li:1 + + + + 50.72389, 6.672267, -2.517167, + 10.15934, -0.200675, -427.2115, + 130.3973 + + + + + + diff --git a/test/thermo/phaseConstructors.cpp b/test/thermo/phaseConstructors.cpp new file mode 100644 index 000000000..f8dffc94b --- /dev/null +++ b/test/thermo/phaseConstructors.cpp @@ -0,0 +1,31 @@ +#include "gtest/gtest.h" +#include "cantera/thermo/FixedChemPotSSTP.h" +#include "cantera/thermo/ThermoFactory.h" + +namespace Cantera +{ + +class FixedChemPotSstpConstructorTest : public testing::Test +{ +}; + +TEST_F(FixedChemPotSstpConstructorTest, fromXML) +{ + ThermoPhase* p = newPhase("../data/LiFixed.xml", ""); + ASSERT_EQ((int) p->nSpecies(), 1); + double mu; + p->getChemPotentials(&mu); + ASSERT_FLOAT_EQ(-2.3e7, mu); + delete p; +} + +TEST_F(FixedChemPotSstpConstructorTest, SimpleConstructor) +{ + FixedChemPotSSTP p("Li", -2.3e7); + ASSERT_EQ((int) p.nSpecies(), 1); + double mu; + p.getChemPotentials(&mu); + ASSERT_FLOAT_EQ(-2.3e7, mu); +} + +} // namespace Cantera