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

Fix #35: consitency spec and logs #37

Merged
merged 6 commits into from
Oct 6, 2016

Conversation

danglotb
Copy link
Member

@danglotb danglotb commented Oct 6, 2016

Improvement of the consistency specifications management. We identify 3 cases:

case 1: inconsistent specs (same keys, different outcomes): if condition can be flipped, it has no impact, so discarded
case 2: different input, same output: malformed problems, only the first key set kept.
case 3: same inputs and same output: redundant tests, discarded.

For each case, a log has been added.

More over, with the fix of consistency, NoPol is able to find a patch for median_90a14c1a from IntroClassJava while it could not before.

}

if (output.equals(reference) && this.keys.equals(inputs.keySet())) {
this.logger.warn("You may have some redundant test: same input and same outcome, only one will be used: discarded.");// case 3
Copy link
Contributor

Choose a reason for hiding this comment

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

in each log line can you add the specification as well?

// we discard it
this.inconsistentInputs.add(inputs);
if (!this.keys.equals(inputs.keySet())) {
this.logger.debug("Malformed problems: the same input value has different outcome: discarded.");// case 2
Copy link
Contributor

Choose a reason for hiding this comment

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

Message should be "Ill-formed problem: not the input variables in "+inputs +" reference ("+keys+")"

this.logger.debug("Malformed problems: the same input value has different outcome: discarded.");// case 2
consistentInputs().remove(inputs);
} else {
this.logger.debug("Inconsistent specification: same input with same outcome, the condition can be flipped with no impact: discarded.");// case 1
Copy link
Contributor

Choose a reason for hiding this comment

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

same input with different outcome, logical contradiction, discarding the second one.

@@ -67,7 +67,8 @@ private void addToSpec(Map<String, Object> inputs, T output) {
}

if (output.equals(reference) && this.keys.equals(inputs.keySet())) {
this.logger.warn("You may have some redundant test: same input and same outcome, only one will be used: discarded.");// case 3
Copy link
Contributor

Choose a reason for hiding this comment

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

you have redundant tests: same input and same outcome, only one will be used to speed-up synthesis

@monperrus
Copy link
Contributor

the new tests are really good!

@monperrus monperrus merged commit a8d9134 into SpoonLabs:master Oct 6, 2016
@danglotb danglotb deleted the fix-consitency-spec branch October 21, 2016 12:21
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