Browse Source

Allow negative rationals for test mode RESULT specifications.

Was previously being parsed as a PRISM expression as a fallback,
but the parser currently does not handle big integers.

Test case added. And these tests moved to a new "testing" directory.
accumulation-v4.7
Dave Parker 6 years ago
parent
commit
83d05859a1
  1. 2
      prism-tests/bugfixes/normaltestwithrationalresult.prism.props
  2. 0
      prism-tests/functionality/testing/normaltestwithrationalresult.prism
  3. 5
      prism-tests/functionality/testing/normaltestwithrationalresult.prism.props
  4. 2
      prism/src/parser/ast/Property.java

2
prism-tests/bugfixes/normaltestwithrationalresult.prism.props

@ -1,2 +0,0 @@
// RESULT: 1503982516387544510687823213516750681753609533738014093985492327446021823341670745201522478360759626261166470522913554557570937367804047825330483938531949304640395637223627199/3552713678800500929355621337890625000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
"p1": P=? [ F s=5 ];

0
prism-tests/bugfixes/normaltestwithrationalresult.prism → prism-tests/functionality/testing/normaltestwithrationalresult.prism

5
prism-tests/functionality/testing/normaltestwithrationalresult.prism.props

@ -0,0 +1,5 @@
// RESULT: 1503982516387544510687823213516750681753609533738014093985492327446021823341670745201522478360759626261166470522913554557570937367804047825330483938531949304640395637223627199/3552713678800500929355621337890625000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
"p1": P=? [ F s=5 ];
// RESULT: -1503982516387544510687823213516750681753609533738014093985492327446021823341670745201522478360759626261166470522913554557570937367804047825330483938531949304640395637223627199/3552713678800500929355621337890625000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000
"neg_p1": -P=? [ F s=5 ];

2
prism/src/parser/ast/Property.java

@ -397,7 +397,7 @@ public class Property extends ASTElement
doubleExp = Double.NaN;
}
// See if it's a fraction
else if (strExpectedValue.matches("[0-9]+/[0-9]+")) {
else if (strExpectedValue.matches("-?[0-9]+/[0-9]+")) {
doubleExp = new BigRational(strExpectedValue).doubleValue();
simple = false; // complex expression
}

Loading…
Cancel
Save