' SimpleTestCase.ab #console Dim hStdOut = _System_hConsoleOut Sub Initialize() ' 初期化関数 ' 一時ディレクトリを空にしておく Dim tempDir = System.IO.Path.GetDirectoryName( System.Windows.Forms.Application.ExecutablePath ) + "\temp" If System.IO.Directory.Exists( tempDir ) Then ' 存在するときは一旦消す System.IO.Directory.Delete( tempDir, True ) End If System.IO.Directory.CreateDirectory( tempDir ) End Sub Initialize() Dim csbi As CONSOLE_SCREEN_BUFFER_INFO GetConsoleScreenBufferInfo(hStdOut, csbi) #include "SimpleTestCase.idx" Sub UnitTest( msg As String, isSuccessful As Boolean ) Dim resultStr = Nothing As String If isSuccessful Then resultStr = Ex"OK " Else resultStr = Ex"FAILURE!" End If If Not isSuccessful Then SetConsoleTextAttribute(hStdOut, BACKGROUND_RED Or BACKGROUND_GREEN Or BACKGROUND_INTENSITY) End If Print resultStr; msg If Not isSuccessful Then SetConsoleTextAttribute(hStdOut, csbi.wAttributes) End If End Sub Sub UnitTest( msg As String, test As String, expectation As String) If test = expectation Then Print Ex"OK "; msg Else SetConsoleTextAttribute(hStdOut, BACKGROUND_RED Or BACKGROUND_GREEN Or BACKGROUND_INTENSITY) Print Ex"FAILURE!"; msg Print " test string = '" + test + "'" SetConsoleTextAttribute(hStdOut, csbi.wAttributes) End If End Sub Function GetExclusiveTempDirPath( testCaseName As String ) As String Dim tempDir = System.IO.Path.GetDirectoryName( System.Windows.Forms.Application.ExecutablePath ) + "\temp" Dim exclusiveTempDirPath = tempDir + "\" + testCaseName If Not System.IO.Directory.Exists( exclusiveTempDirPath ) Then ' 無かったら作る System.IO.Directory.CreateDirectory( exclusiveTempDirPath ) End If Return exclusiveTempDirPath End Function Print "Please Enter key" System.Console.ReadLine()