-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from simatic-ax/add_tests
Add tests
- Loading branch information
Showing
6 changed files
with
201 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 | ||
|
This file was deleted.
Oops, something went wrong.