Sub Math Statistics Class

MedianOfThreeVerify

Signature (Visual Basic / VBA)

Private Sub MedianOfThreeVerify()
    ' Test the MedianOfThree function.

    Debug.Assert MedianOfThree(2, 1, 3) = 2
    Debug.Assert MedianOfThree(2, 3, 1) = 2
    
    Debug.Assert MedianOfThree(1, 2, 3) = 2
    Debug.Assert MedianOfThree(3, 2, 1) = 2
    
    Debug.Assert MedianOfThree(1, 3, 2) = 2
    Debug.Assert MedianOfThree(3, 1, 2) = 2


    Debug.Assert MedianOfThree(2, 2, 1) = 2
    Debug.Assert MedianOfThree(2, 2, 3) = 2
    
    Debug.Assert MedianOfThree(2, 1, 2) = 2
    Debug.Assert MedianOfThree(2, 3, 2) = 2
    
    Debug.Assert MedianOfThree(1, 2, 2) = 2
    Debug.Assert MedianOfThree(3, 2, 2) = 2

    
    Debug.Assert MedianOfThree(2, 2, 2) = 2

End Sub