Skip to content

Commit

Permalink
Merge pull request #63 from simatic-ax/update_sdk
Browse files Browse the repository at this point in the history
Change to SDK V4
  • Loading branch information
sjuergen authored Jun 5, 2023
2 parents f3d9b55 + be2afea commit 68a62f1
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 3 deletions.
6 changes: 3 additions & 3 deletions apax.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@ targets:
- 'axunit-llvm'
# Dependencies
devDependencies:
"@ax/sdk": 3.0.18
"@ax/sdk": 4.0.2
"@simatic-ax/snippetscollection": 0.1.3
dependencies:
"@ax/system-strings": 4.2.3
"@simatic-ax/conversion": 3.1.2
"@ax/system-strings": 5.0.12
"@simatic-ax/conversion": 4.0.1
registries:
'@simatic-ax': 'https://npm.pkg.github.com/'
# Files which 'apax pack' will include
Expand Down
35 changes: 35 additions & 0 deletions test/Deserializer/TryParse/Test_TryParse.st
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,41 @@ CLASS TryParse
buffer : ARRAY[0..999] OF CHAR;
END_VAR

{Test}
Method Public Test_TryParse_Value_as_String
VAR
JSON_Entry: STRING := '{ "key1": "nestedkey1"}';
key: STRING := 'key1';
len:DINT;
keyFound: BOOL;
value: STRING;
END_VAR

len:= Strings.ToArray.OfCharCount(str := JSON_Entry, arr := buffer);
deserializer.buffer := REF(buffer);

keyFound := deserializer.TryParse( key, value);
Equal('nestedkey1', value);
END_Method

{Test}
Method Public Test_TryParse_Value_as_String2
VAR
JSON_Entry: STRING := '{"Name": "SIMATIC", data: {plc_type: 1518, OPC_SERVER_ENABLED: true}}';
key: STRING := 'Name';
len:DINT;
keyFound: BOOL;
value: STRING;
END_VAR
JSON_Entry:= '{"Name": "SIMATIC", data: {plc_type: 1518, OPC_SERVER_ENABLED: true}}';
key := 'Name';
len:= Strings.ToArray.OfCharCount(str := JSON_Entry, arr := buffer);
deserializer.buffer := REF(buffer);

keyFound := deserializer.TryParse( key, value);
Equal('SIMATIC', value);
END_Method

{Test}
Method Public Test_TryParse_String
VAR
Expand Down

0 comments on commit 68a62f1

Please sign in to comment.