Lecture 4

This makes a good test suite when you are searching for an element in a list

Empty list

Single element list 

            Element not there

            Element there

Multiple element lists

            First position

            Last position

            Middle position

                        There

                        Not there

            Too low (off at lower end)

            Too high (off at higher end)

 

The tests you will design for your program will differ but this list should provide a guide!

 

 

Discussed Dos commands for

changing drive

showing directories only

changing to a directory

seeing just executable files..

 

Using re-direction to take input from a text file and have the program’s output go to a file

            Done from the command line

            Get to the command line using   START  RUN  CMD

            Must use an executable  file

            If using redirection all input comes from the input file and all output goes to the output file.

 

Looked at how to modify binary_search_test.adb

Only tricky part was indicating that the list_type and binary_search came from bin_search

 

Then we looked at how to handle files

 

 

Reminders of things discussed in the past

  • instantiation
  • type compatibility
  • semi-colon as a statement terminator
  • main program unit is a procedure
  • every program needs at least one executable statement between the begin and the end
  • to produce output need appropriate WITH clauses
  • Ada is NOT case sensitive – but we will use standard style conventions although we didn’t do so today

n       Ada has :

n       reserved words

n       the ability to input and output enumerated type values directly

n       named parameters

n       := as the assignment operator

n       -- on a line indicates the start of a comment and no code can follow the comment

n       => is called an “arrow” and we saw its use in named parameter passing

n         is called a tick – all discrete types have attributes such as ‘first  and ‘last 

  • if you want to output different types of values on a single line, you will need a separate put statement for each value
  • Ada has three different parameter passing modes