Path: ...!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!eternal-september.org!.POSTED!not-for-mail From: Don Y Newsgroups: sci.electronics.design Subject: Re: "RESET" Date: Tue, 27 May 2025 14:13:02 -0700 Organization: A noiseless patient Spider Lines: 58 Message-ID: <10159t3$2q2ds$1@dont-email.me> References: <100thgs$v8cm$1@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Injection-Date: Tue, 27 May 2025 23:13:07 +0200 (CEST) Injection-Info: dont-email.me; posting-host="0fcfd38ca8dc92955a3ff8e92594f35b"; logging-data="2951612"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19/n3CwFPml0x8eW73b9gOI" User-Agent: Mozilla Thunderbird Cancel-Lock: sha1:kfzILKI72/Yvxtu7WrgGVUc3fbs= In-Reply-To: Content-Language: en-US Bytes: 3284 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"?)