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
Updating IDD and error handling for GHX:Vertical #5208
Conversation
So, @mmAtTs. Unit test. I can imagine this wouldn't be too hard if you use the EnergyPlusFixture. You could, at a minimum, put invalid idf snippet that has the bad inputs we were encountering, and expect a failed process_idf or whatever the function is called. |
@Myoldmopar yeah, that should be easy enough. I will try to push something up tonight. |
I reviewed these changes, all seems good to go to me. |
@mmAtTs Could you pull develop back into this branch one more time? |
@Myoldmopar I just pushed it up here. I'm not sure why it is not showing up in this PR though. I got hung up on the unit tests, but once that is resolved this should be ready. |
OK, so it looks like the unit test works. I think you might want to say EXPECT_TRUE though since you are checking an erroneous condition. |
@mbadams5 A couple of unit testing questions for you: For these unit tests I am passing bad idf objects in here and here and trying to test the error handling here. I keep getting stuck because the out of range idd error handling here is stopping it. I just pulled develop in and have tried all combinations of ASSERT/EXPECT TRUE/FALSE. Do you have any suggestions on what I should be using around the process_idf so I can continue on to test that block? Also, I did not see any examples in unit tests of where were are checking for a fatal error. Is it possible to "EXPECT_DEATH" for something like that, or do I need to work around it some other way? |
@mmAtTs I added new functionality to suppress the assertions within process_idf() for this use case. Normally these assertions shouldn't be suppressed but in this case you know the IDF is bad. So pass |
@mbadams5 thanks, that works. As far as expecting a fatal error, is there a way to do that? If not, I will probably need to do a little code work to make the |
@mmAtTs What do you mean "expecting a fatal error"? Like the function you are calling will call ShowFatalError or whatever it is called? Basically, if the function throws a Fatal Error then you need to wrap it in EXPECT_DEATH test because it will kill the whole unit test framework otherwise. Just be aware that you can only test that a function exits, aborts, or throws an exception when you use EXPECT_DEATH, nothing else. If you are talking about something else then I need some more information. |
@Myoldmopar ready for review. |
@mmAtTs Also you can still wrap the |
@mbadams5 thanks for the information. I added EXPECT_TRUE around process_idf. |
Updating IDD and error handling for GHX:Vertical
Addresses #5203.
Now catches wrong wrong values in the Num G-Func field and catches wrong number of inputs.