You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Successfuly removed equivalent mutants and low-value mutations from the mutation testing framework, reduce false positives.
3
+
4
+
-`len` ↔ `sum`: Often equivalent for single collections
5
+
-`min` ↔ `max`: Often equivalent for single element collections
6
+
-`int` ↔ `float`: Often equivalent for whole numbers
7
+
-`bytes` ↔ `bytearray`: Equivalent unless mutation methods called
8
+
-`map` ↔ `filter`: Low testing value, replaced with function call mutations
9
+
10
+
### 2. Added New Function Call Mutations
11
+
12
+
Implemented `operator_function_call_mutations` that provides more meaningful mutations:
13
+
14
+
#### Aggregate Functions
15
+
-`len(...)` → `len(...) + 1` and `len(...) - 1`
16
+
-`sum(...)` → `sum(...) + 1` and `sum(...) - 1`
17
+
-`min(...)` → `min(...) + 1` and `min(...) - 1`
18
+
-`max(...)` → `max(...) + 1` and `max(...) - 1`
19
+
20
+
#### Mapping/Filtering Functions
21
+
-`map(fn, arr)` → `list(arr)` (ignores function, returns iterable as list)
22
+
-`filter(fn, arr)` → `list(arr)` (ignores predicate, returns all items)
23
+
24
+
### 3. Improved Regex Mutations
25
+
26
+
Enhanced `_mutate_regex` funciton to avoid equivalent mutants:
27
+
28
+
- Added handling for `{1,}` patterns: converts to `{2,}` and `{0,}` instead of equivalent `+`
29
+
- Documented that `{1,}` ↔ `+` mutations are equivalent and should be avoided
30
+
31
+
### 4. Preserved Existing Quality Mutations
32
+
33
+
Kept the following name mappings that provide good testing value:
34
+
35
+
-`True` ↔ `False`: Boolean opposites
36
+
-`all` ↔ `any`: Boolean aggregates with different semantics
37
+
-`sorted` ↔ `reversed`: Different ordering operations
38
+
-`deepcopy` ↔ `copy`: Different copy depths
39
+
- Enum mappings: `Enum` ↔ `StrEnum` ↔ `IntEnum`
40
+
41
+
### 5. Maintained chr/ord Implementation
42
+
43
+
The existing `operator_chr_ord` already implements the desired pattern:
44
+
-`chr(123)` → `chr(123 + 1)` (modifies result instead of swapping functions)
45
+
-`ord('A')` → `ord('A') + 1` (modifies result instead of swapping functions)
46
+
47
+
This avoids runtime exceptions that would occur with chr ↔ ord name swapping.
48
+
49
+
1. Elimnated equivalent mutations (len↔sum, min↔max, etc.) that produce identical behavior, reducing wasted test effort and improving mutation score accuracy.
50
+
51
+
2. Function call mutations (len(x)→len(x)±1) create meaningful semantic changes that better represent realistic programming errors compared to simple name swapping.
52
+
53
+
3. Implementation prevents type errors and runtime exceptions through proper function signature preservation, particularly in chr/ord mutations.
54
+
55
+
4.By focusing mutations on value/behavior changes rather than name substitutions, test failures now directly correlate to actual logic vulnerabilities.
56
+
57
+
58
+
## Test Coverage
59
+
60
+
- All existing tests pass
61
+
- Aded comprehensive integration tests for new function call mutations
62
+
- Verified that problematic mappings have been removed
63
+
- Confirmed that quality mutations are preserved
64
+
65
+
## Example Improvements
66
+
67
+
### Before:
68
+
```python
69
+
len(data) → sum(data) # Often equivalent
70
+
map(f, data) → filter(f, data) # Low testing value
0 commit comments