09-02-2020 10:39 AM
Teststand already has native Test to compare array of numbers giving expected value for each array element.
Is there any way of doing this with an Array of booleans?
in example, considering an array of 4 booleans, I would like to do something like
Pass/Fail test
Array[0] Expected: False
Array[1] Expected: True
Array[2] Expected: True
Array[3] Expected: False
Will only pass if all elements match their expected, but needs to have that comparison for each element logged for Report? So, for the given result, report would show:
Array[0] = False, (Passed)
Array[1] = False, (Failed)
Array[2] = True, (Passed)
Array[3] = False, (Passed)
Solved! Go to Solution.
09-02-2020 03:53 PM
You can code the array of boolean as a number and compare it with the expected result (that would be a numeric value as well). That would simplify the management of the acquisition and comparison.
Is there any reason you must use the array of boolean?
09-03-2020 07:35 AM
Thanks for your answer, that would in fact be a reasonable solution.
The reason was just report aesthetics. It would be better to read the report for True/False then 1/0. For that I tried to use a String comparison instead and convert to "True"/"False", but in that case I wouldn't be able to work with the entire array, so I created a new subsequence with several steps to compare bool as a string comparison. It seems to work fine.
Once my problem is solved, I'm just curious if there is a way of changing that multiple numeric limits comparison to another types of variable as a more elegant way of dealing with this.