-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3401ade
commit 294e327
Showing
5 changed files
with
86 additions
and
100 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,37 @@ | ||
package org.codetracker.util; | ||
|
||
import java.io.IOException; | ||
import java.util.List; | ||
|
||
import gr.uom.java.xmi.LocationInfo; | ||
import org.codetracker.api.BlockTracker; | ||
import org.codetracker.api.CodeTracker; | ||
import org.codetracker.api.History; | ||
import org.codetracker.element.Block; | ||
import org.codetracker.experiment.oracle.BlockOracle; | ||
import org.codetracker.experiment.oracle.history.BlockHistoryInfo; | ||
import org.eclipse.jgit.lib.Repository; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.params.provider.Arguments; | ||
|
||
import gr.uom.java.xmi.LocationInfo.CodeElementType;; | ||
import java.io.IOException; | ||
import java.util.stream.Stream; | ||
|
||
public class BlockOracleTest extends OracleTest { | ||
private static final String EXPECTED = System.getProperty("user.dir") + "/src/test/resources/block/"; | ||
|
||
private History<Block> blockTracker(BlockHistoryInfo blockHistoryInfo, Repository repository) throws Exception { | ||
private static History<Block> blockTracker(BlockHistoryInfo blockHistoryInfo, Repository repository) throws Exception { | ||
BlockTracker blockTracker = CodeTracker | ||
.blockTracker() | ||
.repository(repository) | ||
.filePath(blockHistoryInfo.getFilePath()) | ||
.startCommitId(blockHistoryInfo.getStartCommitId()) | ||
.methodName(blockHistoryInfo.getFunctionName()) | ||
.methodDeclarationLineNumber(blockHistoryInfo.getFunctionStartLine()) | ||
.codeElementType(CodeElementType.valueOf(blockHistoryInfo.getBlockType())) | ||
.codeElementType(LocationInfo.CodeElementType.valueOf(blockHistoryInfo.getBlockType())) | ||
.blockStartLineNumber(blockHistoryInfo.getBlockStartLine()) | ||
.blockEndLineNumber(blockHistoryInfo.getBlockEndLine()) | ||
.build(); | ||
return blockTracker.track(); | ||
} | ||
|
||
@Test | ||
public void testAccuracy() throws IOException, InterruptedException { | ||
List<BlockOracle> oracles = BlockOracle.all(); | ||
for (BlockOracle oracle : oracles) { | ||
loadExpected(EXPECTED + oracle.getName() + "-expected.txt"); | ||
codeTracker(oracle, this::blockTracker, ALL_CORES); | ||
} | ||
public static Stream<Arguments> testProvider() throws IOException { | ||
return getArgumentsStream(BlockOracle.all(), EXPECTED, BlockOracleTest::blockTracker); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters