I am given specific inputs that decrease in value over time e.g: +0.9716 mA,+0.9699 mA,+0.9686 mA,+0.9655 mA,+0.9650 mA,+0.9636 mA,+0.9618 mA,+0.9607 mA,+0.9581 mA,+0.9575 mA,+0.9562 mA,+0.9549 mA,+0.9523 mA,+0.9507 mA etc.
It's similar to a decreasing exponential curve in which I made a max and min range of values to ensure it is staying within the limits when decreasing. when outside these limits the test fails.
I feel like I am doing something wrong within the if statements or there may be a better way of going about this? Thanks!
Public Class Form1
Dim P_range0 As Double = 1.0672255
Dim P_range100 As Double = 0.9485795
Dim P_range200 As Double = 0.882981
Dim P_range300 As Double = 0.845339
Dim P_range400 As Double = 0.635712
Dim P_range500 As Double = 0.4302155
Dim M_range0 As Double = 0.8731845
Dim M_range100 As Double = 0.7761105
Dim M_range200 As Double = 0.722439
Dim M_range300 As Double = 0.691641
Dim M_range400 As Double = 0.520128
Dim M_range500 As Double = 0.3519945
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim var As String
var = TextBox1.Text
Dim numbers() As Double = var.Split(","c).Select(Function(s) Val(s)).ToArray()
If (M_range0 <= numbers(0)) AndAlso (numbers(0) <= P_range0) Then
If (M_range100 <= numbers(99)) AndAlso (numbers(99) <= P_range100) Then
MessageBox.Show("Test Passed")
End If
Else
MessageBox.Show("Test Failed")
End If
End Sub
Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.TextChanged
End Sub
End Class
Aucun commentaire:
Enregistrer un commentaire