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

Refactoring and tests for other utilities #73

Merged
merged 15 commits into from
Feb 5, 2024

Conversation

DurieuxPol
Copy link
Collaborator

Refactored MTMutantOperatorAnalysis and MTMissingMutantOperatorAnalaysis (renamed as MTNonMutatedMethodsAnalysis) to support better APIs.
Also added tests for them.

@coveralls
Copy link

coveralls commented Jan 26, 2024

Pull Request Test Coverage Report for Build 7782239506

Warning: This coverage report may be inaccurate.

We've detected an issue with your CI configuration that might affect the accuracy of this pull request's coverage report.
To ensure accuracy in future PRs, please see these guidelines.
A quick fix for this PR: rebase it; your next report should be accurate.

  • -57 of 186 (69.35%) changed or added relevant lines in 8 files are covered.
  • 55 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.8%) to 60.638%

Changes Missing Coverage Covered Lines Changed/Added Lines %
src/MuTalk-Utilities-Tests/MTAuxiliarClassForMutantOperatorAnalysis.class.st 0 10 0.0%
src/MuTalk-Utilities/MTUtilityAnalysis.class.st 8 23 34.78%
src/MuTalk-Utilities/MTMatrix.class.st 9 41 21.95%
Files with Coverage Reduction New Missed Lines %
src/MuTalk-Utilities/MTMatrix.class.st 2 67.2%
src/MuTalk-Model/MTGeneralResult.class.st 6 80.65%
src/MuTalk-Model/MTAnalysis.class.st 47 34.74%
Totals Coverage Status
Change from base Build 7653796460: 0.8%
Covered Lines: 4600
Relevant Lines: 7586

💛 - Coveralls

Copy link
Contributor

@guillep guillep left a comment

Choose a reason for hiding this comment

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

Thanks @DurieuxPol!!
I like the changes.

I propose some renames and little API changes, what do you think about them?

MTMutantOperatorAnalysisTest >> testGetAllOperators [

| actual expected |
actual := (operatorAnalysis operatorsProducingOverXMutants: 0) keys
Copy link
Contributor

Choose a reason for hiding this comment

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

the name of this method is strange :)

operatorsProducingOverXMutants:

Does it mean they produce more than 0 mutants?
Alsy, why is it answering a dictionary? I see all your tests do keys asSet, keys asSet, keys asSet. This means that probably we want a method returning the set of keys directly and hide the fact that internally it's a dictionary right? :D

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually, Over 0 means > 0 or >= 0? Maybe a little rename could clarify "At least" vs "More than"

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I think it can be useful to return a dictionary, to actually see how many mutants are produced by each operator.
But yes I think I could add a bit more methods, like the whole dictionary, the set of mutants producing at least a certain number of mutants, the 10 most producing operators, things like that.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Actually there is already a method returning the whole dictionary, forgot about it ahah


| actual expected |
actual := (operatorAnalysis operatorsProducingUnderXMutants: 2) keys
asSet.
Copy link
Contributor

Choose a reason for hiding this comment

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

Here it's the same but the other way around.

  • the keys asSet looks like the same smell (but duplicated code?)
  • under is < x or <= x ? :D

^ self
forPackages: aCollectionOfPackages
andTestPackages:
(aCollectionOfPackages collect: [ :package | package , '-Tests' ])
Copy link
Contributor

Choose a reason for hiding this comment

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

I like this. This forces a convention!!!


| analysis dic classesToMutate |
classesToMutate := aName asPackage definedClasses.
MTMutantOperatorAnalysis >> getMutantOperatorsDictionary [
Copy link
Contributor

Choose a reason for hiding this comment

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

remember that in Pharo code we don't use the get/set prefixes in methods as a convention.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Indeed, I will change that.

@@ -76,23 +68,19 @@ MTMutantOperatorAnalysis >> getMutantOperatorsDictionaryFor: aName [
]

{ #category : 'computing' }
MTMutantOperatorAnalysis >> operatorsProducingOver: aNumber mutantsFor: aCollectionOfPackages [
MTMutantOperatorAnalysis >> operatorsProducingOverXMutants: aNumber [
Copy link
Contributor

Choose a reason for hiding this comment

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

Removing this extra parameter all over the code is indeed an improvement :)

Copy link
Contributor

@guillep guillep left a comment

Choose a reason for hiding this comment

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

Thanks Pol!

@guillep guillep merged commit 3236a60 into pharo-contributions:master Feb 5, 2024
4 checks passed
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