-
Notifications
You must be signed in to change notification settings - Fork 25
Support READ cards #30
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
base: main
Are you sure you want to change the base?
Conversation
_READ_RE = re.compile(r""" | ||
\s*read # Keyword | ||
\s.*?file # Everything up to filename | ||
\s*=\s* # = sign (required) with optional spaces | ||
(\S+) # The file name is anything without whitespace | ||
.* # Anything else until end-of-line | ||
""", re.IGNORECASE | re.VERBOSE | ||
) |
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.
Not going to be perfectly robust in that it may be overly generous with what counts as a read, but I think it's probably robust enough.
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.
@tjlaboss Thanks for this addition! I've started to add proper tests on this repo so it would be prudent to have a test for this as well. Can you put together a test?
@tjlaboss want any help with tests? |
Added tests. I included a new tests/inputs/ directory. It necessarily breaks from the convention of the other tests including the MCNP decks as strings because the target of |
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.
This looks good to me.
What's your patch coverage though?
@paulromano, are these tests acceptable? |
Closes #29
Where a
READ
card is found, recursively insert the contents of the targetFILE=...
. Other keywords (ECHO
,NOECHO
,ENCODE=...
, andDECODE=...
) are ignored.Example:
testRead.imcnp:
testReadTarget.imcnp:
testReadRecursive.imcnp:
This becomes:
And thereby: