Skip to content

Commit

Permalink
add TestSetup
Browse files Browse the repository at this point in the history
  • Loading branch information
ReinerSchinkoethe committed Jun 17, 2024
1 parent 3276957 commit 0a2c701
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
9 changes: 7 additions & 2 deletions test/List/TestList.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ NAMESPACE Simatic.Ax.Collections
{TestFixture}
CLASS TestList
VAR PRIVATE
_list : LinkedList;
_list : LinkedList;
_listStateLess : LinkedList;
_i1 : ListItem;
_i2 : ListItem;
_i3 : ListItem;
Expand All @@ -15,7 +16,11 @@ NAMESPACE Simatic.Ax.Collections
_item : IListItem;
END_VAR


// This method will be called before each test method
{TestSetup}
METHOD PUBLIC MyTestSetup
_list := _listStateLess;
END_METHOD

{Test}
METHOD PUBLIC Test_Add_Expect_Item
Expand Down
11 changes: 8 additions & 3 deletions test/List/TestStack.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ NAMESPACE Simatic.Ax.Collections
{TestFixture}
CLASS TestStack
VAR PRIVATE
_stack : Stack;
_stack : Stack;
_stackStateLess : Stack;
_i1 : ListItem;
_i2 : ListItem;
_i3 : ListItem;
Expand All @@ -15,7 +16,11 @@ NAMESPACE Simatic.Ax.Collections
_item : IListItem;
END_VAR


// This method will be called before each test method
{TestSetup}
METHOD PUBLIC MyTestSetup
_stack := _stackStateLess;
END_METHOD

{Test}
METHOD PUBLIC Test_Add_Expect_Item
Expand All @@ -37,7 +42,7 @@ NAMESPACE Simatic.Ax.Collections
END_METHOD

{Test}
METHOD PUBLIC Test_Tail_Top_NULL
METHOD PUBLIC Test_Top_NULL
THIS.Test_Add_3_Elements();
Equal(_stack.Peek().NextItem() = NULL, TRUE);
END_METHOD
Expand Down

0 comments on commit 0a2c701

Please sign in to comment.