Skip to content

Commit

Permalink
reset flat document
Browse files Browse the repository at this point in the history
  • Loading branch information
sjuergen committed Feb 13, 2024
1 parent 26fc4c8 commit 54864d4
Showing 1 changed file with 5 additions and 12 deletions.
17 changes: 5 additions & 12 deletions test/Document/TestResetFlatDocument.st
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ USING Simatic.Ax.Conversion;
USING Simatic.Ax.Json;

NAMESPACE Document

{TestFixture}
CLASS TestResetFlatDocument

VAR PROTECTED
e1 : JsonDInt := (Value := 999, Key := 'e1');
e2 : JsonBoolean := (Key := 'e2', Value := TRUE);
Expand All @@ -15,32 +15,26 @@ NAMESPACE Document
oi1 : JsonSInt := (Key := 'oi1', Value := SINT#1);
oi2 : JsonSInt := (Key := 'oi2', Value := SINT#1);
e4 : JsonLInt := (Key := 'e4', Value := LINT#1);


doc : JsonDocument;
cmpBuff : ARRAY[0..399] OF CHAR;
cmpBuffEmpty : ARRAY[0..399] OF CHAR;
len : DINT;
END_VAR

{Test}
METHOD PUBLIC Reset_flat_document_removes_all_next_elements_from_the_json_objects
VAR_TEMP
_to : IJsonElementMuteable;
_elem : IJsonElement;
_elem : IJsonElement;
END_VAR

doc.AddElement(e1);
doc.AddElement(e2);
doc.AddElement(e3);
doc.AddElement(o1);
doc.AddElement(e4);
o1.AddElement(oi1);
o1.AddElement(oi2);


doc.Reset();

Equal(expected := FALSE, actual := e1.HasNext());
Equal(expected := FALSE, actual := e2.HasNext());
Equal(expected := FALSE, actual := e3.HasNext());
Expand All @@ -50,8 +44,7 @@ NAMESPACE Document
Equal(expected := FALSE, actual := oi2.HasNext());
Equal(expected := TRUE, actual := doc.GetRootElement() = NULL);
Equal(expected := DINT#0, actual := doc.GetLength());

END_METHOD

END_CLASS
END_NAMESPACE

END_NAMESPACE

0 comments on commit 54864d4

Please sign in to comment.