Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

タイポ修正 #763

Merged
merged 2 commits into from
Jul 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/main/java/jp/kusumotolab/kgenprog/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -736,7 +736,7 @@ private void setMutationGeneratingCountFromCmdLineParser(final int mutationGener
usage = "Specifies how many variants are generated in a generation by a crossover.")
private void setCrossOverGeneratingCountFromCmdLineParser(final int crossoverGeneratingCount) {
this.crossoverGeneratingCount = crossoverGeneratingCount;
this.optionsSetByCmdLineArgs.add("crossoverGenetingCount");
this.optionsSetByCmdLineArgs.add("crossoverGeneratingCount");
}

@Option(name = "--headcount", metaVar = "<num>",
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/jp/kusumotolab/kgenprog/KGenProgMain.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,13 @@ private void logConfig() {

private void logInitialFailedTests(final TestResults testResults) {
final StringBuilder sb = new StringBuilder();
final List<TestResult> successedTestResults = testResults.getSuccessedTestResults();
final List<TestResult> succeededTestResults = testResults.getSucceededTestResults();
final List<TestResult> failedTestResults = testResults.getFailedTestResults();
sb//
.append("initial failed tests (")
.append(failedTestResults.size())
.append("/")
.append(successedTestResults.size() + failedTestResults.size())
.append(succeededTestResults.size() + failedTestResults.size())
.append(")")
.append(System.lineSeparator());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public List<Suspiciousness> exec(final GeneratedSourceCode generatedSourceCode,

final List<Suspiciousness> suspiciousnesses = new ArrayList<>();

final Set<FullyQualifiedName> execuetdFailedTargetFQNs = testResults.getFailedTestResults()
final Set<FullyQualifiedName> executedFailedTargetFQNs = testResults.getFailedTestResults()
.stream()
.map(TestResult::getExecutedTargetFQNs)
.flatMap(Collection::stream)
Expand All @@ -64,7 +64,7 @@ public List<Suspiciousness> exec(final GeneratedSourceCode generatedSourceCode,
for (final GeneratedAST<ProductSourcePath> ast : generatedSourceCode.getProductAsts()) {

// do nothing if none of failed target fqns contain the ast
if (skippableFormula && !execuetdFailedTargetFQNs.contains(ast.getPrimaryClassName())) {
if (skippableFormula && !executedFailedTargetFQNs.contains(ast.getPrimaryClassName())) {
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,25 +47,25 @@ public Variant exec(final List<Variant> variants, final Variant firstVariant)
throw new CrossoverInfeasibleException("no variant for second parent");
}

// firstVariantにおいて,失敗したテスト一覧(failedTestFQNs)と成功したテスト一覧(successedTestFQNs)を取得
// firstVariantにおいて,失敗したテスト一覧(failedTestFQNs)と成功したテスト一覧(succeededTestFQNs)を取得
final TestResults testResults = firstVariant.getTestResults();
final List<FullyQualifiedName> failedTestFQNs = testResults.getFailedTestFQNs();
final List<FullyQualifiedName> successedTestFQNs = testResults.getSuccessedTestFQNs();
final List<FullyQualifiedName> succeededTestFQNs = testResults.getSucceededTestFQNs();

// secondVariantCandidatesを,successedTestFQNsにおいて成功したテストが多い順にソートし
// secondVariantCandidatesを,succeededTestFQNsにおいて成功したテストが多い順にソートし
// そのあとにfailedTestFQNsにおいて成功したテストが多い順にソート
final Comparator<Variant> comparator = Comparator
.<Variant>comparingLong(v -> getSuccessedNumber(v.getTestResults(), successedTestFQNs))
.<Variant>comparingLong(v -> getSucceededNumber(v.getTestResults(), succeededTestFQNs))
.reversed()
.thenComparingLong(v -> getSuccessedNumber(v.getTestResults(), failedTestFQNs))
.thenComparingLong(v -> getSucceededNumber(v.getTestResults(), failedTestFQNs))
.reversed();
Collections.sort(secondVariantCandidates, comparator);

// リストの最初の要素を返す
return secondVariantCandidates.get(0);
}

private Long getSuccessedNumber(final TestResults testResults,
private Long getSucceededNumber(final TestResults testResults,
final Collection<FullyQualifiedName> targetFQNs) {
return targetFQNs.stream()
.filter(fqn -> !testResults.getTestResult(fqn).failed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,9 @@ public BuildResults build(final GeneratedSourceCode generatedSourceCode) {

// コンパイル対象が存在する(≒全コンパイル対象がキャッシュ済みでない)場合はコンパイル
if (!javaSourceObjects.isEmpty()) {
final boolean successs = build(allAsts, javaSourceObjects, diagnostics, progress);
final boolean success = build(allAsts, javaSourceObjects, diagnostics, progress);

if (!successs) {
if (!success) {
return new EmptyBuildResults(diagnostics, progress.toString());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public List<TestResult> getFailedTestResults() {
*
* @return 成功したテスト結果s
*/
public List<TestResult> getSuccessedTestResults() {
public List<TestResult> getSucceededTestResults() {
return this.value.values()
.stream()
.filter(r -> !r.failed)
Expand Down Expand Up @@ -104,7 +104,7 @@ public List<FullyQualifiedName> getFailedTestFQNs() {
*
* @return 成功したテストのFQN一覧
*/
public List<FullyQualifiedName> getSuccessedTestFQNs() {
public List<FullyQualifiedName> getSucceededTestFQNs() {
return this.value.values()
.stream()
.filter(r -> !r.failed)
Expand All @@ -130,7 +130,7 @@ public TestResult getTestResult(final FullyQualifiedName testFQN) {
*/
public double getSuccessRate() {
final int fail = getFailedTestResults().size();
final int success = getSuccessedTestResults().size();
final int success = getSucceededTestResults().size();

return 1.0 * success / (success + fail);
}
Expand Down Expand Up @@ -231,7 +231,7 @@ public long getNumberOfFailedTestsExecutingTheStatement(final ProductSourcePath
*/
public long getNumberOfPassedTestsNotExecutingTheStatement(
final ProductSourcePath productSourcePath, final ASTLocation location) {
return getSuccessedTestResults().size()
return getSucceededTestResults().size()
- getNumberOfPassedTestsExecutingTheStatement(productSourcePath, location);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ private URL[] convertClasspathsToURLs(final List<ClassPath> classpaths) {
}

/**
* To avoid Malform uri in lambda expression
* To avoid Malformed uri in lambda expression
*
* @param uri
* @return
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public void testExec() {
}

@Test
public void testExecDupicateInitialVariant() {
public void testExecDuplicatedInitialVariant() {
final Path rootDir = Paths.get("example/BuildSuccess01");
final TargetProject targetProject = TargetProjectFactory.create(rootDir);
final Configuration config = new Configuration.Builder(targetProject).build();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,22 +43,22 @@ public class CrossoverTestVariants {

public CrossoverTestVariants() {

final TestResult successedTestResult = Mockito.mock(TestResult.class);
final TestResult succeededTestResult = Mockito.mock(TestResult.class);
final TestResult failedTestResult = Mockito.mock(TestResult.class);

try {
Class<?> c = Class.forName("jp.kusumotolab.kgenprog.project.test.TestResult");
Field f = c.getDeclaredField("failed");
f.setAccessible(true);
f.set(successedTestResult, false);
f.set(succeededTestResult, false);
f.set(failedTestResult, true);
} catch (ClassNotFoundException | NoSuchFieldException | SecurityException
| IllegalArgumentException | IllegalAccessException e) {
e.printStackTrace();
}

final TestResults testResultsA = Mockito.mock(TestResults.class);
when(testResultsA.getSuccessedTestFQNs())
when(testResultsA.getSucceededTestFQNs())
.thenReturn(Arrays.asList(new TestFullyQualifiedName("Test2"),
new TestFullyQualifiedName("Test4"), new TestFullyQualifiedName("Test6"),
new TestFullyQualifiedName("Test8"), new TestFullyQualifiedName("Test10")));
Expand All @@ -69,26 +69,26 @@ public CrossoverTestVariants() {
when(testResultsA.getTestResult(new TestFullyQualifiedName("Test1")))
.thenReturn(failedTestResult);
when(testResultsA.getTestResult(new TestFullyQualifiedName("Test2")))
.thenReturn(successedTestResult);
.thenReturn(succeededTestResult);
when(testResultsA.getTestResult(new TestFullyQualifiedName("Test3")))
.thenReturn(failedTestResult);
when(testResultsA.getTestResult(new TestFullyQualifiedName("Test4")))
.thenReturn(successedTestResult);
.thenReturn(succeededTestResult);
when(testResultsA.getTestResult(new TestFullyQualifiedName("Test5")))
.thenReturn(failedTestResult);
when(testResultsA.getTestResult(new TestFullyQualifiedName("Test6")))
.thenReturn(successedTestResult);
.thenReturn(succeededTestResult);
when(testResultsA.getTestResult(new TestFullyQualifiedName("Test7")))
.thenReturn(failedTestResult);
when(testResultsA.getTestResult(new TestFullyQualifiedName("Test8")))
.thenReturn(successedTestResult);
.thenReturn(succeededTestResult);
when(testResultsA.getTestResult(new TestFullyQualifiedName("Test9")))
.thenReturn(failedTestResult);
when(testResultsA.getTestResult(new TestFullyQualifiedName("Test10")))
.thenReturn(successedTestResult);
.thenReturn(succeededTestResult);

final TestResults testResultsB = Mockito.mock(TestResults.class);
when(testResultsB.getSuccessedTestFQNs())
when(testResultsB.getSucceededTestFQNs())
.thenReturn(Arrays.asList(new TestFullyQualifiedName("Test1"),
new TestFullyQualifiedName("Test3"), new TestFullyQualifiedName("Test5"),
new TestFullyQualifiedName("Test7"), new TestFullyQualifiedName("Test9")));
Expand All @@ -97,28 +97,28 @@ public CrossoverTestVariants() {
new TestFullyQualifiedName("Test4"), new TestFullyQualifiedName("Test6"),
new TestFullyQualifiedName("Test8"), new TestFullyQualifiedName("Test10")));
when(testResultsB.getTestResult(new TestFullyQualifiedName("Test1")))
.thenReturn(successedTestResult);
.thenReturn(succeededTestResult);
when(testResultsB.getTestResult(new TestFullyQualifiedName("Test2")))
.thenReturn(failedTestResult);
when(testResultsB.getTestResult(new TestFullyQualifiedName("Test3")))
.thenReturn(successedTestResult);
.thenReturn(succeededTestResult);
when(testResultsB.getTestResult(new TestFullyQualifiedName("Test4")))
.thenReturn(failedTestResult);
when(testResultsB.getTestResult(new TestFullyQualifiedName("Test5")))
.thenReturn(successedTestResult);
.thenReturn(succeededTestResult);
when(testResultsB.getTestResult(new TestFullyQualifiedName("Test6")))
.thenReturn(failedTestResult);
when(testResultsB.getTestResult(new TestFullyQualifiedName("Test7")))
.thenReturn(successedTestResult);
.thenReturn(succeededTestResult);
when(testResultsB.getTestResult(new TestFullyQualifiedName("Test8")))
.thenReturn(failedTestResult);
when(testResultsB.getTestResult(new TestFullyQualifiedName("Test9")))
.thenReturn(successedTestResult);
.thenReturn(succeededTestResult);
when(testResultsB.getTestResult(new TestFullyQualifiedName("Test10")))
.thenReturn(failedTestResult);

final TestResults testResultsC = Mockito.mock(TestResults.class);
when(testResultsC.getSuccessedTestFQNs()).thenReturn(
when(testResultsC.getSucceededTestFQNs()).thenReturn(
Arrays.asList(new TestFullyQualifiedName("Test7"), new TestFullyQualifiedName("Test8"),
new TestFullyQualifiedName("Test9"), new TestFullyQualifiedName("Test10")));
when(testResultsC.getFailedTestFQNs()).thenReturn(
Expand All @@ -138,30 +138,30 @@ public CrossoverTestVariants() {
when(testResultsC.getTestResult(new TestFullyQualifiedName("Test6")))
.thenReturn(failedTestResult);
when(testResultsC.getTestResult(new TestFullyQualifiedName("Test7")))
.thenReturn(successedTestResult);
.thenReturn(succeededTestResult);
when(testResultsC.getTestResult(new TestFullyQualifiedName("Test8")))
.thenReturn(successedTestResult);
.thenReturn(succeededTestResult);
when(testResultsC.getTestResult(new TestFullyQualifiedName("Test9")))
.thenReturn(successedTestResult);
.thenReturn(succeededTestResult);
when(testResultsC.getTestResult(new TestFullyQualifiedName("Test10")))
.thenReturn(successedTestResult);
.thenReturn(succeededTestResult);

final TestResults testResultsD = Mockito.mock(TestResults.class);
when(testResultsD.getSuccessedTestFQNs()).thenReturn(
when(testResultsD.getSucceededTestFQNs()).thenReturn(
Arrays.asList(new TestFullyQualifiedName("Test1"), new TestFullyQualifiedName("Test2"),
new TestFullyQualifiedName("Test3"), new TestFullyQualifiedName("Test4")));
when(testResultsD.getFailedTestFQNs()).thenReturn(
Arrays.asList(new TestFullyQualifiedName("Test5"), new TestFullyQualifiedName("Test6"),
new TestFullyQualifiedName("Test7"), new TestFullyQualifiedName("Test8"),
new TestFullyQualifiedName("Test9"), new TestFullyQualifiedName("Test10")));
when(testResultsD.getTestResult(new TestFullyQualifiedName("Test1")))
.thenReturn(successedTestResult);
.thenReturn(succeededTestResult);
when(testResultsD.getTestResult(new TestFullyQualifiedName("Test2")))
.thenReturn(successedTestResult);
.thenReturn(succeededTestResult);
when(testResultsD.getTestResult(new TestFullyQualifiedName("Test3")))
.thenReturn(successedTestResult);
.thenReturn(succeededTestResult);
when(testResultsD.getTestResult(new TestFullyQualifiedName("Test4")))
.thenReturn(successedTestResult);
.thenReturn(succeededTestResult);
when(testResultsD.getTestResult(new TestFullyQualifiedName("Test5")))
.thenReturn(failedTestResult);
when(testResultsD.getTestResult(new TestFullyQualifiedName("Test6")))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ public void testOrderOfVariants() {
}

/**
* BulidFailedの個体が選択されるかどうかをテストする.
* BuildFailedの個体が選択されるかどうかをテストする.
*/
@Test
public void testBuildFailed() {
Expand Down Expand Up @@ -195,7 +195,7 @@ private Variant createVariant(final Fitness fitness, final int id,
* @param current variantSelectionに渡すcurrentリスト
* @param generated variantSelectionに渡すgeneratedリスト
* @param num リストに追加する要素の数
* @param testResultsCreator testResultsの渡し方を指定するFuntionオブジェクト(intを受け取りTestResultsを返す)
* @param testResultsCreator testResultsの渡し方を指定するFunctionオブジェクト(intを受け取りTestResultsを返す)
*/
private void setupLists(final List<Variant> current, final List<Variant> generated, final int num,
final Function<Integer, TestResults> testResultsCreator) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ public void write(final int b) {
}

@Test
public void testCreateBySpecifingPathsForProductAndTest() {
public void testCreateBySpecifyingPathsForProductAndTest() {
final Path rootPath = Paths.get("example/BuildSuccess07");
final List<Path> srcPaths = Arrays.asList(rootPath.resolve("src"));
final List<Path> testPaths = Arrays.asList(rootPath.resolve("test"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ public void before() {

// @formatter:off
final CompilationUnit compilationUnit = createCompilationUnit(source);
final TypeDeclaration typeDecralation = (TypeDeclaration) compilationUnit.types()
final TypeDeclaration typeDeclaration = (TypeDeclaration) compilationUnit.types()
.get(0);
final MethodDeclaration methodDecralation = (MethodDeclaration) typeDecralation.bodyDeclarations()
final MethodDeclaration methodDeclaration = (MethodDeclaration) typeDeclaration.bodyDeclarations()
.get(0);
final Block block = methodDecralation.getBody();
final Block block = methodDeclaration.getBody();
final Statement statement1 = (Statement) block.statements()
.get(0); // "int n = 0;"
final IfStatement ifStatement = (IfStatement) block.statements()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public void testInsert() {
final GeneratedSourceCode sourceCode =
new GeneratedSourceCode(Collections.emptyList(), Collections.singletonList(ast));
final InsertTimeoutRuleFieldOperation operation = new InsertTimeoutRuleFieldOperation(10);
final GeneratedSourceCode applyiedSourceCode = operation.apply(sourceCode, null);
final GeneratedSourceCode appliedSourceCode = operation.apply(sourceCode, null);

final String expected = new StringBuilder()
.append("class A {")
Expand All @@ -43,7 +43,7 @@ public void testInsert() {
.toString();

final GeneratedJDTAST<TestSourcePath> newAST =
(GeneratedJDTAST<TestSourcePath>) applyiedSourceCode.getTestAsts()
(GeneratedJDTAST<TestSourcePath>) appliedSourceCode.getTestAsts()
.get(0);

assertThat(newAST.getRoot()).isSameSourceCodeAs(expected);
Expand All @@ -65,7 +65,7 @@ public void testInsertDuplicateName() {
final GeneratedSourceCode sourceCode =
new GeneratedSourceCode(Collections.emptyList(), Collections.singletonList(ast));
final InsertTimeoutRuleFieldOperation operation = new InsertTimeoutRuleFieldOperation(10);
final GeneratedSourceCode applyiedSourceCode = operation.apply(sourceCode, null);
final GeneratedSourceCode appliedSourceCode = operation.apply(sourceCode, null);

final String expected = new StringBuilder()
.append("class A {")
Expand All @@ -79,7 +79,7 @@ public void testInsertDuplicateName() {
.toString();

final GeneratedJDTAST<TestSourcePath> newAST =
(GeneratedJDTAST<TestSourcePath>) applyiedSourceCode.getTestAsts()
(GeneratedJDTAST<TestSourcePath>) appliedSourceCode.getTestAsts()
.get(0);

assertThat(newAST.getRoot()).isSameSourceCodeAs(expected);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public void testConstructAST() {
}

@Test
public void testConstrutASTWithFailedSourceCode() {
public void testConstructASTWithFailedSourceCode() {
final Path basePath = Paths.get("example/BuildFailure02");
final TargetProject targetProject = TargetProjectFactory.create(basePath);
final JDTASTConstruction construction = new JDTASTConstruction();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ public void testExecForBuildSuccess02() {
assertThat(extractStatuses(barTest01rCoverage)).containsExactly(EMPTY, NOT_COVERED, EMPTY,
COVERED, EMPTY, EMPTY, NOT_COVERED, EMPTY, EMPTY, NOT_COVERED, NOT_COVERED);

// TODO 最後のNOT_COVERDだけ理解できない.謎.
// TODO 最後のNOT_COVEREDだけ理解できない.謎.
}

@Test
Expand Down Expand Up @@ -666,7 +666,7 @@ public void testExecForResourceAccess() {

@Test
// クラスローダが抱えるバイナリ形式のresourcesにアクセスする題材の確認
public void testExecForResourceAcessFromClassLoader() {
public void testExecForResourceAccessFromClassLoader() {
final Path rootPath = Paths.get("example/BuildSuccess22");

final TargetProject targetProject = TargetProjectFactory.create(rootPath);
Expand Down