diff --git a/apax.yml b/apax.yml index 7abdc4c..644323c 100644 --- a/apax.yml +++ b/apax.yml @@ -28,7 +28,7 @@ scripts: - apax load # Dependencies devDependencies: - "@ax/sdk": 3.0.12 + "@ax/sdk": 3.0.18 "@simatic-ax/snippetscollection": 0.0.15 dependencies: "@simatic-ax/statemachine": 2.1.1 diff --git a/test/TestStateGreen.st b/test/TestStateGreen.st new file mode 100644 index 0000000..812e93d --- /dev/null +++ b/test/TestStateGreen.st @@ -0,0 +1,50 @@ +USING Simatic.Ax.IO.Output; +USING Simatic.Ax.IO.Input; +USING Simatic.Ax.SimpleControlModules; +USING ApplicationStateFramwerok; +USING AxUnit; + +NAMESPACE MyTest + + {TestFixture} + CLASS TestStateGreen + VAR PUBLIC + state : StateGreen; + ls : LightStackRdYeGnBl; + qRd : BinOutput; + qYe : BinOutput; + qGn : BinOutput; + qBl : BinOutput; + END_VAR + + METHOD PROTECTED Setup + state.LightStack := REF(ls); + ls.QBlue := qBl; + ls.QGreen := qGn; + ls.QRed := qRd; + ls.QYellow := qYe; + END_METHOD + + {Test} + METHOD PUBLIC OnEntry_SwitchOnGreenLamp + THIS.Setup(); + state.OnEntry(); + Assert.Equal(actual := ls.GetState(Colors#Red), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Yellow), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Green), expected := TRUE); + Assert.Equal(actual := ls.GetState(Colors#Blue), expected := FALSE); + END_METHOD + + {Test} + METHOD PUBLIC OnEntry_SwitchOffGreenLamp + THIS.OnEntry_SwitchOnGreenLamp(); + state.OnExit(); + Assert.Equal(actual := ls.GetState(Colors#Red), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Yellow), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Green), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Blue), expected := FALSE); + END_METHOD + END_CLASS + +END_NAMESPACE + diff --git a/test/TestStateRed.st b/test/TestStateRed.st new file mode 100644 index 0000000..b7df4b8 --- /dev/null +++ b/test/TestStateRed.st @@ -0,0 +1,50 @@ +USING Simatic.Ax.IO.Output; +USING Simatic.Ax.IO.Input; +USING Simatic.Ax.SimpleControlModules; +USING ApplicationStateFramwerok; +USING AxUnit; + +NAMESPACE MyTest + + {TestFixture} + CLASS TestStateRed + VAR PUBLIC + state : StateRed; + ls : LightStackRdYeGnBl; + qRd : BinOutput; + qYe : BinOutput; + qGn : BinOutput; + qBl : BinOutput; + END_VAR + + METHOD PROTECTED Setup + state.LightStack := REF(ls); + ls.QBlue := qBl; + ls.QGreen := qGn; + ls.QRed := qRd; + ls.QYellow := qYe; + END_METHOD + + {Test} + METHOD PUBLIC OnEntry_SwitchOnGreenLamp + THIS.Setup(); + state.OnEntry(); + Assert.Equal(actual := ls.GetState(Colors#Red), expected := TRUE); + Assert.Equal(actual := ls.GetState(Colors#Yellow), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Green), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Blue), expected := FALSE); + END_METHOD + + {Test} + METHOD PUBLIC OnEntry_SwitchOffGreenLamp + THIS.OnEntry_SwitchOnGreenLamp(); + state.OnExit(); + Assert.Equal(actual := ls.GetState(Colors#Red), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Yellow), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Green), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Blue), expected := FALSE); + END_METHOD + END_CLASS + +END_NAMESPACE + diff --git a/test/TestStateRedYellow.st b/test/TestStateRedYellow.st new file mode 100644 index 0000000..b49092f --- /dev/null +++ b/test/TestStateRedYellow.st @@ -0,0 +1,50 @@ +USING Simatic.Ax.IO.Output; +USING Simatic.Ax.IO.Input; +USING Simatic.Ax.SimpleControlModules; +USING ApplicationStateFramwerok; +USING AxUnit; + +NAMESPACE MyTest + + {TestFixture} + CLASS TestStateRedYellow + VAR PUBLIC + state : StateRedYellow; + ls : LightStackRdYeGnBl; + qRd : BinOutput; + qYe : BinOutput; + qGn : BinOutput; + qBl : BinOutput; + END_VAR + + METHOD PROTECTED Setup + state.LightStack := REF(ls); + ls.QBlue := qBl; + ls.QGreen := qGn; + ls.QRed := qRd; + ls.QYellow := qYe; + END_METHOD + + {Test} + METHOD PUBLIC OnEntry_SwitchOnGreenLamp + THIS.Setup(); + state.OnEntry(); + Assert.Equal(actual := ls.GetState(Colors#Red), expected := TRUE); + Assert.Equal(actual := ls.GetState(Colors#Yellow), expected := TRUE); + Assert.Equal(actual := ls.GetState(Colors#Green), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Blue), expected := FALSE); + END_METHOD + + {Test} + METHOD PUBLIC OnEntry_SwitchOffGreenLamp + THIS.OnEntry_SwitchOnGreenLamp(); + state.OnExit(); + Assert.Equal(actual := ls.GetState(Colors#Red), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Yellow), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Green), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Blue), expected := FALSE); + END_METHOD + END_CLASS + +END_NAMESPACE + diff --git a/test/TestStateYellow.st b/test/TestStateYellow.st new file mode 100644 index 0000000..553df9c --- /dev/null +++ b/test/TestStateYellow.st @@ -0,0 +1,50 @@ +USING Simatic.Ax.IO.Output; +USING Simatic.Ax.IO.Input; +USING Simatic.Ax.SimpleControlModules; +USING ApplicationStateFramwerok; +USING AxUnit; + +NAMESPACE MyTest + + {TestFixture} + CLASS TestStateYellow + VAR PUBLIC + state : StateYellow; + ls : LightStackRdYeGnBl; + qRd : BinOutput; + qYe : BinOutput; + qGn : BinOutput; + qBl : BinOutput; + END_VAR + + METHOD PROTECTED Setup + state.LightStack := REF(ls); + ls.QBlue := qBl; + ls.QGreen := qGn; + ls.QRed := qRd; + ls.QYellow := qYe; + END_METHOD + + {Test} + METHOD PUBLIC OnEntry_SwitchOnGreenLamp + THIS.Setup(); + state.OnEntry(); + Assert.Equal(actual := ls.GetState(Colors#Red), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Yellow), expected := TRUE); + Assert.Equal(actual := ls.GetState(Colors#Green), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Blue), expected := FALSE); + END_METHOD + + {Test} + METHOD PUBLIC OnEntry_SwitchOffGreenLamp + THIS.OnEntry_SwitchOnGreenLamp(); + state.OnExit(); + Assert.Equal(actual := ls.GetState(Colors#Red), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Yellow), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Green), expected := FALSE); + Assert.Equal(actual := ls.GetState(Colors#Blue), expected := FALSE); + END_METHOD + END_CLASS + +END_NAMESPACE + diff --git a/test/test.st b/test/test.st deleted file mode 100644 index 82bb243..0000000 --- a/test/test.st +++ /dev/null @@ -1,13 +0,0 @@ -USING AxUnit; - -NAMESPACE MyTest - - {TestFixture} - CLASS MyTestFixture - {Test} - METHOD PUBLIC MyTestMethod - Assert.Equal(actual := TRUE, expected := TRUE); - END_METHOD - END_CLASS - -END_NAMESPACE