From 0a2c701d300cba5bea3287b687c1d11fafaba3b0 Mon Sep 17 00:00:00 2001 From: Reiner Schinkoethe Date: Mon, 17 Jun 2024 14:21:49 +0200 Subject: [PATCH] add TestSetup --- test/List/TestList.st | 9 +++++++-- test/List/TestStack.st | 11 ++++++++--- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/test/List/TestList.st b/test/List/TestList.st index 03ac8ff..b906a98 100644 --- a/test/List/TestList.st +++ b/test/List/TestList.st @@ -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; @@ -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 diff --git a/test/List/TestStack.st b/test/List/TestStack.st index eaaa4be..dd898c7 100644 --- a/test/List/TestStack.st +++ b/test/List/TestStack.st @@ -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; @@ -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 @@ -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