stryker-mutator / stryker-net

Mutation testing for .NET core and .NET framework!
https://stryker-mutator.io
Apache License 2.0
1.78k stars 184 forks source link

Mutators for List<T> #1331

Open yakivyusin opened 3 years ago

yakivyusin commented 3 years ago

Is your feature request related to a problem? Please describe. List<T> is the one from the most using structures, would be good to have mutators for its methods.

Describe the solution you'd like Original Mutated
Add(T) Remove(T)
Remove(T) Add(T)
IndexOf(T) LastIndexOf(T)
LastIndexOf(T) IndexOf(T)
Find(Predicate<T>) FindLast(Predicate<T>)
FindLast(Predicate<T>) Find(Predicate<T>)
FindIndex(Predicate<T>) FindLastIndex(Predicate<T>)
FindLastIndex(Predicate<T>) FindIndex(Predicate<T>)
Sort() nothing
TrueForAll(Predicate<T>) Exists(Predicate<T>)
Exists(Predicate<T>) TrueForAll(Predicate<T>)

If it will be approved, I may start working on the implementation.

richardwerkman commented 3 years ago

Good idea! We would have to solve this just like we did with linq methods. We can only look at the method names and not to the type of the variable. So we can't be sure the type will be List. Luckily our rollback mechanism will just remove any mutations that are invalid.

We could add these mutations to a higher mutation level as they give extra insight but don't seems required to me. I suggest giving the mutation the level of Advanced. @Mobrockers agreed?

rouke-broersma commented 3 years ago

I think we'll have to see how much compilation time this adds to a real life project to decide if it should become Advanced or Complete. We can start with Advanced.