diff --git a/test/JPP_TestUsecases.csv b/test/JPP_TestUsecases.csv index 33d21733..7cf98445 100644 --- a/test/JPP_TestUsecases.csv +++ b/test/JPP_TestUsecases.csv @@ -8,6 +8,7 @@ JPP_0005|DATA_TYPES|GOODCASE|JSON file with string values containing dollar oper JPP_0100|DATA_INTEGRITY|GOODCASE|JSON file is empty (single pair of brackets only) JPP_0101|DATA_INTEGRITY|GOODCASE|JSON file with string containing several separator characters and blanks; no parameters JPP_0102|DATA_INTEGRITY|GOODCASE|JSON file with string containing more special characters, masked special characters and escape sequences +JPP_0103|DATA_INTEGRITY|GOODCASE|JSON file with strings containing several pairs of square brackets (that must not cause syntax issues!) JPP_0200|PARAMETER_SUBSTITUTION|GOODCASE|JSON file with nested parameter / string parameter substitution in parameter value JPP_0201|PARAMETER_SUBSTITUTION|GOODCASE|JSON file with nested parameter / string parameter substitution in parameter name JPP_0202|PARAMETER_SUBSTITUTION|GOODCASE|JSON file with nested parameter / index parameter substitution in parameter name / standard notation @@ -79,7 +80,7 @@ JPP_0512|COMPOSITE_EXPRESSIONS|GOODCASE|JSON file containing a nested use of lis JPP_0513|COMPOSITE_EXPRESSIONS|GOODCASE|JSON file containing several square bracket expressions (as list index and dictionary key) with and without single quotes JPP_0514|COMPOSITE_EXPRESSIONS|GOODCASE|JSON file containing nested dollar operator expressions JPP_0515|COMPOSITE_EXPRESSIONS|GOODCASE|JSON file containing nested dollar operator expressions -JPP_0516|COMPOSITE_EXPRESSIONS|GOODCASE|JSON file containing string expressions with additional curly brackets and dollar characters (that must not cause syntax issues!) +JPP_0516|COMPOSITE_EXPRESSIONS|GOODCASE|JSON file containing string expressions with additional brackets and dollar characters (that must not cause syntax issues!) JPP_0550|COMPOSITE_EXPRESSIONS|BADCASE|JSON file with composite data structure (nested lists and dictionaries / some key names with dots inside) JPP_0551|COMPOSITE_EXPRESSIONS|BADCASE|JSON file containing a list; list index is defined by a parameter and wrapped in single quotes JPP_0552|COMPOSITE_EXPRESSIONS|BADCASE|JSON file containing a list; list index is defined by a parameter and placed inside the curly brackets (invalid syntax) diff --git a/test/JPP_TestUsecases.html b/test/JPP_TestUsecases.html index 940fe1ce..509b7049 100644 --- a/test/JPP_TestUsecases.html +++ b/test/JPP_TestUsecases.html @@ -298,6 +298,39 @@ 9 + + + +JPP_0103 + + + + +DATA_INTEGRITY + + + + +GOODCASE + + + + +JSON file with strings containing several pairs of square brackets (that must not cause syntax issues!)
+Expected: Strings are returned unchanged + + +
+ + + + + + + +10 + + @@ -328,7 +361,7 @@ -10 +11 @@ -361,7 +394,7 @@ -11 +12 @@ -394,7 +427,7 @@ -12 +13 @@ -427,7 +460,7 @@ -13 +14 @@ -460,7 +493,7 @@ -14 +15 @@ -493,7 +526,7 @@ -15 +16 @@ -526,7 +559,7 @@ -16 +17 @@ -559,7 +592,7 @@ -17 +18 @@ -592,7 +625,7 @@ -18 +19 @@ -625,7 +658,7 @@ -19 +20 @@ -658,7 +691,7 @@ -20 +21 @@ -691,7 +724,7 @@ -21 +22 @@ -724,7 +757,7 @@ -22 +23 @@ -757,7 +790,7 @@ -23 +24 @@ -790,7 +823,7 @@ -24 +25 @@ -823,7 +856,7 @@ -25 +26 @@ -856,7 +889,7 @@ -26 +27 @@ -889,7 +922,7 @@ -27 +28 @@ -922,7 +955,7 @@ -28 +29 @@ -955,7 +988,7 @@ -29 +30 @@ -988,7 +1021,7 @@ -30 +31 @@ -1021,7 +1054,7 @@ -31 +32 @@ -1054,7 +1087,7 @@ -32 +33 @@ -1087,7 +1120,7 @@ -33 +34 @@ -1120,7 +1153,7 @@ -34 +35 @@ -1153,7 +1186,7 @@ -35 +36 @@ -1186,7 +1219,7 @@ -36 +37 @@ -1219,7 +1252,7 @@ -37 +38 @@ -1253,7 +1286,7 @@ -38 +39 @@ -1287,7 +1320,7 @@ -39 +40 @@ -1321,7 +1354,7 @@ -40 +41 @@ -1355,7 +1388,7 @@ -41 +42 @@ -1389,7 +1422,7 @@ -42 +43 @@ -1423,7 +1456,7 @@ -43 +44 @@ -1457,7 +1490,7 @@ -44 +45 @@ -1491,7 +1524,7 @@ -45 +46 @@ -1525,7 +1558,7 @@ -46 +47 @@ -1559,7 +1592,7 @@ -47 +48 @@ -1593,7 +1626,7 @@ -48 +49 @@ -1627,7 +1660,7 @@ -49 +50 @@ -1661,7 +1694,7 @@ -50 +51 @@ -1695,7 +1728,7 @@ -51 +52 @@ -1729,7 +1762,7 @@ -52 +53 @@ -1763,7 +1796,7 @@ -53 +54 @@ -1797,7 +1830,7 @@ -54 +55 @@ -1831,7 +1864,7 @@ -55 +56 @@ -1865,7 +1898,7 @@ -56 +57 @@ -1899,7 +1932,7 @@ -57 +58 @@ -1933,7 +1966,7 @@ -58 +59 @@ -1967,7 +2000,7 @@ -59 +60 @@ -2001,7 +2034,7 @@ -60 +61 @@ -2035,7 +2068,7 @@ -61 +62 @@ -2069,7 +2102,7 @@ -62 +63 @@ -2103,7 +2136,7 @@ -63 +64 @@ -2137,7 +2170,7 @@ -64 +65 @@ -2171,7 +2204,7 @@ -65 +66 @@ -2205,7 +2238,7 @@ -66 +67 @@ -2239,7 +2272,7 @@ -67 +68 @@ -2273,7 +2306,7 @@ -68 +69 @@ -2306,7 +2339,7 @@ -69 +70 @@ -2339,7 +2372,7 @@ -70 +71 @@ -2372,7 +2405,7 @@ -71 +72 @@ -2405,7 +2438,7 @@ -72 +73 @@ -2438,7 +2471,7 @@ -73 +74 @@ -2471,7 +2504,7 @@ -74 +75 @@ -2504,7 +2537,7 @@ -75 +76 @@ -2537,7 +2570,7 @@ -76 +77 @@ -2570,7 +2603,7 @@ -77 +78 @@ -2603,7 +2636,7 @@ -78 +79 @@ -2636,7 +2669,7 @@ -79 +80 @@ -2669,7 +2702,7 @@ -80 +81 @@ -2690,7 +2723,7 @@ -JSON file containing string expressions with additional curly brackets and dollar characters (that must not cause syntax issues!)
+JSON file containing string expressions with additional brackets and dollar characters (that must not cause syntax issues!)
Expected: JsonPreprocessor returns expected value @@ -2702,7 +2735,7 @@ -81 +82 @@ -2736,7 +2769,7 @@ -82 +83 @@ -2770,7 +2803,7 @@ -83 +84 @@ -2803,7 +2836,7 @@ -84 +85 @@ -2836,7 +2869,7 @@ -85 +86 @@ -2869,7 +2902,7 @@ -86 +87 @@ -2902,7 +2935,7 @@ -87 +88 @@ -2935,7 +2968,7 @@ -88 +89 @@ -2968,7 +3001,7 @@ -89 +90 @@ -3001,7 +3034,7 @@ -90 +91 @@ -3034,7 +3067,7 @@ -91 +92 @@ -3067,7 +3100,7 @@ -92 +93 @@ -3100,7 +3133,7 @@ -93 +94 @@ -3133,7 +3166,7 @@ -94 +95 @@ -3166,7 +3199,7 @@ -95 +96 @@ -3199,7 +3232,7 @@ -96 +97 @@ -3232,7 +3265,7 @@ -97 +98 @@ -3265,7 +3298,7 @@ -98 +99 @@ -3298,7 +3331,7 @@ -99 +100 @@ -3331,7 +3364,7 @@ -100 +101 @@ -3364,7 +3397,7 @@ -101 +102 @@ -3397,7 +3430,7 @@ -102 +103 @@ -3430,7 +3463,7 @@ -103 +104 @@ -3463,7 +3496,7 @@ -104 +105 @@ -3496,7 +3529,7 @@ -105 +106 @@ -3529,7 +3562,7 @@ -106 +107 @@ -3562,7 +3595,7 @@ -107 +108 @@ -3595,7 +3628,7 @@ -108 +109 @@ -3629,7 +3662,7 @@
 

-
Generated: 14.03.2024 - 15:46:24
+
Generated: 15.03.2024 - 18:49:00
 
diff --git a/test/JPP_TestUsecases.rst b/test/JPP_TestUsecases.rst index 49398c3b..f9d927f7 100644 --- a/test/JPP_TestUsecases.rst +++ b/test/JPP_TestUsecases.rst @@ -95,6 +95,16 @@ Test Use Cases ---- +* **Test JPP_0103** + + [DATA_INTEGRITY / GOODCASE] + + **JSON file with strings containing several pairs of square brackets (that must not cause syntax issues!)** + + Expected: Strings are returned unchanged + +---- + * **Test JPP_0200** [PARAMETER_SUBSTITUTION / GOODCASE] @@ -871,7 +881,7 @@ Test Use Cases [COMPOSITE_EXPRESSIONS / GOODCASE] - **JSON file containing string expressions with additional curly brackets and dollar characters (that must not cause syntax issues!)** + **JSON file containing string expressions with additional brackets and dollar characters (that must not cause syntax issues!)** Expected: JsonPreprocessor returns expected value @@ -1163,5 +1173,5 @@ Test Use Cases ---- -Generated: 14.03.2024 - 15:46:24 +Generated: 15.03.2024 - 18:49:00 diff --git a/test/JPP_TestUsecases.txt b/test/JPP_TestUsecases.txt index 3015ab33..2287b394 100644 --- a/test/JPP_TestUsecases.txt +++ b/test/JPP_TestUsecases.txt @@ -47,6 +47,10 @@ Test JPP_0102 / DATA_INTEGRITY / GOODCASE Description: JSON file with string containing more special characters, masked special characters and escape sequences Expectation: String is returned unchanged (but with masked special characters and escape sequences resolved) ------------------------------------------------------------------------------------------------------------------------ +Test JPP_0103 / DATA_INTEGRITY / GOODCASE +Description: JSON file with strings containing several pairs of square brackets (that must not cause syntax issues!) +Expectation: Strings are returned unchanged +------------------------------------------------------------------------------------------------------------------------ Test JPP_0200 / PARAMETER_SUBSTITUTION / GOODCASE Description: JSON file with nested parameter / string parameter substitution in parameter value Expectation: JsonPreprocessor creates a new string with all dollar operator expressions resolved as string @@ -363,7 +367,7 @@ Description: JSON file containing nested dollar operator expressions Expectation: JsonPreprocessor returns expected value ------------------------------------------------------------------------------------------------------------------------ Test JPP_0516 / COMPOSITE_EXPRESSIONS / GOODCASE -Description: JSON file containing string expressions with additional curly brackets and dollar characters (that must not cause syntax issues!) +Description: JSON file containing string expressions with additional brackets and dollar characters (that must not cause syntax issues!) Expectation: JsonPreprocessor returns expected value ------------------------------------------------------------------------------------------------------------------------ Test JPP_0550 / COMPOSITE_EXPRESSIONS / BADCASE @@ -481,5 +485,5 @@ Description: Relative path to JSON file Expectation: JsonPreprocessor resolves the relative path and returns values from JSON file Hint.......: Works with raw path to JSON file (path not normalized internally) ------------------------------------------------------------------------------------------------------------------------ -Generated: 14.03.2024 - 15:46:24 +Generated: 15.03.2024 - 18:49:00 diff --git a/test/component_test.py b/test/component_test.py index cedf4cc5..409e36d5 100644 --- a/test/component_test.py +++ b/test/component_test.py @@ -22,8 +22,8 @@ # # -------------------------------------------------------------------------------------------------------------- # -VERSION = "0.29.0" -VERSION_DATE = "14.03.2024" +VERSION = "0.30.0" +VERSION_DATE = "15.03.2024" # # -------------------------------------------------------------------------------------------------------------- #TM*** diff --git a/test/pytest/pytestfiles/test_02_DATA_INTEGRITY_GOODCASE.py b/test/pytest/pytestfiles/test_02_DATA_INTEGRITY_GOODCASE.py index 58ee45a0..be06d44e 100644 --- a/test/pytest/pytestfiles/test_02_DATA_INTEGRITY_GOODCASE.py +++ b/test/pytest/pytestfiles/test_02_DATA_INTEGRITY_GOODCASE.py @@ -18,7 +18,7 @@ # # XC-CT/ECA3-Queckenstedt # -# 10.10.2023 - 13:31:11 +# 15.03.2024 - 18:49:01 # # -------------------------------------------------------------------------------------------------------------- @@ -53,4 +53,12 @@ def test_JPP_0101(self, Description): def test_JPP_0102(self, Description): nReturn = CExecute.Execute("JPP_0102") assert nReturn == 0 +# -------------------------------------------------------------------------------------------------------------- + # Expected: Strings are returned unchanged + @pytest.mark.parametrize( + "Description", ["JSON file with strings containing several pairs of square brackets (that must not cause syntax issues!)",] + ) + def test_JPP_0103(self, Description): + nReturn = CExecute.Execute("JPP_0103") + assert nReturn == 0 # -------------------------------------------------------------------------------------------------------------- diff --git a/test/pytest/pytestfiles/test_07_COMPOSITE_EXPRESSIONS_GOODCASE.py b/test/pytest/pytestfiles/test_07_COMPOSITE_EXPRESSIONS_GOODCASE.py index 7f7e18bc..4c3f7587 100644 --- a/test/pytest/pytestfiles/test_07_COMPOSITE_EXPRESSIONS_GOODCASE.py +++ b/test/pytest/pytestfiles/test_07_COMPOSITE_EXPRESSIONS_GOODCASE.py @@ -18,7 +18,7 @@ # # XC-CT/ECA3-Queckenstedt # -# 07.03.2024 - 14:58:30 +# 15.03.2024 - 18:49:01 # # -------------------------------------------------------------------------------------------------------------- @@ -152,7 +152,7 @@ def test_JPP_0515(self, Description): # -------------------------------------------------------------------------------------------------------------- # Expected: JsonPreprocessor returns expected value @pytest.mark.parametrize( - "Description", ["JSON file containing string expressions with additional curly brackets and dollar characters (that must not cause syntax issues!)",] + "Description", ["JSON file containing string expressions with additional brackets and dollar characters (that must not cause syntax issues!)",] ) def test_JPP_0516(self, Description): nReturn = CExecute.Execute("JPP_0516") diff --git a/test/testconfig/TestConfig.py b/test/testconfig/TestConfig.py index e85beba6..5e0bb16a 100644 --- a/test/testconfig/TestConfig.py +++ b/test/testconfig/TestConfig.py @@ -22,7 +22,7 @@ # # -------------------------------------------------------------------------------------------------------------- # -# 14.03.2024 +# 15.03.2024 # # !!! Temporarily tests are deactivated by the following line commented out: # # # listofdictUsecases.append(dictUsecase) @@ -599,6 +599,28 @@ listofdictUsecases.append(dictUsecase) del dictUsecase # -------------------------------------------------------------------------------------------------------------- +dictUsecase = {} +dictUsecase['TESTID'] = "JPP_0103" +dictUsecase['DESCRIPTION'] = "JSON file with strings containing several pairs of square brackets (that must not cause syntax issues!)" +dictUsecase['EXPECTATION'] = "Strings are returned unchanged" +dictUsecase['SECTION'] = "DATA_INTEGRITY" +dictUsecase['SUBSECTION'] = "GOODCASE" +dictUsecase['HINT'] = None +dictUsecase['COMMENT'] = None +dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_0103.jsonp" +dictUsecase['EXPECTEDEXCEPTION'] = None +dictUsecase['EXPECTEDRETURN'] = """ +[DICT] (7/1) > {param} [STR] : 'value' +[DICT] (7/2) > {param1} [STR] : 'Empty bracket []' +[DICT] (7/3) > {param2} [STR] : 'Spaced bracket [ ]' +[DICT] (7/4) > {param3} [STR] : 'Filled bracket [selftest]' +[DICT] (7/5) > {param4} [STR] : '{Filled bracket after string}[selftest]' +[DICT] (7/6) > {param5} [STR] : 'Filled bracket with spaces [self test]' +[DICT] (7/7) > {param6} [STR] : 'Bracket with parameter [value]' +""" +listofdictUsecases.append(dictUsecase) +del dictUsecase +# -------------------------------------------------------------------------------------------------------------- # -------------------------------------------------------------------------------------------------------------- dictUsecase = {} dictUsecase['TESTID'] = "JPP_0200" @@ -2123,7 +2145,7 @@ # -------------------------------------------------------------------------------------------------------------- dictUsecase = {} dictUsecase['TESTID'] = "JPP_0516" -dictUsecase['DESCRIPTION'] = "JSON file containing string expressions with additional curly brackets and dollar characters (that must not cause syntax issues!)" +dictUsecase['DESCRIPTION'] = "JSON file containing string expressions with additional brackets and dollar characters (that must not cause syntax issues!)" dictUsecase['EXPECTATION'] = "JsonPreprocessor returns expected value" dictUsecase['SECTION'] = "COMPOSITE_EXPRESSIONS" dictUsecase['SUBSECTION'] = "GOODCASE" @@ -2132,17 +2154,18 @@ dictUsecase['JSONFILE'] = r"..\testfiles\jpp-test_config_0516.jsonp" dictUsecase['EXPECTEDEXCEPTION'] = None dictUsecase['EXPECTEDRETURN'] = """ -[DICT] (9/1) > {listparam} [LIST] (3/1) > [STR] : 'A' -[DICT] (9/1) > {listparam} [LIST] (3/2) > [STR] : 'B' -[DICT] (9/1) > {listparam} [LIST] (3/3) > [STR] : 'C' -[DICT] (9/2) > {param_1} [STR] : '}A{' -[DICT] (9/3) > {param_2} [STR] : '{A}' -[DICT] (9/4) > {param_3} [STR] : '$}A$}' -[DICT] (9/5) > {param_4} [STR] : '{$}A{$}' -[DICT] (9/6) > {param_5} [STR] : '}{$}A{$}{' -[DICT] (9/7) > {param_6} [STR] : '{}{$}A{$}{}' -[DICT] (9/8) > {param_7} [STR] : '{}A{$}B{$}C{}' -[DICT] (9/9) > {param_8} [STR] : '{}$A{$$}$B{$$}$C{}' +[DICT] (10/1) > {listparam} [LIST] (3/1) > [STR] : 'A' +[DICT] (10/1) > {listparam} [LIST] (3/2) > [STR] : 'B' +[DICT] (10/1) > {listparam} [LIST] (3/3) > [STR] : 'C' +[DICT] (10/2) > {param_01} [STR] : '}A{' +[DICT] (10/3) > {param_02} [STR] : '{A}' +[DICT] (10/4) > {param_03} [STR] : '$}A$}' +[DICT] (10/5) > {param_04} [STR] : '{$}A{$}' +[DICT] (10/6) > {param_05} [STR] : '}{$}A{$}{' +[DICT] (10/7) > {param_06} [STR] : '{}{$}A{$}{}' +[DICT] (10/8) > {param_07} [STR] : '{}A{$}B{$}C{}' +[DICT] (10/9) > {param_08} [STR] : '{}$A{$$}$B{$$}$C{}' +[DICT] (10/10) > {param_09} [STR] : '{[}$A]{$[$}$B}{$$}$C{}()' """ listofdictUsecases.append(dictUsecase) del dictUsecase diff --git a/test/testfiles/jpp-test_config_0103.jsonp b/test/testfiles/jpp-test_config_0103.jsonp new file mode 100644 index 00000000..6f364042 --- /dev/null +++ b/test/testfiles/jpp-test_config_0103.jsonp @@ -0,0 +1,24 @@ +// Copyright 2020-2023 Robert Bosch GmbH +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. +//************************************************************************** +{ + "param" : "value", + // + "param1" : "Empty bracket []", + "param2" : "Spaced bracket [ ]", + "param3" : "Filled bracket [selftest]", + "param4" : "{Filled bracket after string}[selftest]", + "param5" : "Filled bracket with spaces [self test]", + "param6" : "Bracket with parameter [${param}]" +} \ No newline at end of file diff --git a/test/testfiles/jpp-test_config_0516.jsonp b/test/testfiles/jpp-test_config_0516.jsonp index 7ce4a176..b08ee576 100644 --- a/test/testfiles/jpp-test_config_0516.jsonp +++ b/test/testfiles/jpp-test_config_0516.jsonp @@ -14,13 +14,14 @@ //************************************************************************** { "listparam" : ["A","B","C"], - "param_1" : "}${listparam}[0]{", - "param_2" : "{${listparam}[0]}", - "param_3" : "$}${listparam}[0]$}", - "param_4" : "{$}${listparam}[0]{$}", - "param_5" : "}{$}${listparam}[0]{$}{", - "param_6" : "{}{$}${listparam}[0]{$}{}", - "param_7" : "{}${listparam}[0]{$}${listparam}[1]{$}${listparam}[2]{}", - "param_8" : "{}$${listparam}[0]{$$}$${listparam}[1]{$$}$${listparam}[2]{}" + "param_01" : "}${listparam}[0]{", + "param_02" : "{${listparam}[0]}", + "param_03" : "$}${listparam}[0]$}", + "param_04" : "{$}${listparam}[0]{$}", + "param_05" : "}{$}${listparam}[0]{$}{", + "param_06" : "{}{$}${listparam}[0]{$}{}", + "param_07" : "{}${listparam}[0]{$}${listparam}[1]{$}${listparam}[2]{}", + "param_08" : "{}$${listparam}[0]{$$}$${listparam}[1]{$$}$${listparam}[2]{}", + "param_09" : "{[}$${listparam}[0]]{$[$}$${listparam}[1]}{$$}$${listparam}[2]{}()" } diff --git a/test/testtools/GenSnippetsJPP.py b/test/testtools/GenSnippetsJPP.py index ffc97e8f..4acba43f 100644 --- a/test/testtools/GenSnippetsJPP.py +++ b/test/testtools/GenSnippetsJPP.py @@ -22,8 +22,8 @@ # # ************************************************************************************************************** # -VERSION = "0.11.0" -VERSION_DATE = "14.03.2024" +VERSION = "0.12.0" +VERSION_DATE = "15.03.2024" # # ************************************************************************************************************** @@ -1177,6 +1177,11 @@ def GetSeveralParticularSnippets(self): listCodeSnippets.append("""{ "param" : "Hello filled bracket [selftest]" } +""") + + listCodeSnippets.append("""{ +"param" : "{Hello filled bracket after string}[selftest]" +} """) listCodeSnippets.append("""{