9 #define CATCH_CONFIG_RUNNER
11 TEST_CASE(
"Check reference state",
"[reference_state]" )
16 double h_EOS =
PropsSI(
"H",
"T",273.15,
"Q",0,
"Propane");
17 double s_EOS =
PropsSI(
"S",
"T",273.15,
"Q",0,
"Propane");
18 double h_target = 200000;
19 double s_target = 1000;
21 REQUIRE(abs(h_target-h_EOS) < 1e-6);
22 REQUIRE(abs(s_target-s_EOS) < 1e-6);
27 double h_EOS =
PropsSI(
"H",
"P",101325,
"Q",0,
"Propane");
28 double s_EOS =
PropsSI(
"S",
"P",101325,
"Q",0,
"Propane");
32 REQUIRE(abs(h_target-h_EOS) < 1e-6);
33 REQUIRE(abs(s_target-s_EOS) < 1e-6);
38 double h_EOS =
PropsSI(
"H",
"T",233.15,
"Q",0,
"Propane");
39 double s_EOS =
PropsSI(
"S",
"T",233.15,
"Q",0,
"Propane");
43 REQUIRE(abs(h_target-h_EOS) < 1e-6);
44 REQUIRE(abs(s_target-s_EOS) < 1e-6);
48 TEST_CASE(
"Check units of fluid constants",
"[fast]" )
56 double p_Props1SI =
Props1SI(
"R134a",
"pcrit");
57 double p_Props1 =
Props1(
"R134a",
"pcrit")*1000;
58 double p_Props =
Props(
"pcrit",
'T',300,
'Q',0,
"R134a")*1000;
59 double p_PropsSI =
PropsSI(
"pcrit",
"T",300,
"Q",0,
"R134a");
62 REQUIRE(fabs(p_Props1/p_Props-1) < 1e-6);
63 REQUIRE(fabs(p_PropsSI/p_Props-1) < 1e-6);
64 REQUIRE(fabs(p_PropsSI/p_Props1SI-1) < 1e-6);
65 REQUIRE(fabs(p_IProps/p_Props1SI-1) < 1e-6);
66 REQUIRE(fabs(p_IPropsSI/p_Props1SI-1) < 1e-6);
75 double p_Props1SI =
Props1(
"R134a",
"pcrit");
76 double p_Props1 =
Props1(
"R134a",
"pcrit");
77 double p_Props =
Props(
"pcrit",
'T',300,
'Q',0,
"R134a");
78 double p_PropsSI =
PropsSI(
"pcrit",
"T",300,
"Q",0,
"R134a");
81 REQUIRE(fabs(p_Props1/p_Props-1) < 1e-6);
82 REQUIRE(fabs(p_PropsSI/p_Props-1) < 1e-6);
83 REQUIRE(fabs(p_PropsSI/p_Props1SI-1) < 1e-6);
84 REQUIRE(fabs(p_IProps/p_Props1SI-1) < 1e-6);
85 REQUIRE(fabs(p_IProps/p_Props1SI-1) < 1e-6);
91 TEST_CASE(
"Normal boiling point of water",
"[fast]" )
99 double T_Props =
Props(
"T",
"P",101.325,
"Q",0,
"Water");
100 double T_PropsSI =
PropsSI(
"T",
"P",101325,
"Q",0,
"Water");
103 double T_nbp = 99.98+273.15;
104 REQUIRE(fabs(T_Props-T_nbp) < 0.01);
105 REQUIRE(fabs(T_PropsSI-T_Props) < 0.01);
106 REQUIRE(fabs(T_IProps-T_PropsSI) < 0.01);
107 REQUIRE(fabs(T_IPropsSI-T_IProps) < 0.01);
117 double T_Props =
Props(
"T",
"P",101325,
"Q",0,
"Water");
118 double T_PropsSI =
PropsSI(
"T",
"P",101325,
"Q",0,
"Water");
121 double T_nbp = 99.98+273.15;
122 REQUIRE(fabs(T_Props-T_nbp) < 0.01);
123 REQUIRE(fabs(T_PropsSI-T_Props) < 0.01);
124 REQUIRE(fabs(T_IProps-T_PropsSI) < 0.01);
125 REQUIRE(fabs(T_IPropsSI-T_IProps) < 0.01);
131 static Catch::Session session;
135 Catch::ConfigData &config = session.configData();
136 config.testsOrTags.clear();
137 config.testsOrTags.push_back(
"[fast]");
138 session.useConfigData(config);
139 return session.run();
144 Catch::ConfigData &config = session.configData();
145 config.testsOrTags.clear();
146 config.testsOrTags.push_back(
"~[slow]");
147 session.useConfigData(config);
153 printf(
"Elapsed time for not slow tests: %g s",(
double)(t2-t1)/CLOCKS_PER_SEC);
160 Catch::ConfigData &config = session.configData();
161 config.testsOrTags.clear();
162 for (
unsigned int i = 0; i < tests_or_tags.size(); i++)
164 config.testsOrTags.push_back(tests_or_tags[i]);
166 session.useConfigData(config);
172 printf(
"Elapsed time for user defined tests: %g s",(
double)(t2-t1)/CLOCKS_PER_SEC);
179 Catch::ConfigData &config = session.configData();
180 config.testsOrTags.clear();
181 session.useConfigData(config);
EXPORT_CODE double CONVENTION IProps(long iOutput, long iName1, double Prop1, long iName2, double Prop2, long iFluid)
long get_Fluid_index(std::string FluidName)
EXPORT_CODE void CONVENTION set_standard_unit_system(int val)
double Props(std::string Output, std::string Name1, double Prop1, std::string Name2, double Prop2, std::string Ref)
double Props1(std::string FluidName, std::string Output)
EXPORT_CODE int CONVENTION get_standard_unit_system(void)
double PropsSI(std::string Output, std::string Name1, double Prop1, std::string Name2, double Prop2, std::string Ref)
REQUIRE(fabs(CPWater.p()-RPWater.p())< 1e-4)
TEST_CASE("Check reference state","[reference_state]")
#define SECTION(name, description)
int set_reference_stateS(std::string Ref, std::string reference_state)
int run_user_defined_tests(const std::vector< std::string > &tests_or_tags)
EXPORT_CODE double CONVENTION IPropsSI(long iOutput, long iName1, double Prop1, long iName2, double Prop2, long iFluid)
double Props1SI(std::string FluidName, std::string Output)