Skip to content

Add test cases for concurrent reductions #150

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

Merged
merged 19 commits into from
Jan 5, 2018

Conversation

yiming-tang-cs
Copy link
Contributor

@yiming-tang-cs yiming-tang-cs commented Jan 4, 2018

Fix #138.

The old pull request: #143

Copy link
Member

@khatchad khatchad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are missing the column we discussed from Table 3.

CONVERT_TO_SEQUENTIAL

CONVERT_TO_SEQUENTIAL,
CONVERT_TO_CONCURRENT,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we be more specific here? Concurrent what? Likewise for non-concurrent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do I make more specific for CONVERT_TO_SEQUENTIAL? I thought CONVERT_TO_SEQUENTIAL and CONVERT_TO_CONCURRENT have the same format.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, you can leave those. Let's make the new code specific.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CONVERT_COLLECTOR_TO_CONCURRENT? Is that what you mean?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please go with that

*/
public void testConcurrentReduction() throws Exception {
helper(new StreamAnalysisExpectedResult("orderedWidgets.stream()",
Collections.singleton(ExecutionMode.SEQUENTIAL), Collections.singleton(Ordering.ORDERED), false, false,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please use EnumSet.of(). It should be more efficient.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Other test cases also accept Collections.singleton for execution mode and ordering. Should I change them all?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. Please focus on the new code.

@yiming-tang-cs
Copy link
Contributor Author

You are missing the column we discussed from Table 3.

Also test collector kind in helper method?

CONVERT_TO_SEQUENTIAL

CONVERT_TO_SEQUENTIAL,
CONVERT_TO_CONCURRENT,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CONVERT_COLLECTOR_TO_CONCURRENT? Is that what you mean?

@yiming-tang-cs
Copy link
Contributor Author

CONVERT_COLLECTOR_TO_CONCURRENT? Is that what you mean?

Yes.

@khatchad
Copy link
Member

khatchad commented Jan 5, 2018 via email

@yiming-tang-cs
Copy link
Contributor Author

You are missing the column we discussed from Table 3?

I think the only column I am missing is collector kind. You want test it in helper method?

Copy link
Member

@khatchad khatchad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is poor work overall. You must learn how to reuse existing code.

@@ -634,6 +636,10 @@ public PreconditionSuccess getPassingPrecondition() {
return possibleOrderings.stream().map(e -> e == null ? initialOrdering : e).collect(Collectors.toSet());
}

public CollectorKind getCollectorKind() {
return null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. There should be a field returned here.

import edu.cuny.hunter.streamrefactoring.core.analysis.Refactoring;
import edu.cuny.hunter.streamrefactoring.core.analysis.TransformationAction;

public class ComplexStreamAnalysisExpectedResult {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No way. Way too much duplication. Please explain the reason you need an entire separate class for this.

* Runs a single analysis test.
* Test for #138. Test complex mutable reduction.
*/
private void helper(ComplexStreamAnalysisExpectedResult... expectedResults) throws Exception {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Absolutely not. No copy and pasting.

@khatchad
Copy link
Member

khatchad commented Jan 5, 2018 via email

Copy link
Member

@khatchad khatchad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better but there's still to much duplication.

@@ -167,6 +167,8 @@ private static String getMethodIdentifier(IMethodBinding methodBinding) {
private final MethodDeclaration enclosingMethodDeclaration;

private final TypeDeclaration enclosingTypeDeclaration;

private CollectorKind collectorKind = null;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove the null. It's null be default.

/**
* Overloading constructor to test complex mutable reduction
*/
public StreamAnalysisExpectedResult(String expectedCreation, Set<ExecutionMode> expectedExecutionModes,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Still too much duplication here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've changed constructor.

Copy link
Member

@khatchad khatchad left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you.

@khatchad khatchad merged commit 2c307de into ponder-lab:issue_138 Jan 5, 2018
@khatchad khatchad deleted the issue_138 branch January 5, 2018 23:35
@yiming-tang-cs
Copy link
Contributor Author

Thank you!

khatchad pushed a commit that referenced this pull request Feb 24, 2018
* add test cases and fail the stream

* calculate LOC

* Revert "calculate LOC"

This reverts commit 034b677.

* revert changing functional code

* change test cases

* change test

* change test cases

* change refactoring

* delete useless importation

* Remove extra space.

* change name and collections

* Add collector kind

* remove duplication

* improve format

* remove overloading helper

* format

* remove duplication

* Remove whitespace addition.
khatchad pushed a commit that referenced this pull request Feb 24, 2018
* add test cases and fail the stream

* calculate LOC

* Revert "calculate LOC"

This reverts commit 034b677.

* revert changing functional code

* change test cases

* change test

* change test cases

* change refactoring

* delete useless importation

* Remove extra space.

* change name and collections

* Add collector kind

* remove duplication

* improve format

* remove overloading helper

* format

* remove duplication

* Remove whitespace addition.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants