Skip to content

Commit

Permalink
feat!: achieve TIAX compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
sjuergen committed Oct 21, 2022
1 parent b98acbb commit 1b04aac
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 38 deletions.
7 changes: 0 additions & 7 deletions src/Document/Deserializer.st
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,6 @@ NAMESPACE Simatic.Ax.Json
VAR PUBLIC
buffer : REF_TO ARRAY[*] OF CHAR;
END_VAR
//Temp method until ref_to array* possible
METHOD PUBLIC SetBuffer
VAR_INPUT
_buffer : REF_TO ARRAY[*] OF CHAR;
END_VAR
buffer := _buffer;
END_METHOD
METHOD PRIVATE KeyIsInIndexSpan : BOOL
VAR_INPUT
key : STRING;
Expand Down
6 changes: 3 additions & 3 deletions test/Deserializer/GetValues/Test_GetValues_Arrays.st
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CLASS Test_Deserializer_GetValues_Arrays
END_VAR

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

key := 'arraykey';
keyFound := deserializer.TryParse( key, value);
Expand All @@ -44,7 +44,7 @@ CLASS Test_Deserializer_GetValues_Arrays
END_VAR

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

key := 'arraykey';
keyFound := deserializer.TryParse( key, value);
Expand All @@ -61,7 +61,7 @@ CLASS Test_Deserializer_GetValues_Arrays
END_VAR

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

key := 'arraykey';
keyFound := deserializer.TryParse( key, value);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CLASS Test_Deserializer_GetValues_BasicDataTypes
END_VAR

len:= Strings.ToArray.OfCharCount(str := JSON_Entry, arr := buffer);
deserializer.SetBuffer(REF(buffer)); //TODO: ausbauen und ersetzen durch buffer in methode
deserializer.buffer := REF(buffer);

key := 'key';
keyFound := deserializer.TryParse( key, value);
Expand Down
10 changes: 5 additions & 5 deletions test/Deserializer/GetValues/Test_GetValues_NestedElements.st
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ CLASS Test_Deserializer_GetValues_NestedElements
END_VAR

len:= Strings.ToArray.OfCharCount(str := JSON_Entry, arr := buffer);
deserializer.SetBuffer(REF(buffer)); //TODO: ausbauen und ersetzen durch buffer in methode
deserializer.buffer := REF(buffer);

key := 'arraykey';
keyFound := deserializer.TryParse( key, value);
Expand All @@ -44,7 +44,7 @@ CLASS Test_Deserializer_GetValues_NestedElements
END_VAR

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

key := 'key';
keyFound := deserializer.TryParse( key, value);
Expand All @@ -66,7 +66,7 @@ CLASS Test_Deserializer_GetValues_NestedElements
END_VAR

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

key := 'key';
keyFound := deserializer.TryParse( key, value);
Expand All @@ -88,7 +88,7 @@ CLASS Test_Deserializer_GetValues_NestedElements
END_VAR

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

key := 'key';
keyFound := deserializer.TryParse( key, value);
Expand All @@ -110,7 +110,7 @@ CLASS Test_Deserializer_GetValues_NestedElements
END_VAR

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

key := 'key';
keyFound := deserializer.TryParse( key, value);
Expand Down
8 changes: 4 additions & 4 deletions test/Deserializer/TestFindKeyInBuffer.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CLASS Test_FindKeyInBuffer
END_VAR

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

key := 'key ';
keyFound := deserializer.TryParse( key, value);
Expand All @@ -58,7 +58,7 @@ CLASS Test_FindKeyInBuffer
END_VAR

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

key := 'nested';
keyFound := deserializer.TryParse( key, value);
Expand All @@ -77,7 +77,7 @@ CLASS Test_FindKeyInBuffer
END_VAR

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

key := 'key ';
keyFound := deserializer.TryParse( key, value);
Expand All @@ -104,7 +104,7 @@ CLASS Test_FindKeyInBuffer
END_VAR

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

key := 'simpleArray';
keyFound := deserializer.TryParse( key, value);
Expand Down
36 changes: 18 additions & 18 deletions test/Deserializer/TryParse/Test_TryParse.st
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ CLASS TryParse
END_VAR

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

keyFound := deserializer.TryParse( key, value);
Equal('{"nestedkey1": 123}', value);
Expand All @@ -41,7 +41,7 @@ CLASS TryParse
END_VAR

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

keyFound := deserializer.TryParse( keyArray, value);
Equal('123', value);
Expand All @@ -58,7 +58,7 @@ CLASS TryParse
END_VAR

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

key:= 'leftBoundary';
keyFound := deserializer.TryParse( key, value);
Expand Down Expand Up @@ -90,7 +90,7 @@ CLASS TryParse
END_VAR

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

keyFound := deserializer.TryParse( keyArray, value);
Equal(123, value);
Expand All @@ -107,7 +107,7 @@ CLASS TryParse
END_VAR

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

keyFound := deserializer.TryParse( key, value);
Equal(-128, value);
Expand All @@ -124,7 +124,7 @@ CLASS TryParse
END_VAR

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

keyFound := deserializer.TryParse( keyArray, value);
Equal(123, value);
Expand All @@ -141,7 +141,7 @@ CLASS TryParse
END_VAR

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

keyFound := deserializer.TryParse( key, value);
Equal(1234, value);
Expand All @@ -158,7 +158,7 @@ CLASS TryParse
END_VAR

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

keyFound := deserializer.TryParse( keyArray, value);
Equal(123, value);
Expand All @@ -175,7 +175,7 @@ CLASS TryParse
END_VAR

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

keyFound := deserializer.TryParse( key, value);
Equal(1234, value);
Expand All @@ -192,7 +192,7 @@ CLASS TryParse
END_VAR

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

keyFound := deserializer.TryParse( keyArray, value);
Equal(123, value);
Expand All @@ -209,7 +209,7 @@ CLASS TryParse
END_VAR

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

keyFound := deserializer.TryParse( key, value);
Equal(USINT#123, value);
Expand All @@ -226,7 +226,7 @@ CLASS TryParse
END_VAR

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

keyFound := deserializer.TryParse( keyArray, value);
Equal(123, value);
Expand All @@ -243,7 +243,7 @@ CLASS TryParse
END_VAR

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

keyFound := deserializer.TryParse( key, value);
Equal(UINT#1234, value);
Expand All @@ -260,7 +260,7 @@ CLASS TryParse
END_VAR

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

keyFound := deserializer.TryParse( keyArray, value);
Equal(UINT#123, value);
Expand All @@ -277,7 +277,7 @@ CLASS TryParse
END_VAR

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

keyFound := deserializer.TryParse( key, value);
Equal(UDINT#1234, value);
Expand All @@ -294,7 +294,7 @@ CLASS TryParse
END_VAR

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

keyFound := deserializer.TryParse( keyArray, value);
Equal(UDINT#123, value);
Expand All @@ -311,7 +311,7 @@ CLASS TryParse
END_VAR

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

keyFound := deserializer.TryParse( key, value);
Equal(ULINT#1234, value);
Expand All @@ -328,7 +328,7 @@ CLASS TryParse
END_VAR

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

keyFound := deserializer.TryParse( keyArray, value);
Equal(ULINT#123, value);
Expand Down

0 comments on commit 1b04aac

Please sign in to comment.