home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS 1992 December
/
simtel1292_SIMTEL_1292_Walnut_Creek.iso
/
msdos
/
ada
/
adatu200.exe
/
FIBTEST.ADA
< prev
next >
Wrap
Text File
|
1991-03-25
|
912b
|
32 lines
with TEXT_IO; use TEXT_IO;
procedure FIBTEST is
PASSED : BOOLEAN := TRUE;
function FIB(N : in POSITIVE) return POSITIVE is separate;
procedure COMPARE (N : in POSITIVE; RIGHT_ANSWER : in POSITIVE) is
package INT_IO is new INTEGER_IO(INTEGER); use INT_IO;
MY_ANSWER : POSITIVE := FIB(N);
begin
if MY_ANSWER /= RIGHT_ANSWER then
PUT("N:"); PUT(N);
PUT(" My answer:"); PUT(MY_ANSWER);
PUT(" Right answer:"); PUT(RIGHT_ANSWER);
NEW_LINE;
PASSED := FALSE;
end if;
end COMPARE;
begin
COMPARE(1, 1);
COMPARE(2, 1);
COMPARE(3, 2);
COMPARE(4, 3);
COMPARE(5, 5);
COMPARE(6, 8);
COMPARE(7, 13);
COMPARE(10, 55);
COMPARE(15, 610);
COMPARE(20, 6765);
if PASSED then
PUT_LINE("Congratulations, you completed the assignment!");
end if;
end FIBTEST;