Results 1 to 2 of 2
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Yilgarn region of Toronto, Ontario
    Thanked 0 Times in 0 Posts

    Debug.Assert (office 2000+)

    Alright. What's going on here? Nothing in The Lounge about Debug.Assert

    I have resurrected my work on Regular Expressions and grown tired of my (stupid) MsgBox displays of results.
    I tried Debug.Assert.
    Why haven't I been using this in my self-testing functions?
    Why is no-one raving about it?<pre>Public Function blnRoman1(strIn As String, strMask As String) As Boolean
    Dim re As RegExp
    Set re = New RegExp
    re.Pattern = strMask
    re.Global = False ' Search this range
    Dim mc As MatchCollection
    Set mc = re.Execute(strIn)
    blnRoman1 = (mc.Count > 0)
    'Sub TESTblnRoman1()
    ' Debug.Assert blnRoman1("I", "^V?I{0,4}$") ' true
    ' Debug.Assert Not blnRoman1("a", "^V?I{0,4}$") ' false
    'End Sub
    End Function</pre>

    Debug.Assert will let me run a large number of test cases on a utility procedure; I can append new test cases as the procedure trips up and is enhanced.
    If the macro runs without stopping, the procedure has passed all the tests.

    I'm usually the last to learn something. Should I quit while I'm ahead?

  2. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Sacramento, California, USA
    Thanked 1 Time in 1 Post

    Re: Debug.Assert (office 2000+)

    Debug.Assert is used extensively in NUnit testing, but I have to admit I've never used it in VB/VBA, only in .Net.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts