File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/zip/ZipLongTest.java | File path: /apache-ant-1.7.0/src/tests/junit/org/apache/tools/zip/ZipShortTest.java | |||
Method name: void testToBytes()
|
Method name: void testToBytes()
|
|||
Number of AST nodes: 5 | Number of AST nodes: 5 | |||
1 | ZipLong zl = new ZipLong(0x12345678);↵ | 1 | ZipShort zs = new ZipShort(0x1234);↵ | |
2 | byte[] result = zl.getBytes();↵ | 2 | byte[] result = zs.getBytes();↵ | |
3 | assertEquals("length getBytes", 4, result.length);↵ | 3 | assertEquals("length getBytes", 2, result.length);↵ | |
4 | assertEquals("first byte getBytes", 0x78, result[0]);↵ | 4 | assertEquals("first byte getBytes", 0x34, result[0]);↵ | |
5 | assertEquals("second byte getBytes", 0x56, result[1]); | 5 | assertEquals("second byte getBytes", 0x12, result[1]); | |
See real code fragment | See real code fragment |
Number of common nesting structure subtrees | 1 |
Number of refactorable cases | 0 |
Number of non-refactorable cases | 1 |
Time elapsed for finding largest common nesting structure subtrees (ms) | 0.0 |
Clones location | Clones are in different classes having the same super class |
Number of node comparisons | 25 |
Number of mapped statements | 4 |
Number of unmapped statements in the first code fragment | 1 |
Number of unmapped statements in the second code fragment | 1 |
Time elapsed for statement mapping (ms) | 0.0 |
Clone type | Type 2 |
ID | Statement | ID | Statement | |||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
| 1 | ZipShort zs = new ZipShort(0x1234); | |||||||||||||||
1 | ZipLong zl = new ZipLong(0x12345678); |
| | |||||||||||||||
2 | byte[] result = zl.getBytes(); |
| 2 | byte[] result = zs.getBytes(); | ||||||||||||||
3 | assertEquals("length getBytes", 4, result.length); |
| 3 | assertEquals("length getBytes", 2, result.length); | ||||||||||||||
4 | assertEquals("first byte getBytes", 0x78, result[0]); |
| 4 | assertEquals("first byte getBytes", 0x34, result[0]); | ||||||||||||||
5 | assertEquals("second byte getBytes", 0x56, result[1]); |
| 5 | assertEquals("second byte getBytes", 0x12, result[1]); |
Row | Violation |
---|---|
1 | Unmatched statement ZipShort zs=new ZipShort(0x1234); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
2 | Unmatched statement ZipLong zl=new ZipLong(0x12345678); cannot be moved before the extracted code, because it has control dependencies from statements that will be extracted |
3 | Type org.apache.tools.zip.ZipLong of variable zl does not match with type org.apache.tools.zip.ZipShort of variable zs |
4 | Clone fragment #1 returns variables result , while Clone fragment #2 returns variables |