<-- Previous || Up || Next -->

Unit Category Test Function
Units Class

Function UnitCategoryTest( _
    ) As Integer
    ' Find cases where there are multiple Category-type units whose definitions equate to
    ' the same combination of base units.

    Const strFn = "UnitCategoryTest"
    Debug.Print strFn & ": Info: Begin " & Time

    ' Assume that the definitions are valid; will reset return value to False when
    ' and if errors are found in the definitions.
    UnitCategoryTest = True

    InitializeMaybe

    ' Find Category-type definitions whose actual/calculated Category is different from the user-specified category name.
    Dim lngCurUnit As Long
    For lngCurUnit = 1 To GetUnitCount
        Dim strUniCode As String
        Dim strUniCat As String
        Dim strUniType As String
        Dim varIgn As Variant

        If Not GetUnit(lngCurUnit, strUniCode, varIgn, varIgn, varIgn, varIgn, varIgn, strUniCat, strUniType) Then
            UnitCategoryTest = False
            Exit Function
        End If

        If StrComp(strUniType, TypeCategory, vbTextCompare) = 0 Then
            If StrComp(strUniCat, FindCategory(strUniCode), vbTextCompare) <> 0 Then
                Debug.Print strFn & ": Warning: " & strUniCode & " == " & FindCategory(strUniCode)
            End If
        End If
    Next lngCurUnit

    Debug.Print strFn & ": Info: End " & Time
End Function

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.