Comparing Multiple Values in a Teststand Single Case Step

Updated Apr 2, 2026

Reported In

Software

  • TestStand 2013

Solution

As of TestStand 2013, Case steps can evaluate multiple values as an array. For example, the Case statement could look like the following:  {5, 6, 10, 20}.

Additional Information

In previous versions of TestStand, however, the expression needs to be expanded to reflect the same functionality. Let's construct an example where the Select step expression is Locals.x. For a Case step to execute with the the values 5, 6, 10, 20, the expression would look like the following:
 
Locals.x == 5 ? 5 : Locals.x == 6 ? 6 : Locals.x == 10 ? 10 : Locals.x == 20 ? 20 : NAN

Take a look at this TestStand help page for information on the ?: conditional operator. Also, note that the use of NAN in the above expression has a caveat. If your code allows for Locals.x to ever be set as NAN (maybe due to an unexpected mathematical result), this case can be undesirably executed. As an alternative, you can use another number, such as -1 or INF, if you never expect Locals.x will be set to those values.