Sujet : Re: "RESET"
De : blockedofcourse (at) *nospam* foo.invalid (Don Y)
Groupes : sci.electronics.designDate : 27. May 2025, 22:13:02
Autres entêtes
Organisation : A noiseless patient Spider
Message-ID : <10159t3$2q2ds$1@dont-email.me>
References : 1 2 3
User-Agent : Mozilla Thunderbird
On 5/25/2025 12:33 PM, Joe Gwinn wrote:
Exactly. I recall a customer wanting us to verify all possible paths
through a bit of air traffic control radar software, about 100,000
lines of plain C. Roughly one in five executable line was an IF
statement, which is 20,000 IF statements. So there are 2^20000 =
10^6020 such paths.
And probably 99.9% of them are superfluous.
if (x % 2) {
x++
}
if (y == green) {
// do something
}
if (z < 0) {
// something else
}
The first conditional just deals with making "odd" values of x into even ones.
That can be completely tested regardless of which -- if any -- of the following
or preceding conditionals are invoked. I.e., you don't need to test for
x even, y green
x odd, y green
x even, y notgreen
x odd, y notgreen
Rather, you verify the correct operation of the first conditional with
a range of even and odd values (more than two are required to address
the proper operation with negative numbers, "zero" and any other special cases
that your compiler might tickle.
Then, with x now guaranteed to be even, you can try y as green and notgreen.
Then, with z positive vs non-negative.
I.e., approximately two cases for each conditional so 3*2=6 cases instead
of geometric explosion (2^3=8)
Experience teaches you to construct your code so that testability is
enhanced. Instead of waiting until it seems to be "done" and then
trying to reassure yourself that it works as intended -- usually by
throwing EXPECTED conditions at it and hoping for the expected
results (that's not testing).
You need 2^20000 if there are 2^20000 distinct outcomes (leaf nodes) in
your code. I strongly doubt that to be the case.
The testing campaign will have only scratched the surface when the Sun
runs out of hydrogen and goes supernova. Tomorrow's problem.
How do you test an electronic circuit? Let's impose an infinite number of
discrete voltages on each of the input signals and verify the correct
outputs for each? (Do you deliberately verify all ranges of signal values
and frequencies? Or, just say "operation outside of these conditions is
indeterminate"?)