diff --git a/src/main/java/gov/nasa/pds/tools/validate/content/table/FieldValueValidator.java b/src/main/java/gov/nasa/pds/tools/validate/content/table/FieldValueValidator.java index 04118d7d3..3ce2b0e2a 100644 --- a/src/main/java/gov/nasa/pds/tools/validate/content/table/FieldValueValidator.java +++ b/src/main/java/gov/nasa/pds/tools/validate/content/table/FieldValueValidator.java @@ -858,7 +858,7 @@ private void checkFormat(String value, String format, int fieldIndex, RecordLoca addTableProblem(asError ? ExceptionType.ERROR : ExceptionType.WARNING, asError ? ProblemType.FIELD_VALID_FORMAT_PRECISION_MISMATCH : ProblemType.FIELD_VALUE_FORMAT_PRECISION_MISMATCH, "The number of digits to the right of the decimal point " + "in the value '" - + value.trim() + "' must be <= the precision set in the defined field format '" + + value.trim() + "' should be <= the precision set in the defined field format '" + format+ "' (Expected: <=" + precision + ", Actual: " + actual_precision + ").", recordLocation, fieldIndex); } diff --git a/src/test/resources/features/developer.feature b/src/test/resources/features/developer.feature index d5c613744..7f421ade6 100644 --- a/src/test/resources/features/developer.feature +++ b/src/test/resources/features/developer.feature @@ -4,7 +4,7 @@ Scenario Outline: Execute validate command for tests below. Given a test at dir at resource sending report to with as arguments When with test property count text problem reference When execute a validate command - Then produced output from validate command should be similiar to reference or no error reported. + Then produced output from validate command should be similar to reference or no error reported. Examples: | testName | testDir | messageCount | messageText | problemEnum | resourceDir | reportDir | commandArgs | refOutputValue | @@ -44,7 +44,10 @@ Scenario Outline: Execute validate command for tests below. # Validate#681 |"NASA-PDS/validate#681 Success ASCII table with extra whitespace, valid precision" | "github681" | 0 | "0 errors expected" | "FIELD_VALUE_FORMAT_PRECISION_MISMATCH" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github681_1.json -s json -t {resourceDir}/github681/ff_char.xml {resourceDir}/github681/ff_del.xml" | "report_github681_1.json" | -|"NASA-PDS/validate#681 Failure of ASCII table invalid precision" | "github681" | 2 | "2 errors expected" | "FIELD_VALUE_FORMAT_PRECISION_MISMATCH" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github681_2.json -s json -t {resourceDir}/github681/ff_char_fail.xml {resourceDir}/github681/ff_del_fail.xml" | "report_github681_2.json" | +|"NASA-PDS/validate#681 Failure of ASCII table invalid precision" | "github681" | 2 | "2 warnings expected" | "FIELD_VALUE_FORMAT_PRECISION_MISMATCH" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github681_2.json -s json -t {resourceDir}/github681/ff_char_fail.xml {resourceDir}/github681/ff_del_fail.xml" | "report_github681_2.json" | + +# Validate#817 +|"NASA-PDS/validate#817 Failure of ASCII table invalid precision" | "github681" | 1 | "1 error expected" | "FIELD_VALID_FORMAT_PRECISION_MISMATCH" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github817_1.json -s json -t {resourceDir}/github681/ff_char_fail.xml" | "report_github817_1.json" | # Validate#680 |"NASA-PDS/validate#680 Success char table correct length" | "github680" | 0 | "0 errors expected" | "totalErrors" | "src/test/resources" | "target/test" | "-r {reportDir}/report_github680.1.json -s json --skip-context-validation -t {resourceDir}/github680/ORB12_EUR_EPHIO_reclen96.xml" | "report_github680.1.json" | diff --git a/src/test/resources/github681/ff_char_fail.xml b/src/test/resources/github681/ff_char_fail.xml index 3854b0bfd..e021f1490 100644 --- a/src/test/resources/github681/ff_char_fail.xml +++ b/src/test/resources/github681/ff_char_fail.xml @@ -59,6 +59,7 @@ ASCII_Real 4 %4.2f + %4.2f field 3 diff --git a/src/test/resources/github681/ff_char_warn.xml b/src/test/resources/github681/ff_char_warn.xml new file mode 100644 index 000000000..3854b0bfd --- /dev/null +++ b/src/test/resources/github681/ff_char_warn.xml @@ -0,0 +1,74 @@ + + + + + urn:nasa:pds:bundle:collection:ff_char_test + 1.0 + Field Format Character Test + 1.20.0.0 + Product_Observational + + + + 2023Z + 2023Z + + + None + Other Investigation + + urn:nasa:pds:context:investigation:individual.none + data_to_investigation + + + + + telescope + Instrument + + + + target + Comet + + + + + ff_test_fail.csv + + + 0 + 3 + Carriage-Return Line-Feed + + 3 + 0 + 22 + + field 1 + 1 + 1 + ASCII_Real + 6 + %6.2f + + + field 2 + 2 + 8 + ASCII_Real + 4 + %4.2f + + + field 3 + 3 + 13 + ASCII_Real + 8 + %8.3e + + + + + diff --git a/src/test/resources/github681/ff_del_fail.xml b/src/test/resources/github681/ff_del_warn.xml similarity index 100% rename from src/test/resources/github681/ff_del_fail.xml rename to src/test/resources/github681/ff_del_warn.xml