⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test.vb

📁 大名鼎鼎的mono是.NET平台的跨平台(支持linux
💻 VB
📖 第 1 页 / 共 3 页
字号:
' ' Visual Basic.Net COmpiler' Copyright (C) 2004 - 2006 Rolf Bjarne Kvinge, rbjarnek at users.sourceforge.net' ' This library is free software; you can redistribute it and/or' modify it under the terms of the GNU Lesser General Public' License as published by the Free Software Foundation; either' version 2.1 of the License, or (at your option) any later version.' ' This library is distributed in the hope that it will be useful,' but WITHOUT ANY WARRANTY; without even the implied warranty of' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU' Lesser General Public License for more details.' ' You should have received a copy of the GNU Lesser General Public' License along with this library; if not, write to the Free Software' Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA' <Serializable()> _Public Class Test    Private Const PEVerifyPath As String = "%programfiles%\Microsoft Visual Studio 8\SDK\v2.0\Bin\PEVerify.exe"    ''' <summary>    ''' The files that contains this test.    ''' </summary>    Private m_Files As New Generic.List(Of String)    ''' <summary>    ''' The name of the test    ''' </summary>    ''' <remarks></remarks>    Private m_Name As String    ''' <summary>    ''' The base path of where the code file(s) are    ''' </summary>    ''' <remarks></remarks>    Private m_BasePath As String    ''' <summary>    ''' The path of where the output files are    ''' </summary>    ''' <remarks></remarks>    Private m_OutputPath As String    ''' <summary>    ''' The response file, if any.    ''' </summary>    ''' <remarks></remarks>    Private m_ResponseFile As String    Private m_RspFile As String    Private m_DefaultRspFile As String    ''' <summary>    ''' The result of the test    ''' </summary>    ''' <remarks></remarks>    Private m_Result As Results    Private m_OldResult As Results    ''' <summary>    ''' The test container    ''' </summary>    ''' <remarks></remarks>    <NonSerialized()> Private m_Parent As Tests    ''' <summary>    ''' How long did the test take?    ''' </summary>    ''' <remarks></remarks>    Private m_TestDuration As TimeSpan    Private m_Verifications As New Generic.List(Of VerificationBase)    ''' <summary>    ''' The compilation using our compiler.    ''' </summary>    ''' <remarks></remarks>    Private m_Compilation As ExternalProcessVerification    Public Const OutputExtension As String = ".output.xml"    Public Const VerifiedExtension As String = ".verified.xml"    Public Const OutputPattern As String = ".*" & OutputExtension    Public Const VerifiedPattern As String = ".*" & VerifiedExtension    Public DefaultOutputPath As String = "testoutput" & System.IO.Path.DirectorySeparatorChar    Private m_Target As String    Private m_TargetExtension As String    Private m_NoConfig As Boolean    Private m_LastRun As Date    Private m_Tag As Object    Private m_IsNegativeTest As Boolean    Private m_NegativeError As Integer    Private m_LoadedOldResults As Boolean    Public Event Executed(ByVal Sender As Test)    Public Event Executing(ByVal Sender As Test)    Public Event Changed(ByVal Sender As Test)    Private m_Compiler As String    Private m_AC As String    Private Shared m_NegativeRegExpTest As New System.Text.RegularExpressions.Regex("^\d\d\d\d.*$", System.Text.RegularExpressions.RegexOptions.Compiled)    Property AC() As String        Get            Return m_AC        End Get        Set(ByVal value As String)            m_AC = value        End Set    End Property    Property Compiler() As String        Get            Return m_Compiler        End Get        Set(ByVal value As String)            m_Compiler = value        End Set    End Property    Function GetOldResults() As Generic.List(Of OldResult)        Dim result As New Generic.List(Of OldResult)        Dim files() As String = {}        Try            'files = IO.Directory.GetFiles(Me.OutputPath, Me.Name & ".*.testresult")        Catch io As IO.IOException        End Try        For Each file As String In files            result.Add(New OldResult(file))        Next        Return result    End Function    Public ReadOnly Property IsNegativeTest() As Boolean        Get            Return m_IsNegativeTest        End Get    End Property    ReadOnly Property NegativeError() As Integer        Get            Return m_NegativeError        End Get    End Property    Property Tag() As Object        Get            Return m_Tag        End Get        Set(ByVal value As Object)            m_Tag = value        End Set    End Property    ReadOnly Property LastRun() As Date        Get            Return m_LastRun        End Get    End Property#If DEBUG Then    Private id As Integer = Helper.nextID()#End If    Sub WriteToXML(ByVal xml As Xml.XmlWriter)        xml.WriteStartElement(Me.GetType.ToString)        xml.WriteElementString("Name", m_Name)        For Each file As String In m_Files            xml.WriteElementString("File", file)        Next        xml.WriteElementString("BasePath", m_BasePath)        xml.WriteElementString("OutputPath", m_OutputPath)        xml.WriteElementString("ResponseFile", m_ResponseFile)        xml.WriteElementString("ExitCode", ExitCode.ToString)        xml.WriteElementString("Result", m_Result.ToString)        xml.WriteElementString("StdOut", m_Compilation.Process.StdOut)        If Statistics IsNot Nothing Then Statistics.WriteToXML(xml)        xml.WriteEndElement()    End Sub    Sub LoadOldResults()        If m_LoadedOldResults Then Return        Dim oldresults As Generic.List(Of OldResult)        oldresults = Me.GetOldResults        If oldresults.Count > 0 Then            m_OldResult = oldresults.Item(oldresults.Count - 1).Result            If m_OldResult = Results.Failed Then                For i As Integer = oldresults.Count - 1 To 0 Step -1                    If oldresults(i).Result = Results.Success Then m_OldResult = Results.Regressed                Next            End If        Else            m_OldResult = Results.NotRun        End If        m_LoadedOldResults = True        RaiseEvent Changed(Me)    End Sub    ReadOnly Property TestDuration() As TimeSpan        Get            Return m_TestDuration        End Get    End Property    ''' <summary>    ''' The statistics for the test. Might be nothing (if test hasn't been run.)    ''' </summary>    ''' <value></value>    ''' <remarks></remarks>    ReadOnly Property Statistics() As TestStatistics        Get            If m_Compilation Is Nothing OrElse m_Compilation.Process Is Nothing Then                Return Nothing            End If            Return m_Compilation.Process.Statistics        End Get    End Property    ReadOnly Property Verifications() As VerificationBase()        Get            Return m_Verifications.ToArray        End Get    End Property    ''' <summary>    ''' The test container    ''' </summary>    ''' <value></value>    ''' <remarks></remarks>    Friend ReadOnly Property Parent() As Tests        Get            Return m_Parent        End Get    End Property    ''' <summary>    ''' Has this test been run?    ''' </summary>    ''' <value></value>    ''' <remarks></remarks>    ReadOnly Property Run() As Boolean        Get            Return m_Result > Results.NotRun        End Get    End Property    ''' <summary>    ''' The base path of where the code file(s) are    ''' </summary>    ''' <remarks></remarks>    ReadOnly Property BasePath() As String        Get            Return m_BasePath        End Get    End Property    ''' <summary>    ''' The path of where the output files are    ''' </summary>    ''' <value></value>    ''' <remarks></remarks>    ReadOnly Property OutputPath() As String        Get            Return m_OutputPath        End Get    End Property    ''' <summary>    ''' The files that contains this test.    ''' </summary>    ReadOnly Property Files() As Generic.List(Of String)        Get            Return m_Files        End Get    End Property    ''' <summary>    ''' The StdOut of the test    ''' </summary>    ''' <remarks></remarks>    ReadOnly Property StdOut() As String        Get            If m_Compilation IsNot Nothing Then                Return m_Compilation.Process.StdOut            Else                Return ""            End If        End Get    End Property    ''' <summary>    ''' The exit code of the compilation    ''' </summary>    ''' <remarks></remarks>    ReadOnly Property ExitCode() As Integer        Get            If m_Compilation Is Nothing OrElse m_Compilation.Process Is Nothing Then

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -