Refactoring: Decouple API implementation from config structures#336
Refactoring: Decouple API implementation from config structures#336madmike200590 wants to merge 2 commits intorefactor-testsfrom
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.
@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.
@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
SystemConfigand API implementations (likeAlphaImpl,NaiveGrounder,DefaultSolveretc).The idea is that these objects should get their dependencies at the time of construction from an external source (
AlphaFactoryas it is implemented now) and not need to be aware of any configuration mechanisms or structures themselves.The same mechanism of obtaining
Alphainstances (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 annotatedRegressionTestorAggregateRegressionTest) have been moved to thealpha-solvermodule and adapted to be parameterized using aSystemConfigwhich is used to obtain anAlphainstance from the factory.Additional changes:
ASPCore2ProgramtoInputProgramalpha-core/src/testFixturesthat can be shared between modulesStratifiedEvaluation: Avoid generating duplicate facts by using aSetrather thanListas intermediate storage for newly derived rule heads