- Notifications
You must be signed in to change notification settings - Fork 45
Closed
Labels
comp-symbolic-engineIssue is related to the symbolic execution engineIssue is related to the symbolic execution enginectg-bugIssue is a bugIssue is a bug
Description
Suppose we have a class with a public final field whose content can be modified (e.g., an array):
public class PublicFinalFieldExample { public final int[] data = {1, 2}; public boolean foo(int x) { return x == data[0]; } }
Expected behavior:
UtAssembleModel is not created, final field is set via reflection.
Actual behavior:
The generated tests for foo contain the direct assignment to the data field instead of assignment to the array elements or changing the field value using reflection:
@Test -- @DisplayName("foo: return data[0] == x : False -> return data[0] == x") public void testFoo_0OfDataNotEqualsX() throws Throwable { PublicFinalArrayExample publicFinalArrayExample = new PublicFinalArrayExample(); int[] intArray = new int[1]; intArray[0] = 1; publicFinalArrayExample.data = intArray; // Error: this line does not compile boolean actual = publicFinalArrayExample.foo(-224); assertFalse(actual); }
Testing instructions:
AssembleModelGeneratorTests should be enlarged with one more test for objects with final fields.
Other tests should still pass.
Metadata
Metadata
Assignees
Labels
comp-symbolic-engineIssue is related to the symbolic execution engineIssue is related to the symbolic execution enginectg-bugIssue is a bugIssue is a bug
Type
Projects
Status
Done