go-mutesting icon indicating copy to clipboard operation
go-mutesting copied to clipboard

Multiplication mutation to Division

Open kob-h opened this issue 1 year ago • 1 comments

I have the following code:

package mutation

type Calculator struct {
}

func (c *Calculator) Multiply(a int, b int) int {
	return a * b
}
package mutation_test

import (
	mutation "awesomeProject"
	"github.com/stretchr/testify/assert"
	"testing"
)

func TestMe(t *testing.T) {
	c := mutation.Calculator{}
	res := c.Multiply(1, 1)
	assert.Equal(t, 1, res)
}

When I run go-mutation I get the results: The mutation score is 0.000000 (0 passed, 0 failed, 0 duplicated, 0 skipped, total is 0) While I expected to get a result that shows me that multiplication can be replaced for division for this specific test data. I believe this is an issue?

Thanks, Kobi.

kob-h avatar Apr 05 '24 19:04 kob-h

How are you calling the CLI?

The multiplication -> division mutation is part of the arithmetic/base mutator and is enabled by default.

To list all mutators: --list-mutators If you only want to run the single arithmetic/base mutator, the usual workaround is to list and build disable args: go-mutesting --list-mutators | grep -v '^arithmetic/base$' | xargs -I{} echo --disable={} then run go-mutesting with those --disable args so only arithmetic/base remains enabled.

ignatremizov avatar Nov 05 '25 10:11 ignatremizov