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

Value check fix #496

Merged
merged 2 commits into from
Sep 6, 2024
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/gov/nasa/jpf/listener/NumericValueChecker.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ String check (long v){
String check (double v){
if (v < min){
return String.format("%f < %f", v, min);
} else if (v > (long)max){
} else if (v > (double)max){
return String.format("%f > %f", v, max);
}
return null;
Expand Down
14 changes: 14 additions & 0 deletions src/tests/gov/nasa/jpf/test/mc/data/NumericValueCheckerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ static class C1 {
void setValue(double v){
d = v;
}

void setLocalVar() {
double x = 0.5;
}
}

@Test
Expand All @@ -47,6 +51,16 @@ public void testField(){
}
}

@Test
public void testLocalVar() {
if (verifyNoPropertyViolation("+listener=.listener.NumericValueChecker",
"+range.vars=x",
"+range.x.var=*$C1.setLocalVar():x",
"+range.x.max=0.9")) {
C1 c1= new C1();
c1.setLocalVar();
}
}

static class C2 {
void doSomething(int d){
Expand Down
Loading