Guideline: Test Ideas for Mixture of ANDs and ORs |
This page provides examples of test ideas based on boolean expressions combining ANDs and ORs.
Relationships
Related Elements | Test Ideas List
Main Description
This catalog applies to expressions that combine ANDs and ORs. As a reminder, here's how to derive test requirements for homogenous expressions: A1 && A2 && ... && An: one test idea with All Ai's true N cases, each of which has exactly one term false. Example:
A && B && C
A | B | C
--- | --- | ---
true | true | true
FALSE | true | true
true | FALSE | true
true | true | FALSE
A1 || A2 || ... || An: one test idea with All Ai's false N cases, each of which has exactly one term true. Example:
A || B || C
A | B | C
--- | --- | ---
FALSE | FALSE | FALSE
FALSE | true | FALSE
true | FALSE | FALSE
FALSE | FALSE | true
### Two Boolean Operators
(A && B) || C
A | B | C
--- | --- | ---
FALSE | true | true
true | true | FALSE
FALSE | true | FALSE
true | FALSE | FALSE
A && (B || C)
A | B | C
--- | --- | ---
true | FALSE | FALSE
true | FALSE | true
true | true | FALSE
FALSE | FALSE | true
A || (B && C)
A | B | C
--- | --- | ---
true | true | FALSE
FALSE | true | true
FALSE | FALSE | true
FALSE | true | FALSE
(A || B) && C
A | B | C
--- | --- | ---
FALSE | FALSE | true
FALSE | true | true
true | FALSE | true
FALSE | true | FALSE
### Three Boolean Operators One And To help find an expression, read down the columns. The ANDs drift from the left to the right as you read.
(A && B) || C || D |  | ((A || B) && C) || D
--- | --- | ---
A | B | C | D |  | A | B | C | D
FALSE | true | true | FALSE |  | FALSE | FALSE | true | FALSE
true | true | FALSE | FALSE |  | FALSE | true | true | FALSE
FALSE | true | FALSE | FALSE |  | true | FALSE | true | FALSE
true | FALSE | FALSE | FALSE |  | FALSE | FALSE | true | true
true | FALSE | FALSE | true |  | FALSE | true | FALSE | FALSE
A && (B || C || D) |  | A || (B && (C || D))
--- | --- | ---
A | B | C | D |  | A | B | C | D
true | FALSE | FALSE | FALSE |  | FALSE | true | FALSE | FALSE
true | FALSE | true | FALSE |  | FALSE | true | FALSE | true
true | true | FALSE | FALSE |  | FALSE | true | true | FALSE
true | FALSE | FALSE | true |  | true | true | FALSE | FALSE
FALSE | FALSE | FALSE | true |  | FALSE | FALSE | FALSE | true
A || (B && C) || D |  | A || B || (C && D)
--- | --- | ---
A | B | C | D |  | A | B | C | D
true | true | FALSE | FALSE |  | FALSE | true | true | FALSE
FALSE | true | true | FALSE |  | FALSE | FALSE | FALSE | true
FALSE | FALSE | true | FALSE |  | true | FALSE | true | FALSE
FALSE | true | FALSE | FALSE |  | FALSE | FALSE | true | true
FALSE | true | FALSE | true |  | FALSE | FALSE | true | FALSE
(A||B) && (C || D) |  | (A || B || C) && D
--- | --- | ---
A | B | C | D |  | A | B | C | D
FALSE | FALSE | FALSE | true |  | FALSE | FALSE | FALSE | true
FALSE | true | FALSE | true |  | FALSE | true | FALSE | true
true | FALSE | true | FALSE |  | true | FALSE | FALSE | true
FALSE | true | FALSE | FALSE |  | FALSE | FALSE | true | true
|  |  |  |  | FALSE | FALSE | true | FALSE
### Three Boolean Operators Two Ands To help find an expression, read down the columns. The ORs drift from the right to the left as you read
(A && B && C) || D |  | ((A && B) || C) && D
--- | --- | ---
A | B | C | D |  | A | B | C | D
true | true | true | FALSE |  | FALSE | true | true | true
FALSE | true | true | FALSE |  | true | true | FALSE | true
true | FALSE | true | FALSE |  | FALSE | true | FALSE | true
true | FALSE | true | true |  | true | FALSE | FALSE | true
true | true | FALSE | FALSE |  | true | FALSE | true | FALSE
A && B && (C || D) |  | A && (B || (C && D))
--- | --- | ---
A | B | C | D |  | A | B | C | D
true | true | FALSE | true |  | true | true | true | FALSE
FALSE | true | FALSE | true |  | true | FALSE | true | true
true | FALSE | FALSE | true |  | true | FALSE | FALSE | true
true | true | FALSE | FALSE |  | true | FALSE | true | FALSE
true | true | true | FALSE |  | FALSE | FALSE | true | true
A && (B || C) && D |  | (A || B) && C && D
--- | --- | ---
A | B | C | D |  | A | B | C | D
true | FALSE | FALSE | true |  | FALSE | FALSE | true | true
true | FALSE | true | true |  | FALSE | true | true | true
true | true | FALSE | true |  | true | FALSE | true | true
FALSE | FALSE | true | true |  | FALSE | true | FALSE | true
true | FALSE | true | FALSE |  | FALSE | true | true | FALSE
(A && B) || (C && D) |  | A || (B && C && D)
--- | --- | ---
A | B | C | D |  | A | B | C | D
FALSE | true | true | true |  | FALSE | true | true | true
true | true | true | FALSE |  | FALSE | FALSE | true | true
FALSE | true | FALSE | true |  | FALSE | true | FALSE | true
true | FALSE | true | FALSE |  | true | true | true | FALSE
|  |  |  |  | FALSE | true | true | FALSE
© Copyright IBM Corp. 1987, 2009. All Rights Reserved.