New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
HPWH Equipment Sequence Number Error to Warning #5124
Conversation
Okay, I know I'm asking something that is sacrilege around here, but can I not do a unit test for this? The only change was to alter the text of an error message so it is more clear and turn that error into a warning. I'm not sure adding a unit test adds value here. |
@Myoldmopar you never answered my question: Is this okay without a unit test? |
So....it is quite fair to say that if it is literally just a typo in a string or such that it does not need a unit test. Your change does slightly more than that though. You don't trip the ErrorsFound flag anymore, which does change the functionality of the program, not just the error message. So, in general, I would say that this does require a unit test to verify that. How about changing that function from a (hindsight) From a test-driven development perspective, it probably would have been wise to change the function to a bool return first, set up the unit test to call that function, and given the those inputs, the test would have failed with a |
@Myoldmopar Right, it is a little backwards for test driven development. Sorry. The problem is that if |
Inside
Inside your unit test:
Right? |
Because then you could also test expected failures in input processing just by providing the bad input idf snippet and using |
The problem is it does this several times in |
OK, fair. So we won't try to trap for the bad cases anytime soon. But you should be able to check for a successful run with the |
Okay. I'll take a crack at a unit test then. |
Thanks @nmerket. If it was literally just the string change, it would be easier to justify. But it shouldn't take long to set this unit test up. Just the idf snippet, process_idf, and expect_false. |
EXPECT_FALSE( WaterThermalTanks::GetWaterThermalTankInput() ); | ||
} | ||
|
||
TEST_F( HVACFixture, HPWHWrappedDummyNodeConfig ) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merging in this other unit test from develop caused me some problems. It's failing now because the state isn't being cleared for water heaters. @EnergyArchmage is there a implementation of clear_state
for WaterThermalTanks
in that branch you're maintaining? I would have looked myself, but @Myoldmopar didn't mention the branch name in the email so I thought it would be easier to just ask you.
@Myoldmopar @mbadams5 The unit test I wrote for this works, but it's not reading the error message to make sure it comes out right. I tried for a bit to create another test fixture that combined |
I think this is ready. It's been like whack-a-mole for something that should have been really simple. In my debug build in Xcode, |
Okay, I just re-ran cmake on my xcode build and it picked up that test. It's an array out of bounds assertion error. |
@nmerket Interesting. That test HVACFixture.VRFTest was passing over in #5135 |
There are still issues with clear_state in some modules. Working on it, but it's a snails pace. |
@mjwitte @rraustad Yeah, as you can see the CI machines don't seem to catch this, but when I run energyplus_tests on a clean build of develop I hit it.
|
@nmerket The CI machines run the tests individually that's why it's different. When you energyplus_tests is runs them serially, so that's why it can turn out differently. If you filter just that test it will probably run OK on your local machine. --gtest_filter=*VRFTest |
So, if that's the requirement--each test can be run individually, but not necessarily all together--then this is good to go pending a favorable CI result. |
…95_hpwh_equip_seq_num Conflicts: tst/EnergyPlus/unit/WaterThermalTanks.unit.cc
@nmerket I just updated this also with some more changes. As an aside, you can remove tests from the local testing using --gtest_filter
That will run all tests except ones that match |
@mbadams5 Thank you for figuring out the clear_state mess. I guess I did comment out that VRFTest, sorry. |
@nmerket The VRFTest still fails for me locally, but I don't think that is due to this branch. |
Just merged develop back into this branch and did some clean up. Unit tests are all working. Should be ready to merge. @Myoldmopar do I change the assignee to you? |
Feel free to; I'll take a look with the other bugs after the new features are wrapped up this week. |
…equip_seq_num Conflicts: tst/EnergyPlus/unit/Fixtures/EnergyPlusFixture.cc tst/EnergyPlus/unit/Fixtures/HVACFixture.hh
@nmerket I've merged in develop, resolved conflicts, then fixed a couple of things. Not sure if git got confused or I just didn't to the conflict resolution correctly. In any case, please review the diffs to be sure it looks correct. If CI comes back OK, then this can go in. |
@nmerket I already see some mistakes - will update one more time. |
@nmerket That's better. Now ready for your review. |
@mjwitte Looks good to me. Should I press the big, green button or should you? Or should @Myoldmopar? I never know the protocol. |
@nmerket I will. It's considered bad form to merge your own pull request. One rare occasions, maybe. |
HPWH Equipment Sequence Number Error to Warning
fixes #4695
Todo: