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

Last change on this file since 465 was 465, checked in by dai, 16 years ago

ActiveBasic.Xml.Parserを仮実装。
・SerializeTestのテストケースを追加。
・SimpleTestCaseにおいて、一時ディレクトリを扱えるようにした。
・XmlTestのテストケースを更新。

File size: 1.8 KB
Line 
1' SimpleTestCase.ab
2
3#console
4
5Dim hStdOut = _System_hConsoleOut
6
7Sub 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 )
17End Sub
18
19Initialize()
20
21Dim csbi As CONSOLE_SCREEN_BUFFER_INFO
22GetConsoleScreenBufferInfo(hStdOut, csbi)
23
24#include "SimpleTestCase.idx"
25
26Sub 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
43End Sub
44
45Sub 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
54End Sub
55
56Function 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
66End Function
67
68Print "Please Enter key"
69System.Console.ReadLine()
Note: See TracBrowser for help on using the repository browser.