[236] | 1 | ' SimpleTestCase.ab
|
---|
| 2 |
|
---|
[221] | 3 | #console
|
---|
[355] | 4 |
|
---|
| 5 | Dim hStdOut = _System_hConsoleOut
|
---|
| 6 |
|
---|
[465] | 7 | Sub Initialize()
|
---|
| 8 | ' 初期化関数
|
---|
| 9 |
|
---|
| 10 | ' 一時ディレクトリを空にしておく
|
---|
| 11 | Dim tempDir = System.IO.Path.GetDirectoryName( System.Windows.Forms.Application.ExecutablePath ) + "\temp"
|
---|
| 12 | If System.IO.Directory.Exists( tempDir ) Then
|
---|
| 13 | ' 存在するときは一旦消す
|
---|
| 14 | System.IO.Directory.Delete( tempDir, True )
|
---|
| 15 | End If
|
---|
| 16 | System.IO.Directory.CreateDirectory( tempDir )
|
---|
| 17 | End Sub
|
---|
| 18 |
|
---|
| 19 | Initialize()
|
---|
| 20 |
|
---|
[355] | 21 | Dim csbi As CONSOLE_SCREEN_BUFFER_INFO
|
---|
| 22 | GetConsoleScreenBufferInfo(hStdOut, csbi)
|
---|
| 23 |
|
---|
[221] | 24 | #include "SimpleTestCase.idx"
|
---|
| 25 |
|
---|
[438] | 26 | Sub UnitTest( msg As String, isSuccessful As Boolean )
|
---|
[383] | 27 | Dim resultStr = Nothing As String
|
---|
[222] | 28 | If isSuccessful Then
|
---|
[355] | 29 | resultStr = Ex"OK "
|
---|
[222] | 30 | Else
|
---|
[236] | 31 | resultStr = Ex"FAILURE!"
|
---|
[222] | 32 | End If
|
---|
[236] | 33 |
|
---|
[355] | 34 | If Not isSuccessful Then
|
---|
| 35 | SetConsoleTextAttribute(hStdOut, BACKGROUND_RED Or BACKGROUND_GREEN Or BACKGROUND_INTENSITY)
|
---|
| 36 | End If
|
---|
| 37 |
|
---|
| 38 | Print resultStr; msg
|
---|
| 39 |
|
---|
| 40 | If Not isSuccessful Then
|
---|
| 41 | SetConsoleTextAttribute(hStdOut, csbi.wAttributes)
|
---|
| 42 | End If
|
---|
[438] | 43 | End Sub
|
---|
[221] | 44 |
|
---|
[438] | 45 | Sub UnitTest( msg As String, test As String, expectation As String)
|
---|
[383] | 46 | If test = expectation Then
|
---|
| 47 | Print Ex"OK "; msg
|
---|
| 48 | Else
|
---|
| 49 | SetConsoleTextAttribute(hStdOut, BACKGROUND_RED Or BACKGROUND_GREEN Or BACKGROUND_INTENSITY)
|
---|
| 50 | Print Ex"FAILURE!"; msg
|
---|
| 51 | Print " test string = '" + test + "'"
|
---|
| 52 | SetConsoleTextAttribute(hStdOut, csbi.wAttributes)
|
---|
| 53 | End If
|
---|
[438] | 54 | End Sub
|
---|
[383] | 55 |
|
---|
[465] | 56 | Function GetExclusiveTempDirPath( testCaseName As String ) As String
|
---|
| 57 | Dim tempDir = System.IO.Path.GetDirectoryName( System.Windows.Forms.Application.ExecutablePath ) + "\temp"
|
---|
| 58 | Dim exclusiveTempDirPath = tempDir + "\" + testCaseName
|
---|
| 59 |
|
---|
| 60 | If Not System.IO.Directory.Exists( exclusiveTempDirPath ) Then
|
---|
| 61 | ' 無かったら作る
|
---|
| 62 | System.IO.Directory.CreateDirectory( exclusiveTempDirPath )
|
---|
| 63 | End If
|
---|
| 64 |
|
---|
| 65 | Return exclusiveTempDirPath
|
---|
| 66 | End Function
|
---|
| 67 |
|
---|
[457] | 68 | Print "Please Enter key"
|
---|
| 69 | System.Console.ReadLine()
|
---|