Results 1 to 2 of 2
  1. #1
    Platinum Lounger
    Join Date
    Feb 2001
    Location
    Yilgarn region of Toronto, Ontario
    Posts
    5,453
    Thanks
    0
    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. Get our unique weekly Newsletter with tips and techniques, how to's and critical updates on Windows 7, Windows 8, Windows XP, Firefox, Internet Explorer, Google, etc. Join our 480,000 subscribers!

    Excel 2013: The Missing Manual

    + Get this BONUS — free!

    Get the most of Excel! Learn about new features, basics of creating a new spreadsheet and using the infamous Ribbon in the first chapter of Excel 2013: The Missing Manual - Subscribe and download Chapter 1 for free!

  3. #2
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    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.
    Charlotte

Posting Permissions

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