Listing 1. Test Script
with ADATEST_HARNESS_COMMANDS;
use ADATEST_HARNESS_COMMANDS;
with ADATEST_HARNESS_GENERIC_CHECKS;
use ADATEST_HARNESS_GENERIC_CHECKS;
with Verify_File_Crc;
procedure Test_Verify_File_CRC is
O_Success : Boolean;
E_Success : Boolean;
begin
START_SCRIPT("Test_Verify_File_CRC");
COMMENT("Test 1: File is OK");
E_Success := True;
START_TEST(1);
EXECUTE("Verify_File_CRC",
"File_IO.Open:1;" &
"CRC_Checker.Check_CRC:1;" &
"File_IO.Close:1"
,
EXCEPTION_NOT_EXPECTED);
begin
Verify_File_CRC("test.txt", O_Success);
exception when others =>
ILLEGAL_EXCEPTION;
end;
DONE;
CHECK("CRC is OK", O_Success, E_Success);
END_TEST;
COMMENT("Test 2: Error opening file");
E_Success := False;
START_TEST(2);
EXECUTE("Verify_File_CRC",
"File_IO.Open:2;" &
"Error_Logger.Log_Error:1;"
,
EXCEPTION_NOT_EXPECTED);
begin
Verify_File_CRC("test.txt", O_Success);
exception when others =>
ILLEGAL_EXCEPTION;
end;
DONE;
CHECK("CRC is OK", O_Success, E_Success);
END_TEST;
COMMENT("Test 3: CRC error in file");
E_Success := False;
START_TEST(3);
EXECUTE("Verify_File_CRC",
"File_IO.Open:1;" &
"CRC_Checker.Check_CRC:2;" &
"Error_Logger.Log_Error:1;" &
"File_IO.Close:1;"
,
EXCEPTION_NOT_EXPECTED);
begin
Verify_File_CRC("test.txt", O_Success);
exception when others =>
ILLEGAL_EXCEPTION;
end;
DONE;
CHECK("CRC is OK", O_Success, E_Success);
END_TEST;
END_SCRIPT;
end;