[7.25] Use Scripts To Test Program And Functions - Texas Instruments TI-89 Tip List

Graphing calculator
Hide thumbs Also See for TI-89:
Table of Contents

Advertisement

The first line describes how to run the setup script. The second line runs the setup() program. The third
line deletes the set-up program, and the fourth line deletes the set-up script.
The set-up script can be created in the text editor or in GraphLink.
Christopher Messick adds these comments:
I noticed through accident that TI-89 text files have a self-destructive property (they can delete
themselves). The above script runs the setup program, then deletes the program, then will delete
itself from memory. It can do this because it doesn't execute directly from the text editor itself, but
temporarily switches to the home screen "application," and pastes the command to the command
line to execute the it. Afterwords, it returns to the text editor.
(credit to Christopher Messick)

[7.25] Use scripts to test program and functions

Scripts are text files that include commands that you can execute from the text editor. See the
TI89/92+ Guidebook, page 328 for details. Also see page 94 for instructions to save the home screen
as a text file, to be used as a script.
This can be very useful as you are testing and debugging functions with different arguments. You can
enter each function call as a command in the script file. This also makes 'regression testing' easier.
Regression testing is a software engineering term that refers to verifying that a function still works
properly after changes have been made. Suppose that you have written a function and tested it, and
you think that it is correct. However, after using it for a while, you find that it does not work for some
arguments. If you have saved the test calls as a script file, you can easily verify that your corrections
do not affect the parts of the program that did work, before.
You can also use commands in the script file to change the modes (Auto, Exact, Radians, Complex,
etc.) and change folders, if necessary. Any command that can be executed from the command line can
be included in the script file.
Using script files for testing works best if the Split screen display mode is used. This way, you can see
both the script file commands and the results.
As an example, suppose I have written a function to find the cumulative normal distribution called cnd()
in my \main folder. This function takes three arguments and returns a single numeric result. I want to
test it with a variety of input argument combinations, and compare the results to those I have found
from another source. I use the text editor ([APPS] [8]) to create a new text file with the name cndtest.
The text file looks like this:
7 - 24

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Ti-92+

Table of Contents