Skip to content
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

Make the position specification in tests more compact #4559

Merged
merged 2 commits into from
Apr 26, 2023

Conversation

markdewing
Copy link
Contributor

Use a brace initializer to put 3 coordinates on one line. This makes the setup part of tests more compact.

The change was using a Comby script.

The change described in a file replaceR.toml:

[01-changeR]
match='''
:[[name]].R[:[idx]][0] = :[pos0];
:[[name]].R[:[idx]][1] = :[pos1];
:[[name]].R[:[idx]][2] = :[pos2];
'''
rewrite=" :[[name]].R[:[idx]] = {:[pos0], :[pos1], :[pos2]};\n"

Applied with: comby -config replaceR.toml -matcher .c -i -d /home/mdewing/nvme/physics/codes/qmcpack/tmp/qmcpack/src/QMCWaveFunctions/tests

Followed with clang-format to fix up the formatting.

This change only affects the QMCWaveFunctions tests, to keep the PR smaller. If this PR is okay, I can repeat it for other test directories.

What type(s) of changes does this code introduce?

Delete the items that do not apply

  • Code style update (formatting, renaming)

Does this introduce a breaking change?

  • No

What systems has this change been tested on?

desktop

Checklist

Update the following with a yes where the items apply. If you're unsure about any of them, don't hesitate to ask. This is
simply a reminder of what we are going to look for before merging your code.

  • Yes. This PR is up to date with current the current state of 'develop'
  • Yes. Code added or changed in the PR has been clang-formatted
  • No. This PR adds tests to cover any new code, or to catch a bug that is being fixed
  • No. Documentation has been added (if appropriate)

Use brace initializer to put 3 coordinates on one line.
Copy link
Contributor

@ye-luo ye-luo left a comment

Choose a reason for hiding this comment

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

Cool. I learned a new tool.

Copy link
Contributor

@prckent prckent left a comment

Choose a reason for hiding this comment

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

Cool.

Useful readability improvement in the reformatted code. Makes me wish clang-format did a better job with sets of numbers on multiple lines (e.g. matrices) and would align the entries by the decimal point.

Did not know about comby. Wish it knew about CMakeLists.txt for test value updates.

@markdewing
Copy link
Contributor Author

Test this please

@prckent prckent enabled auto-merge April 26, 2023 22:30
@prckent prckent merged commit 136b51f into QMCPACK:develop Apr 26, 2023
@markdewing markdewing deleted the compactR branch April 26, 2023 23:07
@prckent prckent mentioned this pull request Aug 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants