Skip to content

Commit

Permalink
Try cleaning up the tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
joseph-robertson committed Jun 5, 2024
1 parent 5739c51 commit 8497139
Showing 1 changed file with 36 additions and 44 deletions.
80 changes: 36 additions & 44 deletions src/utilities/filetypes/test/EpwFile_GTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -524,58 +524,50 @@ TEST(Filetypes, EpwFile_LeapTimeSeries) {
}
}

TEST(Filetypes, EpwFile_LeapTimeSeries_LeapDays) {
TEST(Filetypes, EpwFile_LeapTimeSeries_AMYNoLeapDay) {
// Tests for #5214

{
try {
path p = resourcesPath() / toPath("utilities/Filetypes/AMY2012-noleapday.epw");
EpwFile epwFile(p);
boost::optional<TimeSeries> _t;
ASSERT_NO_THROW(_t = epwFile.getTimeSeries("Dry Bulb Temperature"));
ASSERT_TRUE(_t);
// isActual is true, so it should be a timeSeries with the actual year
boost::optional<int> _timeSeriesBaseYear = _t->firstReportDateTime().date().baseYear();
ASSERT_TRUE(_timeSeriesBaseYear);
EXPECT_EQ(2012, _timeSeriesBaseYear.get());
} catch (...) {
EXPECT_TRUE(false);
}
try {
path p = resourcesPath() / toPath("utilities/Filetypes/AMY2012-noleapday.epw");
EpwFile epwFile(p);
boost::optional<TimeSeries> _t;
ASSERT_NO_THROW(_t = epwFile.getTimeSeries("Dry Bulb Temperature"));
ASSERT_TRUE(_t);
// isActual is true, so it should be a timeSeries with the actual year
boost::optional<int> _timeSeriesBaseYear = _t->firstReportDateTime().date().baseYear();
ASSERT_TRUE(_timeSeriesBaseYear);
EXPECT_EQ(2012, _timeSeriesBaseYear.get());
} catch (...) {
ASSERT_TRUE(false);
}
}

{
try {
path p = resourcesPath() / toPath("utilities/Filetypes/USA_CO_Golden-NREL.724666_TMY3-leapday.epw");
EpwFile epwFile(p);
boost::optional<TimeSeries> _t;
ASSERT_NO_THROW(_t = epwFile.getTimeSeries("Dry Bulb Temperature"));
ASSERT_TRUE(_t);
// isActual is true, so it should be a timeSeries with the actual year
boost::optional<int> _timeSeriesBaseYear = _t->firstReportDateTime().date().baseYear();
ASSERT_TRUE(_timeSeriesBaseYear);
EXPECT_EQ(2012, _timeSeriesBaseYear.get());
} catch (...) {
EXPECT_TRUE(false);
}
}
TEST(Filetypes, EpwFile_LeapTimeSeries_TMYLeapFebNoLeapDay) {
// Tests for #5214

{
try {
path p = resourcesPath() / toPath("utilities/Filetypes/USA_CO_Golden-NREL.724666_TMY3-noleapday.epw");
EpwFile epwFile(p);
boost::optional<TimeSeries> _t;
ASSERT_NO_THROW(_t = epwFile.getTimeSeries("Dry Bulb Temperature"));
ASSERT_TRUE(_t);
// isActual is true, so it should be a timeSeries with the actual year
boost::optional<int> _timeSeriesBaseYear = _t->firstReportDateTime().date().baseYear();
ASSERT_TRUE(_timeSeriesBaseYear);
EXPECT_EQ(2012, _timeSeriesBaseYear.get());
} catch (...) {
EXPECT_TRUE(false);
}
try {
path p = resourcesPath() / toPath("utilities/Filetypes/USA_CO_Golden-NREL.724666_TMY3-noleapday.epw");
EpwFile epwFile(p);
boost::optional<TimeSeries> _t;
ASSERT_NO_THROW(_t = epwFile.getTimeSeries("Dry Bulb Temperature"));
ASSERT_TRUE(_t);
boost::optional<int> _timeSeriesBaseYear = _t->firstReportDateTime().date().baseYear();
EXPECT_FALSE(_timeSeriesBaseYear);
} catch (...) {
ASSERT_TRUE(false);
}
}

TEST(Filetypes, EpwFile_LeapTimeSeries_TMYLeapFebLeapDay) {
// Tests for #5214

try {
path p = resourcesPath() / toPath("utilities/Filetypes/USA_CO_Golden-NREL.724666_TMY3-leapday.epw");
EpwFile epwFile(p);
} catch (...) {
ASSERT_TRUE(true);
}

TEST(Filetypes, EpwFile_NonActualTimeSeries) {
try {
path p = resourcesPath() / toPath("utilities/Filetypes/USA_CO_Golden-NREL.724666_TMY3.epw");
Expand Down

0 comments on commit 8497139

Please sign in to comment.