Skip to content

Commit

Permalink
Merge branch 'issue_824' of github.com:NASA-PDS/validate into issue_824
Browse files Browse the repository at this point in the history
  • Loading branch information
Al Niessner authored and Al Niessner committed Mar 1, 2024
2 parents 469b0b9 + 67efb71 commit d2cf090
Show file tree
Hide file tree
Showing 5 changed files with 631 additions and 17 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Changelog

## [«unknown»](https://github.com/NASA-PDS/validate/tree/«unknown») (2024-02-26)
## [«unknown»](https://github.com/NASA-PDS/validate/tree/«unknown») (2024-02-27)

[Full Changelog](https://github.com/NASA-PDS/validate/compare/v3.4.1...«unknown»)

Expand All @@ -11,6 +11,7 @@

**Defects:**

- Validate V.3.4.1 reports file read errors on products which read correctly under V.3.2.0 [\#823](https://github.com/NASA-PDS/validate/issues/823) [[s.medium](https://github.com/NASA-PDS/validate/labels/s.medium)]
- Check for unlabeled files no longer works [\#822](https://github.com/NASA-PDS/validate/issues/822) [[s.medium](https://github.com/NASA-PDS/validate/labels/s.medium)]
- Validate fails to read files on Windows systems after Internal Reference check updates \(\#308\) [\#809](https://github.com/NASA-PDS/validate/issues/809) [[s.high](https://github.com/NASA-PDS/validate/labels/s.high)]
- Validate incorrectly throws precision mismatch error for Table\_Delimited [\#681](https://github.com/NASA-PDS/validate/issues/681) [[s.medium](https://github.com/NASA-PDS/validate/labels/s.medium)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,24 +387,31 @@ public static boolean isSpecialConstant(Number value, SpecialConstants constants
comparison = ((BigInteger) value)
.compareTo(SpecialConstantBitPatternTransforms.asBigInt(constants.getValidMaximum()));
} else {
Long con = SpecialConstantBitPatternTransforms.asBigInt(constants.getValidMaximum()).longValue();
Long val = value.longValue();
if (value instanceof Double) {
val = Long.valueOf(Double.doubleToRawLongBits((Double)value));
if (con.equals (val)) {
matchEdge &= true;
} else {
comparison = ((Double)value).compareTo(Double.longBitsToDouble(con));
}
} else if (value instanceof Float) {
val = Long.valueOf(Float.floatToRawIntBits((Float)value)) & 0xFFFFFFFFL;
if (con.equals (val)) {
matchEdge &= true;
if (constants.getValidMaximum().contains(".") ||
((constants.getValidMaximum().contains("e") || constants.getValidMaximum().contains("E")) &&
!(constants.getValidMaximum().startsWith("0x") || constants.getValidMaximum().startsWith("0X") || constants.getValidMaximum().startsWith("16#")))) {
comparison = Double.valueOf(value.doubleValue())
.compareTo(SpecialConstantBitPatternTransforms.asBigDecimal(constants.getValidMaximum()).doubleValue());
} else {
Long con = SpecialConstantBitPatternTransforms.asBigInt(constants.getValidMaximum()).longValue();
Long val = value.longValue();
if (value instanceof Double) {
val = Long.valueOf(Double.doubleToRawLongBits((Double)value));
if (con.equals (val)) {
matchEdge &= true;
} else {
comparison = ((Double)value).compareTo(Double.longBitsToDouble(con));
}
} else if (value instanceof Float) {
val = Long.valueOf(Float.floatToRawIntBits((Float)value)) & 0xFFFFFFFFL;
if (con.equals (val)) {
matchEdge &= true;
} else {
comparison = ((Float)value).compareTo(Float.intBitsToFloat(con.intValue()));
}
} else {
comparison = ((Float)value).compareTo(Float.intBitsToFloat(con.intValue()));
comparison = val.compareTo(con);
}
} else {
comparison = val.compareTo(con);
}
}
if (0 < comparison) {
Expand Down
3 changes: 3 additions & 0 deletions src/test/resources/features/developer.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Scenario Outline: Execute validate command for tests below.
# Validate#824
|"NASA-PDS/validate#824 Success PDF vs PDF/A" | "github824" | 0 | "0 errors expected" | "totalErrors" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github824.json -s json --skip-context-validation -t {resourceDir}/github824/1203_12.xml" | "report_github824.json" |

# Validate#823
|"NASA-PDS/validate#823 Success process problematic floats" | "github823" | 0 | "0 errors expected" | "totalErrors" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github823.json -s json --skip-context-validation -t {resourceDir}/github823/mvn_swi_l2_onboardsvymom_20230827_v02_r01.xml" | "report_github823.json" |

# Validate#785
|"NASA-PDS/validate#785 Success detecting out of range values" | "github785" | 6 | "6 warnings expected" | "FIELD_VALUE_OUT_OF_SPECIAL_CONSTANT_MIN_MAX_RANGE" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github785.json -s json --skip-context-validation -t {resourceDir}/github785/00038_FGM_RTN.xml" | "report_github785.json" |

Expand Down
Binary file not shown.
Loading

0 comments on commit d2cf090

Please sign in to comment.