alpha-asp / Alpha

A lazy-grounding Answer-Set Programming system
BSD 2-Clause "Simplified" License
58 stars 10 forks source link

Refactor Unit Tests #335

Open madmike200590 opened 2 years ago

madmike200590 commented 2 years ago

(clone of PR #316, re-creating in order to fix git history that got messed up after squashing modularization commits during merge of #274)

This PR is a follow-up to PR #274. Following the changes to the overall code structure and API introduced through modularization, I took the opportunity to get started on some refactorings of Alphas unit tests. Specifically, this PR aims to

Reduce dependencies and narrow down tested code for unit tests

In order to make our unit tests more precise and avoid localized errors failing lots of tests, I removed unnecessary dependencies from most tests. Especially, we don't want to have tests of core components like gronder and solver depend on the complete program preprocessing workflow including parser and rewritings.

Move functional tests to alpha-solver module

Most tests that test rewriting and preprocessing features, as well as all tests that just pass programs into an Alpha instance and verify returned answer sets should be considered functional tests rather than unit tests since they test complete features through the complete workflow. These were moved into the alpha-solver module since the default implementation of Alpha resides there.

Mark functional and integration tests for further attention

In order to improve build performance and better distinguish between unit-, integration-, functional- and performance-tests, these should be separated into separate tasks in the build (of which some should probably only run in CI) process. This has not yet been realized yet, but tests that should probably be treated as integration tests or functional tests were marked with appropriate TODOs in preparation for that refactoring step. (Issue TBD)

codecov[bot] commented 2 years ago

Codecov Report

Base: 70.77% // Head: 71.66% // Increases project coverage by +0.88% :tada:

Coverage data is based on head (927dc22) compared to base (e0d4705). Patch coverage: 64.28% of modified lines in pull request are covered.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #335 +/- ## ============================================ + Coverage 70.77% 71.66% +0.88% - Complexity 2150 2194 +44 ============================================ Files 182 182 Lines 8025 8035 +10 Branches 1424 1425 +1 ============================================ + Hits 5680 5758 +78 + Misses 1970 1881 -89 - Partials 375 396 +21 ``` | [Impacted Files](https://codecov.io/gh/alpha-asp/Alpha/pull/335?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alpha-asp) | Coverage Δ | | |---|---|---| | [...kr/alpha/commons/externals/AspStandardLibrary.java](https://codecov.io/gh/alpha-asp/Alpha/pull/335/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alpha-asp#diff-YWxwaGEtY29tbW9ucy9zcmMvbWFpbi9qYXZhL2F0L2FjL3R1d2llbi9rci9hbHBoYS9jb21tb25zL2V4dGVybmFscy9Bc3BTdGFuZGFyZExpYnJhcnkuamF2YQ==) | `78.26% <ø> (ø)` | | | [...mmons/externals/BinaryPredicateInterpretation.java](https://codecov.io/gh/alpha-asp/Alpha/pull/335/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alpha-asp#diff-YWxwaGEtY29tbW9ucy9zcmMvbWFpbi9qYXZhL2F0L2FjL3R1d2llbi9rci9hbHBoYS9jb21tb25zL2V4dGVybmFscy9CaW5hcnlQcmVkaWNhdGVJbnRlcnByZXRhdGlvbi5qYXZh) | `0.00% <ø> (ø)` | | | [...xternals/BindingMethodPredicateInterpretation.java](https://codecov.io/gh/alpha-asp/Alpha/pull/335/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alpha-asp#diff-YWxwaGEtY29tbW9ucy9zcmMvbWFpbi9qYXZhL2F0L2FjL3R1d2llbi9rci9hbHBoYS9jb21tb25zL2V4dGVybmFscy9CaW5kaW5nTWV0aG9kUHJlZGljYXRlSW50ZXJwcmV0YXRpb24uamF2YQ==) | `11.11% <ø> (ø)` | | | [...c/tuwien/kr/alpha/commons/externals/Externals.java](https://codecov.io/gh/alpha-asp/Alpha/pull/335/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alpha-asp#diff-YWxwaGEtY29tbW9ucy9zcmMvbWFpbi9qYXZhL2F0L2FjL3R1d2llbi9rci9hbHBoYS9jb21tb25zL2V4dGVybmFscy9FeHRlcm5hbHMuamF2YQ==) | `8.57% <ø> (ø)` | | | [.../commons/externals/IntPredicateInterpretation.java](https://codecov.io/gh/alpha-asp/Alpha/pull/335/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alpha-asp#diff-YWxwaGEtY29tbW9ucy9zcmMvbWFpbi9qYXZhL2F0L2FjL3R1d2llbi9rci9hbHBoYS9jb21tb25zL2V4dGVybmFscy9JbnRQcmVkaWNhdGVJbnRlcnByZXRhdGlvbi5qYXZh) | `50.00% <ø> (ø)` | | | [...commons/externals/LongPredicateInterpretation.java](https://codecov.io/gh/alpha-asp/Alpha/pull/335/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alpha-asp#diff-YWxwaGEtY29tbW9ucy9zcmMvbWFpbi9qYXZhL2F0L2FjL3R1d2llbi9rci9hbHBoYS9jb21tb25zL2V4dGVybmFscy9Mb25nUHJlZGljYXRlSW50ZXJwcmV0YXRpb24uamF2YQ==) | `0.00% <ø> (ø)` | | | [...mmons/externals/MethodPredicateInterpretation.java](https://codecov.io/gh/alpha-asp/Alpha/pull/335/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alpha-asp#diff-YWxwaGEtY29tbW9ucy9zcmMvbWFpbi9qYXZhL2F0L2FjL3R1d2llbi9rci9hbHBoYS9jb21tb25zL2V4dGVybmFscy9NZXRob2RQcmVkaWNhdGVJbnRlcnByZXRhdGlvbi5qYXZh) | `15.78% <ø> (ø)` | | | [...s/externals/NonBindingPredicateInterpretation.java](https://codecov.io/gh/alpha-asp/Alpha/pull/335/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alpha-asp#diff-YWxwaGEtY29tbW9ucy9zcmMvbWFpbi9qYXZhL2F0L2FjL3R1d2llbi9rci9hbHBoYS9jb21tb25zL2V4dGVybmFscy9Ob25CaW5kaW5nUHJlZGljYXRlSW50ZXJwcmV0YXRpb24uamF2YQ==) | `33.33% <ø> (ø)` | | | [...ons/externals/SuppliedPredicateInterpretation.java](https://codecov.io/gh/alpha-asp/Alpha/pull/335/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alpha-asp#diff-YWxwaGEtY29tbW9ucy9zcmMvbWFpbi9qYXZhL2F0L2FjL3R1d2llbi9rci9hbHBoYS9jb21tb25zL2V4dGVybmFscy9TdXBwbGllZFByZWRpY2F0ZUludGVycHJldGF0aW9uLmphdmE=) | `0.00% <ø> (ø)` | | | [...ommons/externals/UnaryPredicateInterpretation.java](https://codecov.io/gh/alpha-asp/Alpha/pull/335/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alpha-asp#diff-YWxwaGEtY29tbW9ucy9zcmMvbWFpbi9qYXZhL2F0L2FjL3R1d2llbi9rci9hbHBoYS9jb21tb25zL2V4dGVybmFscy9VbmFyeVByZWRpY2F0ZUludGVycHJldGF0aW9uLmphdmE=) | `0.00% <ø> (ø)` | | | ... and [42 more](https://codecov.io/gh/alpha-asp/Alpha/pull/335/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alpha-asp) | | Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alpha-asp). Have a feature suggestion? [Share it here.](https://app.codecov.io/gh/feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=alpha-asp)

:umbrella: View full report at Codecov.
:loudspeaker: Do you have feedback about the report comment? Let us know in this issue.

madmike200590 commented 1 year ago

@AntoniusW This has been open for a long while, and I'd really like to get it merged. Could you please take a look?