Ignore:
Timestamp:
Mar 9, 2008, 12:00:01 PM (17 years ago)
Author:
イグトランス (egtra)
Message:

TextWriter, StreamWriterの追加。
SPrintfの浮動小数点数変換で、NaN, Infiniteの出力に対応。
PathとDirectoryInfoのCreateDirectoryで、対象が既に存在するときには例外を投げないように修正。
SimpleTestCase内で使用する一時フォルダの場所にGetTempPathで取得する版を追加(コメントアウト)。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/TestCase/SimpleTestCase/SimpleTestCase.ab

    r465 r468  
    55Dim hStdOut = _System_hConsoleOut
    66
     7Function GetTempDirectory() As String
     8    Return System.IO.Path.GetDirectoryName( System.Windows.Forms.Application.ExecutablePath ) + "\temp\"
     9'   Return System.IO.Path.GetTempPath()
     10End Function
     11
    712Sub Initialize()
    813    ' 初期化関数
    914
    1015    ' 一時ディレクトリを空にしておく
    11     Dim tempDir = System.IO.Path.GetDirectoryName( System.Windows.Forms.Application.ExecutablePath ) + "\temp"
     16    Dim tempDir = GetTempDirectory()
    1217    If System.IO.Directory.Exists( tempDir ) Then
    13         ' 存在するときは一旦消す
    14         System.IO.Directory.Delete( tempDir, True )
     18        Try
     19            ' 存在するときは一旦消す
     20            System.IO.Directory.Delete( tempDir, True )
     21        Catch e As System.IO.IOException
     22            OutputDebugString(e.ToString)
     23        End Try
    1524    End If
    1625    System.IO.Directory.CreateDirectory( tempDir )
     
    2433#include "SimpleTestCase.idx"
    2534
     35Dim failureCount = 0 As DWord
     36
    2637Sub UnitTest( msg As String, isSuccessful As Boolean )
    2738    Dim resultStr = Nothing As String
     
    3041    Else
    3142        resultStr = Ex"FAILURE!"
     43        failureCount++
    3244    End If
    3345
     
    4961        SetConsoleTextAttribute(hStdOut, BACKGROUND_RED Or BACKGROUND_GREEN Or BACKGROUND_INTENSITY)
    5062        Print Ex"FAILURE!"; msg
    51         Print "  test string = '" + test + "'"
     63        Print "  期待 = '" + expectation + "'" + " 結果 = '" + test + "'"
    5264        SetConsoleTextAttribute(hStdOut, csbi.wAttributes)
     65        failureCount++
    5366    End If
    5467End Sub
    5568
    5669Function GetExclusiveTempDirPath( testCaseName As String ) As String
    57     Dim tempDir = System.IO.Path.GetDirectoryName( System.Windows.Forms.Application.ExecutablePath ) + "\temp"
    58     Dim exclusiveTempDirPath = tempDir + "\" + testCaseName
     70    Dim tempDir = GetTempDirectory()
     71    Dim exclusiveTempDirPath = tempDir + testCaseName
    5972
    6073    If Not System.IO.Directory.Exists( exclusiveTempDirPath ) Then
     
    6679End Function
    6780
     81Print "失敗"; failureCount; "個"
    6882Print "Please Enter key"
    6983System.Console.ReadLine()
Note: See TracChangeset for help on using the changeset viewer.