Skip to content

Commit

Permalink
Merge pull request #1042 from NASA-PDS/issue_992
Browse files Browse the repository at this point in the history
only one number before .
  • Loading branch information
jordanpadams authored Oct 24, 2024
2 parents 8be59a2 + dc30822 commit 3dde814
Show file tree
Hide file tree
Showing 7 changed files with 219 additions and 51 deletions.
2 changes: 1 addition & 1 deletion src/main/java/gov/nasa/pds/tools/util/PDFUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ public synchronized boolean validateFileStandardConformity(String baseDir, Strin
}

// Build the full pathname of the PDF file.
String pdfRef = parent + File.separator + pdfBase;
String pdfRef = parent + (parent.endsWith(File.separator) ? "" : File.separator) + pdfBase;
LOG.debug("validateFileStandardConformity:parent,pdfBase,pdfRef [{}],[{}],[{}]", parent,
pdfBase, pdfRef);
LOG.debug("validateFileStandardConformity:parent,pdfBase,pdfRef,uri [{}],[{}],[{}],{}", parent,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -816,7 +816,7 @@ private void checkFormat(String value, String format, int fieldIndex, RecordLoca
}
try {
if (specifier.matches("[eE]")) {
String p = "(\\+|-)?([0-9]+(\\.[0-9]*)?|\\.[0-9]+)([Ee](\\+|-)?[0-9]+)";
String p = "(\\+|-)?([0-9](\\.[0-9]*)?|\\.[0-9]+)([Ee](\\+|-)?[0-9]+)";
if (!value.trim().matches(p)) {
throw new NumberFormatException("Value does not match pattern.");
}
Expand Down
7 changes: 5 additions & 2 deletions src/test/resources/features/3.6.x.feature
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,12 @@ Feature: Running integration tests for validate module
| testName | testDir | messageCount | messageText | problemEnum | resourceDir | reportDir | commandArgs | refOutputValue |
# Validate#1008
| "NASA-PDS/validate#1008 PDF on windows" | "github1008" | 1 | "1 errors expected" | "NON_PDFA_FILE" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github1008.json -s json --skip-context-validation -t {resourceDir}/github1008/example.xml" | "report_github1008.json" |
# Validate#992
| "NASA-PDS/validate#992 pedantic notation" | "github992" | 6 | "1 errors expected, 5 warnings expected" | "FIELD_VALUE_DATA_TYPE_MISMATCH,FIELD_VALUE_FORMAT_SPECIFIER_MISMATCH,FIELD_VALUE_FORMAT_PRECISION_MISMATCH,FIELD_VALUE_TOO_LONG" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github992.1.json -s json --skip-context-validation -t {resourceDir}/github992/ff_char.xml" | "report_github992.1.json" |
| "NASA-PDS/validate#992 pedantic notation" | "github992" | 6 | "1 errors expected, 5 warnings expected" | "FIELD_VALUE_DATA_TYPE_MISMATCH,FIELD_VALUE_FORMAT_SPECIFIER_MISMATCH,FIELD_VALUE_FORMAT_PRECISION_MISMATCH,FIELD_VALUE_TOO_LONG" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github992.2.json -s json --skip-context-validation -t {resourceDir}/github992/ff_del.xml" | "report_github992.2.json" |
# Validate#816 (reuse validate#681 tests)
| "NASA-PDS/validate#816 Field format FAIL: ASCII table invalid precision" | "github681" | 1 | "1 errors expected" | "FIELD_VALID_FORMAT_PRECISION_MISMATCH" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github681_2.json -s json -t {resourceDir}/github681/ff_char_fail.xml" | "report_github681_2.json" |
| "NASA-PDS/validate#816 Field format WARNING: Precision mismatch" | "github681" | 2 | "2 warnings expected" | "FIELD_VALUE_FORMAT_PRECISION_MISMATCH" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github681_3.json -s json -t {resourceDir}/github681/ff_char_warn.xml {resourceDir}/github681/ff_del_warn.xml" | "report_github681_3.json" |
| "NASA-PDS/validate#816 Field format WARNING: Precision mismatch" | "github681" | 2 | "2 warnings expected" | "FIELD_VALUE_FORMAT_PRECISION_MISMATCH" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github681_3.json -s json -t {resourceDir}/github681/ff_char_warn.xml {resourceDir}/github681/ff_del_warn.xml" | "report_github681_3.json" |
# In .csv, Line1 good; L2,Field1=11.111 for %6.2f; L3,F2=22.22 for $4.2f; L4,F3=33333333 (no 'e') for %8.3e; L5,F4=4.4 for %3d
#|"NASA-PDS/validate#816 Throw WARNING for unmatched field_format in table char" | "github816" | 5 | "1 errors expected, 4 warnings expected" | "FIELD_VALUE_FORMAT_PRECISION_MISMATCH,FIELD_VALUE_TOO_LONG,FIELD_VALUE_FORMAT_SPECIFIER_MISMATCH,FIELD_VALUE_DATA_TYPE_MISMATCH,FIELD_VALUE_FORMAT_SPECIFIER_MISMATCH" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github816a.json -s json -t {resourceDir}/github816/ff_char.xml" | "report_github816a.json" |
| "NASA-PDS/validate#816 Throw WARNING for unmatched field_format in delimited" | "github816" | 5 | "1 errors expected, 4 warnings expected" | "FIELD_VALUE_FORMAT_PRECISION_MISMATCH,FIELD_VALUE_TOO_LONG,FIELD_VALUE_FORMAT_SPECIFIER_MISMATCH,FIELD_VALUE_DATA_TYPE_MISMATCH" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github816b.json -s json -t {resourceDir}/github816/ff_del.xml" | "report_github816b.json" |
Expand All @@ -31,7 +34,7 @@ Feature: Running integration tests for validate module
| "NASA-PDS/validate#831 Success high instrument saturation" | "github831" | 0 | "0 errors expected" | "totalErrors" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github831.json -s json --skip-context-validation -t {resourceDir}/github831/kplo.xml" | "report_github831.json" |
# validate3.4.1 WARNs that 3 values are below min even though they match other constants
| "NASA-PDS/validate#831 Check specific constants before min or max constants" | "github831" | 0 | "0 errors expected" | "totalErrors" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github831.json -s json -t {resourceDir}/github831/kplo.xml" | "report_github831.json" |
# Validate#837
# Validate#837
| "NASA-PDS/validate#837 Success match out of format constants" | "github837" | 0 | "0 errors expected" | "totalErrors" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github837.json -s json --skip-context-validation -t {resourceDir}/github837/times_table.xml" | "report_github837.json" |
# someday line 3 in data (or line 88 of .xml) may reasonably throw an error for bad format
| "NASA-PDS/validate#837 Check constants before data_type" | "github837" | 0 | "0 errors expected" | "totalErrors" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github837.json -s json -t {resourceDir}/github837/x.xml" | "report_github837.json" |
Expand Down
Loading

0 comments on commit 3dde814

Please sign in to comment.