Closed devarops closed 4 years ago
Merging #14 into master will decrease coverage by
0.12%
. The diff coverage is0.00%
.
@@ Coverage Diff @@
## master #14 +/- ##
==========================================
- Coverage 16.15% 16.03% -0.13%
==========================================
Files 12 12
Lines 130 131 +1
==========================================
Hits 21 21
- Misses 109 110 +1
Impacted Files | Coverage Δ | |
---|---|---|
R/mutate.R | 0.00% <0.00%> (ø) |
Continue to review full report at Codecov.
Legend - Click here to learn more
Δ = absolute <relative> (impact)
,ø = not affected
,? = missing data
Powered by Codecov. Last update aa011ef...76eadee. Read the comment docs.
thanks!
I wonder if instead we might want mutate()
to fail if it doesn't create a mutation in any of the functions? That is, if i
gets bigger than the length of x
, then we've gone through all the elements of x
, correct? Then I imagine we'd just want to stop()
saying that we couldn't create a mutation?
if
i
gets bigger than the length ofx
, then we've gone through all the elements of x, correct?
Yes, but mutate_one()
randomly tries [using astr::ast_modify(..., if_many = "random")
] a different mutation for each element of x
. In the second round, mutate_one
will most likely choose a different mutation for the first (and each) element of x
. In randgeo
, the example that you are using, mutate()
succeeds in the first or second round (after going through all the elements of x
once). This is the current implementation of mutate()
.
In an alternative implementation of mutate()
, we could use the first mutation for each element of x
and then use the second mutation for each element of x
, and so on. In that case, we would want mutate()
to fail (stop()
) if it doesn't create a mutant in any of the functions after systematically trying each mutation.
Which method do you prefer?
This PR solves an issue if you choose to randomly try a mutation for each function
We would have to change the implementation of mutate()
if you chose to systematically try each mutation for each function
I have updated this PR adding a break
.
Let's stick with random for now.
Great!
The
i
in the while loop inmutate
some times gets bigger than the length ofx
. That is a problem in this line:since it produces this error: