Testfall für MED2001 in meddfntstx

This commit is contained in:
2026-09-18 13:58:26 +02:00
parent ba7287da03
commit 59293da7ed
+94 -23
View File
@@ -1,28 +1,12 @@
**FREE
//=====================================================================
//
// Project.....: MEDDFN
//
// Member......: MEDDFNTSTX
//
// Description.: MEDDFN Parser Error Test Program
//
// Erstellen mit:
//
// CRTRPGMOD MODULE(GOSCH1/MEDDFNTSTX)
// SRCSTMF('/home/GOSCH/meddfn/meddfntstx.rpgle')
// OPTION(*EVENTF)
// DBGVIEW(*SOURCE)
// TGTRLS(*CURRENT)
//
// CRTPGM PGM(GOSCH1/MEDDFNTSTX)
// MODULE(GOSCH1/MEDDFNTSTX GOSCH1/MEDDFNPRS)
// ACTGRP(*NEW)
// TGTRLS(*CURRENT)
//
//
//=====================================================================
//=====================================================================
//
// Program.......: MEDDFNTSTX
//
// Description...: MEDDFN Parser Error Test Program
//
//=====================================================================
ctl-opt
option(*srcstmt:*nodebugio);
@@ -83,6 +67,9 @@ dcl-ds Error
TestReceiverTooSmall();
TestInvalidHeader();
dsply '----------------------------------------';
dsply 'MEDDFN Parser Error Test completed';
dsply '----------------------------------------';
@@ -148,6 +135,90 @@ dcl-proc TestReceiverTooSmall;
endif;
if %trim(Error.MessageData) = '';
dsply 'PASS Error.MessageData';
else;
dsply 'FAIL Error.MessageData';
endif;
end-proc;
//=====================================================================
//
// TestInvalidHeader
//
// Tests parser handling of an invalid TAPE0200 header.
//
// The receiver buffer is large enough for the complete header, but
// LengthOfHeader contains an invalid value.
//
// Expected error:
//
// MDF2001 - Invalid TAPE0200 header
//
//=====================================================================
dcl-proc TestInvalidHeader;
dcl-ds Header
likeds(MD_Tape0200Header_T)
inz;
dsply '----------------------------------------';
dsply 'Test: Invalid TAPE0200 header';
dsply '----------------------------------------';
clear ReceiverBuffer;
clear MediaDefinition;
clear Error;
clear Header;
Header.LengthOfHeader = 0;
%subst(
ReceiverBuffer :
1 :
%size(Header)) = Header;
ReceiverLength = %size(Header);
monitor;
MD_ParseRetrieveBuffer(
ReceiverBuffer :
ReceiverLength :
MediaDefinition :
Error);
on-error;
dsply 'FAIL Unexpected runtime error';
return;
endmon;
if Error.HasError;
dsply 'PASS Error.HasError';
else;
dsply 'FAIL Error.HasError';
endif;
if Error.MessageID = 'MDF2001';
dsply 'PASS Error.MessageID';
else;
dsply 'FAIL Error.MessageID';
endif;
if %trim(Error.MessageData) = '';
dsply 'PASS Error.MessageData';
else;