| Rev | Line |   | 
|---|
| [236] | 1 | ' SimpleTestCase.ab
 | 
|---|
 | 2 | 
 | 
|---|
| [221] | 3 | #console
 | 
|---|
| [355] | 4 | 
 | 
|---|
 | 5 | Dim hStdOut = _System_hConsoleOut
 | 
|---|
 | 6 | 
 | 
|---|
 | 7 | Dim csbi As CONSOLE_SCREEN_BUFFER_INFO
 | 
|---|
 | 8 | GetConsoleScreenBufferInfo(hStdOut, csbi)
 | 
|---|
 | 9 | 
 | 
|---|
| [221] | 10 | #include "SimpleTestCase.idx"
 | 
|---|
 | 11 | 
 | 
|---|
| [438] | 12 | Sub UnitTest( msg As String, isSuccessful As Boolean )
 | 
|---|
| [383] | 13 |     Dim resultStr = Nothing As String
 | 
|---|
| [222] | 14 |     If isSuccessful Then
 | 
|---|
| [355] | 15 |         resultStr = Ex"OK      "
 | 
|---|
| [222] | 16 |     Else
 | 
|---|
| [236] | 17 |         resultStr = Ex"FAILURE!"
 | 
|---|
| [222] | 18 |     End If
 | 
|---|
| [236] | 19 | 
 | 
|---|
| [355] | 20 |     If Not isSuccessful Then
 | 
|---|
 | 21 |         SetConsoleTextAttribute(hStdOut, BACKGROUND_RED Or BACKGROUND_GREEN Or BACKGROUND_INTENSITY)
 | 
|---|
 | 22 |     End If
 | 
|---|
 | 23 | 
 | 
|---|
 | 24 |     Print resultStr; msg
 | 
|---|
 | 25 | 
 | 
|---|
 | 26 |     If Not isSuccessful Then
 | 
|---|
 | 27 |         SetConsoleTextAttribute(hStdOut, csbi.wAttributes)
 | 
|---|
 | 28 |     End If
 | 
|---|
| [438] | 29 | End Sub
 | 
|---|
| [221] | 30 | 
 | 
|---|
| [438] | 31 | Sub UnitTest( msg As String, test As String, expectation As String)
 | 
|---|
| [383] | 32 |     If test = expectation Then
 | 
|---|
 | 33 |         Print Ex"OK      "; msg
 | 
|---|
 | 34 |     Else
 | 
|---|
 | 35 |         SetConsoleTextAttribute(hStdOut, BACKGROUND_RED Or BACKGROUND_GREEN Or BACKGROUND_INTENSITY)
 | 
|---|
 | 36 |         Print Ex"FAILURE!"; msg
 | 
|---|
 | 37 |         Print "  test string = '" + test + "'"
 | 
|---|
 | 38 |         SetConsoleTextAttribute(hStdOut, csbi.wAttributes)
 | 
|---|
 | 39 |     End If
 | 
|---|
| [438] | 40 | End Sub
 | 
|---|
| [383] | 41 | 
 | 
|---|
| [221] | 42 | Print "Please enter any key"
 | 
|---|
 | 43 | Dim a As Long
 | 
|---|
 | 44 | Input a
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.