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

Mutation of >= and <= into == #2842

Open
jeangsc opened this issue Feb 7, 2024 · 1 comment
Open

Mutation of >= and <= into == #2842

jeangsc opened this issue Feb 7, 2024 · 1 comment
Labels
🚀 Feature request New feature or request

Comments

@jeangsc
Copy link

jeangsc commented Feb 7, 2024

Example:

Code tested:
public static bool Is18OrOlder(int age)
{
return age >= 18;
}

Existing tests:
[Fact]
public void Minor_Test()
{
Assert.False(AgeControl.Is18OrOlder(0));
}

[Fact]
public void Equal_Test()
{
Assert.True(AgeControl.Is18OrOlder(18));
}

Both of them pass green when >= is replaced by == , the mutation into == should force the programmer to write a test for higher value than 18 in our example

@jeangsc jeangsc added the 🚀 Feature request New feature or request label Feb 7, 2024
@richardwerkman
Copy link
Member

We currently place 2 mutations for >= (<= and >). The <= mutation already forces the programmer to write a test for the value higher than 18.

As far as I know we tackle all edge cases with these 2 mutations. But if we could simplify by just placing 1 mutation that would improve our performance. We could look into, if this mutation covers the same edge cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 Feature request New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants