|
1
|
|
package com.rox.cpu.mos6502.assembler; |
|
2
|
|
|
|
3
|
|
/** |
|
4
|
|
* A parsed instruction operand. |
|
5
|
|
* <p> |
|
6
|
|
* {@code mode} is left {@code null} for two syntactically ambiguous cases, resolved later by |
|
7
|
|
* {@code InstructionResolver} against what the mnemonic actually supports: |
|
8
|
|
* <ul> |
|
9
|
|
* <li>no operand token at all ({@link #EMPTY}) - could be IMPLIED or ACCUMULATOR</li> |
|
10
|
|
* <li>a bare label reference - could be RELATIVE (branches) or ABSOLUTE (e.g. JMP/JSR)</li> |
|
11
|
|
* </ul> |
|
12
|
|
*/ |
|
13
|
|
record Operand(AddressingMode mode, int value, String label) { |
|
14
|
|
static final Operand EMPTY = new Operand(null, 0, null); |
|
15
|
|
|
|
16
|
|
static Operand accumulator() { |
|
17
|
1
1. accumulator : replaced return value with null for com/rox/cpu/mos6502/assembler/Operand::accumulator → KILLED
|
return new Operand(AddressingMode.ACCUMULATOR, 0, null); |
|
18
|
|
} |
|
19
|
|
|
|
20
|
|
static Operand of(final AddressingMode mode, final int value) { |
|
21
|
1
1. of : replaced return value with null for com/rox/cpu/mos6502/assembler/Operand::of → KILLED
|
return new Operand(mode, value, null); |
|
22
|
|
} |
|
23
|
|
|
|
24
|
|
static Operand labelRef(final String label) { |
|
25
|
1
1. labelRef : replaced return value with null for com/rox/cpu/mos6502/assembler/Operand::labelRef → KILLED
|
return new Operand(null, 0, label); |
|
26
|
|
} |
|
27
|
|
|
|
28
|
|
boolean isEmpty() { |
|
29
|
3
1. isEmpty : negated conditional → KILLED
2. isEmpty : replaced boolean return with true for com/rox/cpu/mos6502/assembler/Operand::isEmpty → KILLED
3. isEmpty : negated conditional → KILLED
|
return mode == null && label == null; |
|
30
|
|
} |
|
31
|
|
|
|
32
|
|
boolean isLabelReference() { |
|
33
|
2
1. isLabelReference : negated conditional → KILLED
2. isLabelReference : replaced boolean return with true for com/rox/cpu/mos6502/assembler/Operand::isLabelReference → KILLED
|
return label != null; |
|
34
|
|
} |
|
35
|
|
} |
| | Mutations |
| 17 |
|
1.1 Location : accumulator Killed by : com.rox.cpu.mos6502.assembler.OperandParserTest.[engine:junit-jupiter]/[class:com.rox.cpu.mos6502.assembler.OperandParserTest]/[nested-class:Accumulator]/[test-template:bareARegisterTokenIsAccumulator(java.lang.String)]/[test-template-invocation:#1] replaced return value with null for com/rox/cpu/mos6502/assembler/Operand::accumulator → KILLED
|
| 21 |
|
1.1 Location : of Killed by : com.rox.cpu.mos6502.assembler.OperandParserTest.[engine:junit-jupiter]/[class:com.rox.cpu.mos6502.assembler.OperandParserTest]/[nested-class:Immediate]/[test-template:hashPrefixedLiteralsAreImmediate(java.lang.String, int)]/[test-template-invocation:#2] replaced return value with null for com/rox/cpu/mos6502/assembler/Operand::of → KILLED
|
| 25 |
|
1.1 Location : labelRef Killed by : com.rox.cpu.mos6502.assembler.InstructionResolverTest.[engine:junit-jupiter]/[class:com.rox.cpu.mos6502.assembler.InstructionResolverTest]/[method:labelOperandResolvesToRelativeForBranches()] replaced return value with null for com/rox/cpu/mos6502/assembler/Operand::labelRef → KILLED
|
| 29 |
|
1.1 Location : isEmpty Killed by : com.rox.cpu.mos6502.assembler.OperandParserTest.[engine:junit-jupiter]/[class:com.rox.cpu.mos6502.assembler.OperandParserTest]/[nested-class:Empty]/[method:emptyOperandTextIsTheEmptySentinel()] negated conditional → KILLED
2.2 Location : isEmpty Killed by : com.rox.cpu.mos6502.assembler.InstructionResolverTest.[engine:junit-jupiter]/[class:com.rox.cpu.mos6502.assembler.InstructionResolverTest]/[method:labelOperandResolvesToRelativeForBranches()] replaced boolean return with true for com/rox/cpu/mos6502/assembler/Operand::isEmpty → KILLED
3.3 Location : isEmpty Killed by : com.rox.cpu.mos6502.assembler.OperandParserTest.[engine:junit-jupiter]/[class:com.rox.cpu.mos6502.assembler.OperandParserTest]/[nested-class:Empty]/[method:emptyOperandTextIsTheEmptySentinel()] negated conditional → KILLED
|
| 33 |
|
1.1 Location : isLabelReference Killed by : com.rox.cpu.mos6502.assembler.InstructionResolverTest.[engine:junit-jupiter]/[class:com.rox.cpu.mos6502.assembler.InstructionResolverTest]/[method:labelOperandResolvesToRelativeForBranches()] negated conditional → KILLED
2.2 Location : isLabelReference Killed by : com.rox.cpu.mos6502.assembler.InstructionResolverTest.[engine:junit-jupiter]/[class:com.rox.cpu.mos6502.assembler.InstructionResolverTest]/[method:directModeResolvesToTheMatchingOpcode()] replaced boolean return with true for com/rox/cpu/mos6502/assembler/Operand::isLabelReference → KILLED
|