@Test
Identifies a procedure as a unit test.
Syntax
@Test [ IGNORE ]
Parts
IGNORE
- Optional identifier specifies that the unit test that follows is not always necessary.
Instructions
You use the modifier @Test
to write unit tests.
A unit test is a procedure to do one test on a small block of code.
The code (typically methods and other procedures) all must be correct.
If you write the identifier IGNORE
after @Test
, the related unit test is usually ignored.
Usually you do this for tests that run for a very long time.
But if you supply the command line switch TBD, such tests will be included.
The procedure usually uses the object method #Debug.Assert()
to do its test.
Rules
- The Procedure must not have parameters.
- The Procedure must not have a return type.
Applicable to
Examples
Class Adder
method Add(a As Int32, b As Int32) As Int32
Return a + b
End
End Class
@Test Sub Add1and1
New Adder obj
#Debug.Assert obj.Add(1, 1) = 2
End
@Test Sub AddNegatives
New Adder obj
#Debug.Assert obj.Add(-1, -1) = -2
End