Skip to content

Commit

Permalink
running clang-format
Browse files Browse the repository at this point in the history
  • Loading branch information
nmerket committed Feb 14, 2022
1 parent 4361ae4 commit 07a4f38
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 31 deletions.
8 changes: 4 additions & 4 deletions src/EnergyPlus/ScheduleManager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1651,9 +1651,9 @@ namespace ScheduleManager {

if (lAlphaBlanks(6)) Alphas(6) = "NO";
if ((Alphas(6)) == "YES") {
state.dataScheduleMgr->Schedule(SchNum).UseDaylightSaving = true;
} else if ((Alphas(6)) == "NO") {
state.dataScheduleMgr->Schedule(SchNum).UseDaylightSaving = false;
state.dataScheduleMgr->Schedule(SchNum).UseDaylightSaving = true;
} else if ((Alphas(6)) == "NO") {
state.dataScheduleMgr->Schedule(SchNum).UseDaylightSaving = false;
}

// is it a sub-hourly schedule or not?
Expand Down Expand Up @@ -2789,7 +2789,7 @@ namespace ScheduleManager {
} else {
thisHour = ThisHour;
}

int thisDayOfYear = state.dataEnvrn->DayOfYear_Schedule;
int thisDayOfWeek = state.dataEnvrn->DayOfWeek;
int thisHolidayIndex = state.dataEnvrn->HolidayIndex;
Expand Down
47 changes: 20 additions & 27 deletions tst/EnergyPlus/unit/ScheduleManager.unit.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1338,7 +1338,7 @@ TEST_F(EnergyPlusFixture, ScheduleFileDSTtoggleOptionTest)
// scheduleFile object of class "path" created here in the next line is basically a long string that provides the full path to the file
fs::path scheduleFile = configured_source_directory() / "tst/EnergyPlus/unit/Resources/schedule_file1.csv";

// Adding Schedule:File blocks that test other possibilities to make sure they work right, such as:
// Adding Schedule:File blocks that test other possibilities to make sure they work right, such as:
// 1.) Setting to "Yes"
// 2.) Setting to "No"
// 3.) Leaving empty (should default to "No")
Expand All @@ -1354,7 +1354,7 @@ TEST_F(EnergyPlusFixture, ScheduleFileDSTtoggleOptionTest)
" 2, !- Column Number",
" 1, !- Rows to Skip at Top",
" 8760, !- Number of Hours of Data",
" Comma, !- Column Separator",
" Comma, !- Column Separator",
" No, !- Interpolate to Timestep",
" 60, !- Minutes per item",
" Yes; !- Adjust Schedule for Daylight Savings",
Expand Down Expand Up @@ -1396,48 +1396,42 @@ TEST_F(EnergyPlusFixture, ScheduleFileDSTtoggleOptionTest)
" ",
});

ASSERT_TRUE(process_idf(idf_objects)); // This will process the provided idf chunk within the test fixture (must pass this step in order to proceed)
ASSERT_TRUE(
process_idf(idf_objects)); // This will process the provided idf chunk within the test fixture (must pass this step in order to proceed)

// Test that each option sets UseDaylightSaving correctly on the each schedule:

// Test 1 condition
const int sch1idx = GetScheduleIndex(*state, "TEST1"); // Index of the IDF schedule object identified and stored into schdl1idx variable
ScheduleManager::ScheduleData &sch1 = state->dataScheduleMgr->Schedule(sch1idx); // sch1 reference initialized that points to the specific schedule of interest
ASSERT_TRUE(sch1.UseDaylightSaving); // Checks that the member variable got set correctly.
const int sch1idx = GetScheduleIndex(*state, "TEST1"); // Index of the IDF schedule object identified and stored into schdl1idx variable
ScheduleManager::ScheduleData &sch1 =
state->dataScheduleMgr->Schedule(sch1idx); // sch1 reference initialized that points to the specific schedule of interest
ASSERT_TRUE(sch1.UseDaylightSaving); // Checks that the member variable got set correctly.

state->dataEnvrn->DSTIndicator = 1; // Tells the simulation that we're in daylight savings

//state->dataGlobal->TimeStep = 1; // Checking to see if omitting this is OK here
// state->dataGlobal->TimeStep = 1; // Checking to see if omitting this is OK here

state->dataGlobal->HourOfDay = 24;

//ScheduleManager::LookUpScheduleValue(*state, sch1idx, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep);
// ScheduleManager::LookUpScheduleValue(*state, sch1idx, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep);


EXPECT_EQ(
ScheduleManager::LookUpScheduleValue(*state, sch1idx, state->dataGlobal->HourOfDay,state->dataGlobal->TimeStep),
1
);
EXPECT_EQ(ScheduleManager::LookUpScheduleValue(*state, sch1idx, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep), 1);

// Test 2 condition
const int sch2idx = GetScheduleIndex(*state, "TEST2");
ScheduleManager::ScheduleData &sch2 = state->dataScheduleMgr->Schedule(sch2idx);
ASSERT_FALSE(sch2.UseDaylightSaving);

// Test 2 condition
const int sch2idx = GetScheduleIndex(*state, "TEST2");
ScheduleManager::ScheduleData &sch2 = state->dataScheduleMgr->Schedule(sch2idx);
ASSERT_FALSE(sch2.UseDaylightSaving);

state->dataEnvrn->DSTIndicator = 0; // Tells the simulation that we're not including daylight savings

EXPECT_EQ(
ScheduleManager::LookUpScheduleValue(*state, sch2idx, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep),
0
);
EXPECT_EQ(ScheduleManager::LookUpScheduleValue(*state, sch2idx, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep), 0);

// Test 3 condition
const int sch3idx = GetScheduleIndex(*state, "TEST3");
ScheduleManager::ScheduleData &sch3 = state->dataScheduleMgr->Schedule(sch3idx);
ASSERT_FALSE(sch3.UseDaylightSaving);
const int sch3idx = GetScheduleIndex(*state, "TEST3");
ScheduleManager::ScheduleData &sch3 = state->dataScheduleMgr->Schedule(sch3idx);
ASSERT_FALSE(sch3.UseDaylightSaving);

state->dataEnvrn->DSTIndicator = 0;
state->dataEnvrn->DSTIndicator = 0;

EXPECT_EQ(ScheduleManager::LookUpScheduleValue(*state, sch3idx, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep), 0);

Expand All @@ -1449,5 +1443,4 @@ TEST_F(EnergyPlusFixture, ScheduleFileDSTtoggleOptionTest)
state->dataEnvrn->DSTIndicator = 0; // Tells the simulation that we're not including daylight savings

EXPECT_EQ(ScheduleManager::LookUpScheduleValue(*state, sch4idx, state->dataGlobal->HourOfDay, state->dataGlobal->TimeStep), 0);

}

4 comments on commit 07a4f38

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ScheduleFile_DaylightSavingsToggle (nmerket) - x86_64-Linux-Ubuntu-18.04-gcc-7.5: OK (3235 of 3240 tests passed, 0 test warnings)

Messages:\n

  • 1 test had: Table big diffs.

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1219
  • SEGFAULT: 1

integration Test Summary

  • Passed: 739
  • Failed: 3

regression Test Summary

  • Passed: 756
  • Failed: 1

Build Badge Test Badge

@nrel-bot-3
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ScheduleFile_DaylightSavingsToggle (nmerket) - x86_64-MacOS-10.15-clang-11.0.0: OK (3193 of 3199 tests passed, 0 test warnings)

Messages:\n

  • 1 test had: Table big diffs.

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1218
  • Failed: 1
  • SEGFAULT: 1

integration Test Summary

  • Passed: 736
  • Failed: 3

regression Test Summary

  • Passed: 736
  • Failed: 1

Build Badge Test Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ScheduleFile_DaylightSavingsToggle (nmerket) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-UnitTestsCoverage-Debug: OK (1723 of 1724 tests passed, 0 test warnings)

Failures:\n

EnergyPlusFixture Test Summary

  • Passed: 1219
  • Subprocess aborted: 1

Build Badge Test Badge Coverage Badge

@nrel-bot-2b
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ScheduleFile_DaylightSavingsToggle (nmerket) - x86_64-Linux-Ubuntu-18.04-gcc-7.5-IntegrationCoverage-Debug: OK (738 of 741 tests passed, 0 test warnings)

Failures:\n

integration Test Summary

  • Passed: 738
  • Failed: 3

Build Badge Test Badge Coverage Badge

Please sign in to comment.