-
Notifications
You must be signed in to change notification settings - Fork 9
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
Event Handler Infrastructure #22
Conversation
change order of build and unit tests update names and error messages for clarity
|
||
eventType = getEventType(eventTypeStr); | ||
if (eventType == UNKNOWN_EVENT) { | ||
printf("Error: unknown event type %s\n", eventTypeStr); |
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.
I'm am generally unfamiliar with C but learning - is this line intended to be similar to the check on line 87?
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.
Yes, it is - and it's possibly redundant. Line 87 catches bad data in the file, and 135 here catches a bad return from getEventType
. I think right now there's no likely way to to get past the line 87 check and hit the 135 check, but that might not be true in the future.
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.
Thank you for this contribution, it is exciting to have the project under way. Although my experience with C is limited, this looks like a great start that provides a solid foundation. 🎉
Great work with the comprehensive testing - I did not previously appreciate the complexity of testing in C! Also with checks for a valid events file and helpful corrective guidance.
With respect to migrating compile time flags to a separate file - is this a relatively straightforward cut and paste? If not / if it would help, I can provide a list of flags that are higher priority since we will be changing from the defaults.
Sorry I made some minor changes (mostly to Makefile and ci.yml after mergeing #21 and then resolving merge conflicts); these can be seen here: 0d8d16c...93adfd1
Not urgent, but if you document how to add a test it could help to delegate some of the testing (I haven't taken the time to understand how this works, but it looks daunting).
Co-authored-by: David LeBauer <[email protected]>
I agree, we need some docs for adding tests. They are a bit daunting - some of that is due to this being C, but also needing to recompile to enable functionality really brings it up a notch. I hope I've hidden most of that, time will tell 🤞 |
This PR adds infrastructure to SIPNET to enable handling of agronomic events.
Structure
Design
sipnet.c
to fetch the appropriate events at a given location in the now-emptysetupEvents
functionTesting
/tests/sipnet
(or another sub of/tests/
, if we add specific testing for, say,estimate
)model_structures.h
file with the correct compile switches for the functionality to be tested/tests/Makefile.template
and add the test c-files to ittests/sipnet/test_events
for an exampleNotes
frontend.c
: it was tempting to simplify this code by removing the #if checks for EVENT_HANDLER, but that seemed out of character for SIPNET
sipnet.c
: I commented out some variable declarations to clean up compiler warnings