-
Notifications
You must be signed in to change notification settings - Fork 1
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 #38 from simatic-ax/renovate/ax-sdk-2405.x
fix: unittest
- Loading branch information
Showing
4 changed files
with
216 additions
and
197 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 |
---|---|---|
@@ -1,48 +1,55 @@ | ||
// USING Siemens.Ax.ExampleLibrary; | ||
// USING AxUnit; | ||
USING Siemens.Ax.ExampleLibrary; | ||
USING AxUnit; | ||
|
||
// NAMESPACE Siemens.Ax | ||
NAMESPACE Siemens.Ax | ||
|
||
// {TestFixture} | ||
// CLASS TestCounter | ||
// VAR | ||
// c : Counter; | ||
// END_VAR | ||
// {Test} | ||
// METHOD PUBLIC Test_CountUp_1_Time_And_Get_1 | ||
// c.CountUp(); | ||
// Assert.Equal(actual := c.GetValue(), expected := 1); | ||
// END_METHOD | ||
// {Test} | ||
// METHOD PUBLIC Test_CountDown_1_Time_And_Get_Minus_1 | ||
// c.CountDown(); | ||
// Assert.Equal(actual := c.GetValue(), expected := -1); | ||
// END_METHOD | ||
// {Test} | ||
// METHOD PUBLIC Test_CountUp_3_Times_And_Get_3 | ||
// c.CountUp(); | ||
// c.CountUp(); | ||
// c.CountUp(); | ||
// Assert.Equal(actual := c.GetValue(), expected := 3); | ||
// END_METHOD | ||
// {Test} | ||
// METHOD PUBLIC Test_CountDown_3_Time_And_Get_Minus_3 | ||
// c.CountDown(); | ||
// c.CountDown(); | ||
// c.CountDown(); | ||
// Assert.Equal(actual := c.GetValue(), expected := -3); | ||
// END_METHOD | ||
// {Test} | ||
// METHOD PUBLIC Test_SetValue_To_5_And_Get_5 | ||
// c.SetValue(5); | ||
// Assert.Equal(actual := c.GetValue(), expected := 5); | ||
// END_METHOD | ||
// {Test} | ||
// METHOD PUBLIC Test_SetValue_wit_DefaultValue_And_Get_0 | ||
// c.SetValue(5); | ||
// c.SetValue(); | ||
// Assert.Equal(actual := c.GetValue(), expected := 0); | ||
// END_METHOD | ||
// END_CLASS | ||
{TestFixture} | ||
CLASS TestCounter | ||
VAR | ||
c : Counter; | ||
cStateless : Counter; | ||
END_VAR | ||
|
||
// END_NAMESPACE | ||
// This method will be called before each test method | ||
{TestSetup} | ||
METHOD PUBLIC MyTestSetup | ||
c := cStateless; | ||
END_METHOD | ||
{Test} | ||
METHOD PUBLIC Test_CountUp_1_Time_And_Get_1 | ||
c.CountUp(); | ||
Assert.Equal(actual := c.GetValue(), expected := 1); | ||
END_METHOD | ||
{Test} | ||
METHOD PUBLIC Test_CountDown_1_Time_And_Get_Minus_1 | ||
c.CountDown(); | ||
Assert.Equal(actual := c.GetValue(), expected := -1); | ||
END_METHOD | ||
{Test} | ||
METHOD PUBLIC Test_CountUp_3_Times_And_Get_3 | ||
c.CountUp(); | ||
c.CountUp(); | ||
c.CountUp(); | ||
Assert.Equal(actual := c.GetValue(), expected := 3); | ||
END_METHOD | ||
{Test} | ||
METHOD PUBLIC Test_CountDown_3_Time_And_Get_Minus_3 | ||
c.CountDown(); | ||
c.CountDown(); | ||
c.CountDown(); | ||
Assert.Equal(actual := c.GetValue(), expected := -3); | ||
END_METHOD | ||
{Test} | ||
METHOD PUBLIC Test_SetValue_To_5_And_Get_5 | ||
c.SetValue(5); | ||
Assert.Equal(actual := c.GetValue(), expected := 5); | ||
END_METHOD | ||
{Test} | ||
METHOD PUBLIC Test_SetValue_wit_DefaultValue_And_Get_0 | ||
c.SetValue(5); | ||
c.SetValue(); | ||
Assert.Equal(actual := c.GetValue(), expected := 0); | ||
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 |
---|---|---|
@@ -1,76 +1,82 @@ | ||
// USING Siemens.Ax.ExampleLibrary; | ||
// USING AxUnit; | ||
USING Siemens.Ax.ExampleLibrary; | ||
USING AxUnit; | ||
|
||
// NAMESPACE Siemens.Ax | ||
NAMESPACE Siemens.Ax | ||
|
||
// {TestFixture} | ||
// CLASS TestParkingCounter | ||
// VAR | ||
// c : ParkingCounter; | ||
// bInside : BOOL; | ||
// bOutside : BOOL; | ||
// END_VAR | ||
// METHOD Config | ||
// c.BSensorInside := REF(bInside); | ||
// c.BSensorOutside := REF(bOutside); | ||
// c.Limit := 2; | ||
// END_METHOD | ||
// /// Sinal Sequence for 1 object entering | ||
// METHOD Enter_1_object_signal_sequence | ||
// THIS.Config(); | ||
// bInside := FALSE; | ||
// bOutside := FALSE; | ||
// c.Execute(); | ||
// bInside := FALSE; | ||
// bOutside := TRUE; | ||
// c.Execute(); | ||
// bInside := TRUE; | ||
// bOutside := TRUE; | ||
// c.Execute(); | ||
// bInside := TRUE; | ||
// bOutside := FALSE; | ||
// c.Execute(); | ||
// bInside := FALSE; | ||
// bOutside := FALSE; | ||
// c.Execute(); | ||
// END_METHOD | ||
// /// Sinal Sequence for 1 object leaving | ||
// METHOD Leave_1_object_signal_sequence | ||
// THIS.Config(); | ||
// bInside := FALSE; | ||
// bOutside := FALSE; | ||
// c.Execute(); | ||
// bInside := TRUE; | ||
// bOutside := FALSE; | ||
// c.Execute(); | ||
// bInside := TRUE; | ||
// bOutside := TRUE; | ||
// c.Execute(); | ||
// bInside := FALSE; | ||
// bOutside := TRUE; | ||
// c.Execute(); | ||
// bInside := FALSE; | ||
// bOutside := FALSE; | ||
// c.Execute(); | ||
// END_METHOD | ||
// {Test} | ||
// METHOD PUBLIC Count_1_object_entering | ||
// THIS.Enter_1_object_signal_sequence(); | ||
// Assert.Equal(actual := c.GetAmountOfParkedItems (), expected := 1); | ||
// END_METHOD | ||
// {Test} | ||
// METHOD PUBLIC CheckLimit_of_to_by_entering_three_objects | ||
// THIS.Enter_1_object_signal_sequence(); | ||
// THIS.Enter_1_object_signal_sequence(); | ||
// THIS.Enter_1_object_signal_sequence(); | ||
// Assert.Equal(actual := c.GetAmountOfParkedItems (), expected := 2); | ||
// END_METHOD | ||
// {Test} | ||
// METHOD PUBLIC Remove_one_of_one_object_and_expect_0 | ||
// THIS.Enter_1_object_signal_sequence(); | ||
// THIS.Leave_1_object_signal_sequence(); | ||
// Assert.Equal(actual := c.GetAmountOfParkedItems (), expected := 0); | ||
// END_METHOD | ||
// END_CLASS | ||
{TestFixture} | ||
CLASS TestParkingCounter | ||
VAR | ||
c : ParkingCounter; | ||
cStateless : ParkingCounter; | ||
bInside : BOOL; | ||
bOutside : BOOL; | ||
END_VAR | ||
// This method will be called before each test method | ||
{TestSetup} | ||
METHOD PUBLIC MyTestSetup | ||
c := cStateless; | ||
END_METHOD | ||
METHOD Config | ||
c.BSensorInside := REF(bInside); | ||
c.BSensorOutside := REF(bOutside); | ||
c.Limit := 2; | ||
END_METHOD | ||
/// Sinal Sequence for 1 object entering | ||
METHOD Enter_1_object_signal_sequence | ||
THIS.Config(); | ||
bInside := FALSE; | ||
bOutside := FALSE; | ||
c.Execute(); | ||
bInside := FALSE; | ||
bOutside := TRUE; | ||
c.Execute(); | ||
bInside := TRUE; | ||
bOutside := TRUE; | ||
c.Execute(); | ||
bInside := TRUE; | ||
bOutside := FALSE; | ||
c.Execute(); | ||
bInside := FALSE; | ||
bOutside := FALSE; | ||
c.Execute(); | ||
END_METHOD | ||
/// Sinal Sequence for 1 object leaving | ||
METHOD Leave_1_object_signal_sequence | ||
THIS.Config(); | ||
bInside := FALSE; | ||
bOutside := FALSE; | ||
c.Execute(); | ||
bInside := TRUE; | ||
bOutside := FALSE; | ||
c.Execute(); | ||
bInside := TRUE; | ||
bOutside := TRUE; | ||
c.Execute(); | ||
bInside := FALSE; | ||
bOutside := TRUE; | ||
c.Execute(); | ||
bInside := FALSE; | ||
bOutside := FALSE; | ||
c.Execute(); | ||
END_METHOD | ||
{Test} | ||
METHOD PUBLIC Count_1_object_entering | ||
THIS.Enter_1_object_signal_sequence(); | ||
Assert.Equal(actual := c.GetAmountOfParkedItems (), expected := 1); | ||
END_METHOD | ||
{Test} | ||
METHOD PUBLIC CheckLimit_of_to_by_entering_three_objects | ||
THIS.Enter_1_object_signal_sequence(); | ||
THIS.Enter_1_object_signal_sequence(); | ||
THIS.Enter_1_object_signal_sequence(); | ||
Assert.Equal(actual := c.GetAmountOfParkedItems (), expected := 2); | ||
END_METHOD | ||
{Test} | ||
METHOD PUBLIC Remove_one_of_one_object_and_expect_0 | ||
THIS.Enter_1_object_signal_sequence(); | ||
THIS.Leave_1_object_signal_sequence(); | ||
Assert.Equal(actual := c.GetAmountOfParkedItems (), expected := 0); | ||
END_METHOD | ||
END_CLASS | ||
|
||
// END_NAMESPACE | ||
END_NAMESPACE |
Oops, something went wrong.