2020-02-23 12:38:53 +01:00
|
|
|
' Gambas test file
|
2019-11-15 22:33:54 +01:00
|
|
|
|
2020-04-09 08:13:09 +02:00
|
|
|
''' Every test in this class failes, but is reverted to be reported as good
|
|
|
|
|
2020-05-26 20:45:18 +02:00
|
|
|
Public Sub StringFailure()
|
2019-11-15 22:33:54 +01:00
|
|
|
|
2020-05-28 11:14:58 +02:00
|
|
|
Test.IntendedFailure()
|
2020-02-24 17:59:14 +01:00
|
|
|
Assert.StringEquals("Lisa", "Paul", "Intentional String failure. Ok if not ok.")
|
2019-11-15 22:33:54 +01:00
|
|
|
|
|
|
|
End
|
|
|
|
|
2020-05-26 20:45:18 +02:00
|
|
|
Public Sub LongFailure()
|
2019-11-15 22:33:54 +01:00
|
|
|
|
2020-05-28 11:14:58 +02:00
|
|
|
Test.IntendedFailure()
|
2020-02-24 17:59:14 +01:00
|
|
|
Assert.Equals(2, 3, "Intentional Long failure. Ok if not ok.")
|
2019-11-15 22:33:54 +01:00
|
|
|
|
|
|
|
End
|
2019-12-30 22:10:37 +01:00
|
|
|
|
2020-05-26 20:45:18 +02:00
|
|
|
Public Sub LongTypeMismatchFailure()
|
2019-12-30 22:10:37 +01:00
|
|
|
|
|
|
|
Dim s As String = "3.0"
|
2020-04-09 08:13:09 +02:00
|
|
|
|
2020-05-28 11:14:58 +02:00
|
|
|
Test.IntendedFailure()
|
2020-02-24 17:59:14 +01:00
|
|
|
Assert.Equals(s, 3, "Intentional Long type mismatch failure. Ok if not ok.")
|
2019-12-30 22:10:37 +01:00
|
|
|
|
|
|
|
End
|
|
|
|
|
2020-05-26 20:45:18 +02:00
|
|
|
Public Sub EqualsFailure()
|
2019-12-30 22:10:37 +01:00
|
|
|
|
|
|
|
Dim oOne, oTwo As Object
|
|
|
|
|
2020-04-27 12:01:47 +02:00
|
|
|
Test.Note("Equals failures")
|
2020-05-28 11:14:58 +02:00
|
|
|
Test.IntendedFailure()
|
2019-12-30 22:10:37 +01:00
|
|
|
Assert.Equals(2, 3)
|
2020-04-09 08:13:09 +02:00
|
|
|
|
2020-05-28 11:14:58 +02:00
|
|
|
Test.IntendedFailure()
|
2019-12-30 22:10:37 +01:00
|
|
|
Assert.Equals("3", 2.0)
|
2020-04-09 08:13:09 +02:00
|
|
|
|
2020-05-28 11:14:58 +02:00
|
|
|
Test.IntendedFailure()
|
2019-12-30 22:10:37 +01:00
|
|
|
Assert.Equals("2", 2.1)
|
2020-04-09 08:13:09 +02:00
|
|
|
|
|
|
|
oOne = New Test
|
|
|
|
oTwo = New Test
|
2020-05-28 11:14:58 +02:00
|
|
|
Test.IntendedFailure()
|
2019-12-30 22:10:37 +01:00
|
|
|
Assert.Equals(oOne, oTwo)
|
|
|
|
|
|
|
|
End
|
|
|
|
|
2020-05-26 20:45:18 +02:00
|
|
|
Public Sub Error()
|
2019-12-30 22:10:37 +01:00
|
|
|
|
|
|
|
Dim a As Long
|
|
|
|
|
|
|
|
Try a = 3 / 0
|
2020-05-28 11:14:58 +02:00
|
|
|
Test.IntendedFailure()
|
2020-02-24 17:59:14 +01:00
|
|
|
Assert.ErrorCode(5, "Wanted error 5. Ok if not ok.")
|
2020-02-23 12:38:53 +01:00
|
|
|
|
2019-12-30 22:10:37 +01:00
|
|
|
' No Error, AssertError has to report a failure
|
2020-05-28 11:14:58 +02:00
|
|
|
Test.IntendedFailure()
|
2019-12-30 22:10:37 +01:00
|
|
|
Assert.Error("No Error but error expected. Ok if not ok.")
|
|
|
|
|
2020-04-27 12:01:47 +02:00
|
|
|
End
|