SAP / odfuzz

Apache License 2.0
18 stars 12 forks source link

Edm.Decimal Precision = Scale crash #92

Closed AlapanGhosh closed 3 years ago

AlapanGhosh commented 3 years ago
<class 'ValueError'>: empty range for randrange() (1, 1, 0)
      at /usr/lib/python3.8/random.randrange(random.py:226) ~[?:?]
      at /usr/lib/python3.8/random.randint(random.py:248) ~[?:?]
      at /usr/local/lib/python3.8/dist-packages/odfuzz-0.14a2-py3.8.egg/odfuzz/generators.generate(generators.py:93)

Steps to reproduce: Odata metadata with a Edm.Decimal property where Precision = Scale

 <Property Name="StatryRptTaskCompltnRatio" Type="Edm.Decimal" Precision="3" Scale="3"
                    sap:aggregation-role="dimension" sap:text="StatryRptTaskProgress" />

Expected outcome: decimal values between 0 and 1(ex: 0.322, 0.979)

 <Property Name="StatryRptTaskCompltnRatio" Type="Edm.Decimal" Precision="19" Scale="3"
                    sap:aggregation-role="dimension" sap:text="StatryRptTaskProgress" />

The above snippet with Precision> Scale works fine

AlapanGhosh commented 3 years ago

PR created : #93