-
Notifications
You must be signed in to change notification settings - Fork 10
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
Refactoring: Decouple API implementation from config structures #336
base: refactor-tests
Are you sure you want to change the base?
Conversation
assumeTrue(solver instanceof StatisticsReportingSolver); | ||
collectAnswerSetsAndCheckNoGoodCounterStatsByType(solver, 4, 0, 0, 0); | ||
} | ||
// TODO Why are these tests config-dependent if they use a grounder mock and seem rather like unit tests on solver statistics? |
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.
@AntoniusW see TODO
: I don't see a reason for these tests to be part of this class, i.e. I think these should be unit tests (and not parameterized with different configs). Let me know if you agree and I can move those to an appropriate class in the alpha-core
module.
AtomStore atomStore = new AtomStoreImpl(); | ||
assertEquals(GrounderMockWithBasicProgram.EXPECTED, buildSolverForRegressionTest(atomStore, new GrounderMockWithBasicProgram(atomStore), cfg).collectSet()); | ||
} | ||
// TODO @AntoniusW what are these? Can we get rid of them? If not, where do I move them? |
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.
@AntoniusW see TODO
: The commented-out test cases don't seem to be following the pattern of an end-to-end system test of all other tests in this class. Should we move these to some other location and remove the parameterization?
Codecov Report
@@ Coverage Diff @@
## refactor-tests #336 +/- ##
=====================================================
- Coverage 71.11% 38.35% -32.77%
+ Complexity 2167 1200 -967
=====================================================
Files 182 185 +3
Lines 8033 8073 +40
Branches 1424 1422 -2
=====================================================
- Hits 5713 3096 -2617
- Misses 1938 4639 +2701
+ Partials 382 338 -44
Continue to review full report at Codecov.
|
The aim of this PR is to get rid of all dependencies between
SystemConfig
and API implementations (likeAlphaImpl
,NaiveGrounder
,DefaultSolver
etc).The idea is that these objects should get their dependencies at the time of construction from an external source (
AlphaFactory
as it is implemented now) and not need to be aware of any configuration mechanisms or structures themselves.The same mechanism of obtaining
Alpha
instances (only throughAlphaFactory
) has been applied to all tests that test complete workflows (i.e. tests constituting end-to-end-tests in that they test the complete system rather than a single unit of code) as well. These tests (everything annotatedRegressionTest
orAggregateRegressionTest
) have been moved to thealpha-solver
module and adapted to be parameterized using aSystemConfig
which is used to obtain anAlpha
instance from the factory.Additional changes:
ASPCore2Program
toInputProgram
alpha-core/src/testFixtures
that can be shared between modulesStratifiedEvaluation
: Avoid generating duplicate facts by using aSet
rather thanList
as intermediate storage for newly derived rule heads