+ added structure testing

This commit is contained in:
carl 2002-04-22 19:09:02 +00:00
parent 03d841893e
commit aa66edd3c9
3 changed files with 93 additions and 2 deletions

View File

@ -8,6 +8,19 @@ unsigned short global_u16bit;
unsigned long global_u32bit;
unsigned long long global_s64bit;
struct _3BYTE_
{
unsigned char u8;
unsigned short u16;
};
struct _7BYTE_
{
unsigned char u8;
long long s64;
unsigned short u16;
};
/* simple parameter testing */
void test_param_u8(unsigned char v)
@ -51,9 +64,26 @@ void test_param_mixed_s64(unsigned char z, long long x, unsigned char y)
global_u8bit = y;
}
/* simple record testing */
void test_param_struct_small(struct _3BYTE_ buffer)
{
global_u8bit = buffer.u8;
global_u16bit = buffer.u16;
}
void test_param_struct_large(struct _7BYTE_ buffer)
{
global_u8bit = buffer.u8;
global_u16bit = buffer.u16;
global_s64bit = buffer.s64;
}
/*
$Log$
Revision 1.1 2002-04-13 21:06:39 carl
Revision 1.2 2002-04-22 19:09:12 carl
+ added structure testing
Revision 1.1 2002/04/13 21:06:39 carl
+ c module testing
*/

Binary file not shown.

View File

@ -21,12 +21,26 @@ program tcalext;
{$R+}
{$L ctest.o}
{ Use C alignment of records }
{$PACKRECORDS C}
const
RESULT_U8BIT = $55;
RESULT_U16BIT = $500F;
RESULT_U32BIT = $500F0000;
RESULT_S64BIT = -12000;
type
_3byte_ = record
u8 : byte;
u16 : word;
end;
_7byte_ = record
u8: byte;
s64: int64;
u16: word;
end;
{ simple parameter passing }
procedure test_param_u8(x: byte); cdecl; external;
@ -37,6 +51,13 @@ procedure test_param_s64(x: int64); cdecl; external;
procedure test_param_mixed_u16(z: byte; x : word; y :byte); cdecl; external;
procedure test_param_mixed_u32(z: byte; x: cardinal; y: byte); cdecl; external;
procedure test_param_mixed_s64(z: byte; x: int64; y: byte); cdecl; external;
{ structure parameter testing }
procedure test_param_struct_small(buffer : _3BYTE_); cdecl; external;
procedure test_param_struct_large(buffer : _7BYTE_); cdecl; external;
var
@ -73,6 +94,8 @@ var
var failed : boolean;
smallstruct : _3BYTE_;
bigstruct : _7BYTE_;
begin
Write('External simple parameter testing...');
failed := false;
@ -155,11 +178,49 @@ begin
else
WriteLn('Passed!');
Write('External struct parameter testing...');
failed := false;
clear_values;
clear_globals;
smallstruct.u8 := RESULT_U8BIT;
smallstruct.u16 := RESULT_u16BIT;
test_param_struct_small(smallstruct);
if global_u16bit <> RESULT_U16BIT then
failed := true;
if global_u8bit <> RESULT_U8BIT then
failed := true;
clear_values;
clear_globals;
bigstruct.u8 := RESULT_U8BIT;
bigstruct.u16 := RESULT_U16BIT;
bigstruct.s64 := RESULT_S64BIT;
test_param_struct_large(bigstruct);
if global_s64bit <> RESULT_S64BIT then
failed := true;
if global_u16bit <> RESULT_U16BIT then
failed := true;
if global_u8bit <> RESULT_U8BIT then
failed := true;
If failed then
fail
else
WriteLn('Passed!');
end.
{
$Log$
Revision 1.1 2002-04-13 21:03:43 carl
Revision 1.2 2002-04-22 19:09:28 carl
+ added structure testing
Revision 1.1 2002/04/13 21:03:43 carl
+ C module testing (unfinished)
}