1 | ' SimpleTestCase.ab
|
---|
2 |
|
---|
3 | #console
|
---|
4 |
|
---|
5 | Dim hStdOut = _System_hConsoleOut
|
---|
6 |
|
---|
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 |
|
---|
21 | Dim csbi As CONSOLE_SCREEN_BUFFER_INFO
|
---|
22 | GetConsoleScreenBufferInfo(hStdOut, csbi)
|
---|
23 |
|
---|
24 | #include "SimpleTestCase.idx"
|
---|
25 |
|
---|
26 | Sub UnitTest( msg As String, isSuccessful As Boolean )
|
---|
27 | Dim resultStr = Nothing As String
|
---|
28 | If isSuccessful Then
|
---|
29 | resultStr = Ex"OK "
|
---|
30 | Else
|
---|
31 | resultStr = Ex"FAILURE!"
|
---|
32 | End If
|
---|
33 |
|
---|
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
|
---|
43 | End Sub
|
---|
44 |
|
---|
45 | Sub UnitTest( msg As String, test As String, expectation As String)
|
---|
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
|
---|
54 | End Sub
|
---|
55 |
|
---|
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 |
|
---|
68 | Print "Please Enter key"
|
---|
69 | System.Console.ReadLine()
|
---|