Testing a program – HP 35s Scientific Calculator User Manual

Page 193

Advertising
background image

Simple Programming

13-11

Testing a Program

If you know there is an error in a program, but are not sure where the error is, then
a good way to test the program is by stepwise execution. It is also a good idea to
test a long or complicated program before relying on it. By stepping through its
execution, one line at a time, you can see the result after each program line is
executed, so you can verify the progress of known data whose correct results are
also known.
1. As for regular execution, make sure program entry is not active (PRGM

annunciator off).

2. Set the program pointer to the start of the program (that is, at its LBL

instruction). The instruction moves the program pointer without starting
execution.

3. Press and hold

Ø

. This displays the current program line. When you release

Ø

, the line is executed. The result of that execution is then displayed (it is in

the X–register).
To move to the preceding line, you can press

×

. No execution occurs.

4. The program pointer moves to the next line. Repeat step 3 until you find an

error (an incorrect result occurs) or reach the end of the program.

If Program–entry mode is active, then

Ø

or

×

simply changes the program

pointer, without executing lines. Holding down a cursor key during program entry
makes the lines roll by automatically.

Example:

Testing a Program.

Step through the execution of the program labeled A. Use a radius of 5 for the test
data. Check that Program–entry mode is not active before you start:

Keys:

(In RPN mode)

Display:

Description:





Moves program counter to label A.

Ø

(hold) (release)

  


Ø

(hold) (release)

 



Squares input.

Advertising