From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use Pass/Fail tests with an Array of Boolean in which each boolean has an expected value of true/false?

Solved!
Go to solution

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)

0 Kudos
Message 1 of 3
(1,617 Views)
Solution
Accepted by topic author joaohlb

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?

0 Kudos
Message 2 of 3
(1,590 Views)

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.

0 Kudos
Message 3 of 3
(1,575 Views)