source: trunk/TestCase/SimpleTestCase/SimpleTestCase.ab @ 383

Last change on this file since 383 was 383, checked in by イグトランス (egtra), 16 years ago

SPrintf関数の実装

File size: 1.1 KB
Line 
1' SimpleTestCase.ab
2
3#console
4
5Dim hStdOut = _System_hConsoleOut
6
7Dim csbi As CONSOLE_SCREEN_BUFFER_INFO
8GetConsoleScreenBufferInfo(hStdOut, csbi)
9
10#include "SimpleTestCase.idx"
11
12Function UnitTest( msg As String, isSuccessful As Boolean )
13    Dim resultStr = Nothing As String
14    If isSuccessful Then
15        resultStr = Ex"OK      "
16    Else
17        resultStr = Ex"FAILURE!"
18    End If
19
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
29End Function
30
31Function UnitTest( msg As String, test As String, expectation As String)
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
40End Function
41
42Print "Please enter any key"
43Dim a As Long
44Input a
Note: See TracBrowser for help on using the repository browser.