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

CAST based MATLAB testing #583

Merged
merged 12 commits into from
Oct 20, 2023
Merged

CAST based MATLAB testing #583

merged 12 commits into from
Oct 20, 2023

Conversation

jastier
Copy link
Contributor

@jastier jastier commented Oct 17, 2023

Testing of MATLAB idioms using CAST structures

This PR is a refactor of the original test plan where MATLAB parser output was tested as a python dictionary. CAST testing uses fewer lines of code to achieve the same results and follows existing SKEMA test plans.

Relevant Features

  • CAST elements are used to test MATLAB idioms
  • Source code is now defined within each test file
  • The test file data directory is no longer needed and has been removed
  • The MATLAB parser now takes file or string source code input

Related Issues

@jastier jastier marked this pull request as draft October 17, 2023 11:08
@jastier jastier added the lang/MATLAB Used for work related to MATLAB frontend label Oct 17, 2023
@jastier jastier added this to the [DARPA] Milestone 10 milestone Oct 17, 2023
@jastier jastier linked an issue Oct 17, 2023 that may be closed by this pull request
@jastier jastier self-assigned this Oct 17, 2023
@jastier jastier mentioned this pull request Oct 17, 2023
@jastier jastier marked this pull request as ready for review October 17, 2023 13:32
jastier pushed a commit that referenced this pull request Oct 19, 2023
jastier pushed a commit that referenced this pull request Oct 19, 2023
Copy link
Contributor

@titomeister titomeister left a comment

Choose a reason for hiding this comment

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

Looks good to me!

cast = parser.out_cast
""" Tests parser assignment CAST """

source = 'x = 5;'
Copy link
Contributor

Choose a reason for hiding this comment

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

I think hardcoding the source like this is okay to do for the tests right now, I do effectively this in my test scripts, but I want to note that at some point we will be changing tests to access test files that are online on a google drive. I think we just haven't decided how to go about doing that yet.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, that's how I had been doing it. I can easily switch back if needed.

@jastier jastier merged commit 52de34d into main Oct 20, 2023
8 checks passed
@jastier jastier deleted the jastier/CAST_based_testing branch October 20, 2023 04:12
github-actions bot added a commit that referenced this pull request Oct 20, 2023
## Testing of MATLAB idioms using CAST structures
This PR is a refactor of the original test plan where MATLAB parser
output was tested as a python dictionary. CAST testing uses fewer lines
of code to achieve the same results and follows existing SKEMA test
plans.

## Relevant Features
- CAST elements are used to test MATLAB idioms
- Source code is now defined within each test file
- The test file data directory is no longer needed and has been removed
- The MATLAB parser now takes file or string source code input

## Related Issues
- Completes issue #570

---------

Co-authored-by: Joseph Astier <[email protected]> 52de34d
@jastier jastier mentioned this pull request Nov 1, 2023
jastier added a commit that referenced this pull request Nov 1, 2023
## CAST test upgrades
This PR includes some test utilities for use when testing CAST output,
so common tests such as an assignment or an expression can be done as
single function calls. Some debug scripts are now executables. Minor
edits and code cleanup

## What's New
- Added `skema/program_analysis/CAST/matlab/tests/utils.py` with
functions for common testing tasks
- Added 3 conditional logic tests:
          `if`
          `if else`
          `if elseif else`

## Relevant issues
Related to PR #613 and #583

---------

Co-authored-by: Joseph Astier <[email protected]>
github-actions bot added a commit that referenced this pull request Nov 1, 2023
## CAST test upgrades
This PR includes some test utilities for use when testing CAST output,
so common tests such as an assignment or an expression can be done as
single function calls. Some debug scripts are now executables. Minor
edits and code cleanup

## What's New
- Added `skema/program_analysis/CAST/matlab/tests/utils.py` with
functions for common testing tasks
- Added 3 conditional logic tests:
          `if`
          `if else`
          `if elseif else`

## Relevant issues
Related to PR #613 and #583

---------

Co-authored-by: Joseph Astier <[email protected]> 77c96cb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang/MATLAB Used for work related to MATLAB frontend
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CAST Node testing
2 participants