• Class NumericAssertion

    By Andrew Magerman 1 decade ago

    Dear Tony,

    First of all bravo for the unit framework. I use Junit a lot when coding in Java and I was trying to find a similar solution for LS.

    In the SL DUF:CoreAssertions, there are some references to lsconst.lss constants which are not immediately visible because you have turned off Option Declare (not sure why since you are obviously experiened).

    Personally, I hate the brain-dead way that the LS compiler deals with constants and just insert magic numbers everywhere, like this:

            Case 2 'V_INTEGER:
                Dim int1 As Integer

    As the author of a small project myself, I know how little people thankyou, so here is a big THANKYOU!!!!

    All the best,

    Andrew Magerman

     

     

    Function AssertEqual(val1 As Variant, val2 As Variant) As Integer
            AssertEqual = False
            On Error Goto StoreError
            Select Case Datatype(val1)
            Case V_INTEGER:
                Dim int1 As Integer
                Dim int2 As Integer
                int1 = Cint(val1)
                int2 = Cint(val2)
                If (int1=int2) Then
                    AssertEqual = True
                End If
            Case V_LONG:
                Dim long1 As Long
                Dim long2 As Long
                long1 = Clng(val1)