Browse Source

+ records with really 3 byte size tests added

pierre 23 years ago
parent
commit
9d81697c03
4 changed files with 97 additions and 3 deletions
  1. 27 1
      tests/test/cg/obj/ctest.c
  2. BIN
      tests/test/cg/obj/linux/m68k/ctest.o
  3. 30 1
      tests/test/cg/ptest.pp
  4. 40 1
      tests/test/cg/tcalext.pp

+ 27 - 1
tests/test/cg/obj/ctest.c

@@ -44,6 +44,12 @@ struct _3BYTE_
 	unsigned short u16;
 };
 
+struct _3BYTE_S
+{
+	unsigned short u16;
+	unsigned char w8;
+};
+
 struct _5BYTE_
 {
 	unsigned char  u8;
@@ -232,6 +238,11 @@ void test_param_struct_small(struct _3BYTE_ buffer)
 	global_u8bit = buffer.u8;
 	global_u16bit = buffer.u16;
 }
+void test_param_struct_small_s(struct _3BYTE_S buffer)
+{
+	global_u8bit = buffer.w8;
+	global_u16bit = buffer.u16;
+}
 
 void test_param_struct_medium(struct _5BYTE_ buffer)
 {
@@ -258,6 +269,11 @@ void test_param_mixed_struct_small(struct _3BYTE_ buffer, unsigned char y)
 	global_u8bit = y;
 	global_u16bit = buffer.u16;
 }
+void test_param_mixed_struct_small_s(struct _3BYTE_S buffer, unsigned char y)
+{
+	global_u8bit = y;
+	global_u16bit = buffer.u16;
+}
 
 void test_param_mixed_struct_medium(struct _5BYTE_ buffer, unsigned char y)
 {
@@ -343,6 +359,13 @@ struct _3BYTE_ test_function_small_struct()
 	test_struct.u16 = RESULT_U16BIT;
 	return test_struct;
 }
+struct _3BYTE_S test_function_small_struct_s()
+{
+        struct _3BYTE_S test_struct;
+	test_struct.u16 = RESULT_U16BIT;
+	test_struct.w8 = RESULT_U8BIT;
+	return test_struct;
+}
 
 struct _5BYTE_ test_function_medium_struct()
 {
@@ -362,7 +385,10 @@ struct _7BYTE_ test_function_struct()
 
 /*
   $Log$
-  Revision 1.5  2002-11-04 15:17:45  pierre
+  Revision 1.6  2002-11-18 00:42:16  pierre
+   + records with really 3 byte size tests added
+
+  Revision 1.5  2002/11/04 15:17:45  pierre
    * compatibility with C checks improved
 
   Revision 1.4  2002/09/07 15:40:56  peter

BIN
tests/test/cg/obj/linux/m68k/ctest.o


+ 30 - 1
tests/test/cg/ptest.pp

@@ -33,6 +33,11 @@ type
   u16 : word;
  end;
 
+ _3byte_s = record
+  u16 : word;
+  w8 : byte;
+ end;
+
  _5byte_ = record
   u8 : byte;
   u32 : cardinal;
@@ -102,11 +107,13 @@ procedure test_param_mixed_var_u8(var x: byte;y:byte); cdecl;
 { structure parameter testing }
 procedure test_param_struct_tiny(buffer :   _1BYTE_); cdecl;
 procedure test_param_struct_small(buffer :  _3BYTE_); cdecl;
+procedure test_param_struct_small_s(buffer :  _3BYTE_S); cdecl;
 procedure test_param_struct_medium(buffer : _5BYTE_); cdecl;
 procedure test_param_struct_large(buffer :  _7BYTE_); cdecl;
 { mixed with structure parameter testing }
 procedure test_param_mixed_struct_tiny(buffer :   _1BYTE_; y :byte); cdecl;
 procedure test_param_mixed_struct_small(buffer :  _3BYTE_; y :byte); cdecl;
+procedure test_param_mixed_struct_small_s(buffer :  _3BYTE_S; y :byte); cdecl;
 procedure test_param_mixed_struct_medium(buffer : _5BYTE_; y :byte); cdecl;
 procedure test_param_mixed_struct_large(buffer :  _7BYTE_; y :byte); cdecl;
 { function result value testing }
@@ -123,6 +130,7 @@ function test_function_double : double; cdecl;
 function test_function_longdouble: extended; cdecl;
 function test_function_tiny_struct : _1byte_; cdecl;
 function test_function_small_struct : _3byte_; cdecl;
+function test_function_small_struct_s : _3byte_s; cdecl;
 function test_function_medium_struct : _5byte_; cdecl;
 function test_function_struct : _7byte_; cdecl;
 
@@ -291,6 +299,12 @@ procedure test_param_struct_small(buffer :  _3BYTE_); cdecl;
   begin
     global_u8bit:=buffer.u8;
     global_u16bit:=buffer.u16;
+end;
+
+procedure test_param_struct_small_s(buffer :  _3BYTE_S); cdecl;
+  begin
+    global_u8bit:=buffer.w8;
+    global_u16bit:=buffer.u16;
   end;
 
 procedure test_param_struct_medium(buffer : _5BYTE_); cdecl;
@@ -318,6 +332,12 @@ procedure test_param_mixed_struct_small(buffer :  _3BYTE_; y :byte); cdecl;
     global_u16bit := buffer.u16;
   end;
 
+procedure test_param_mixed_struct_small_s(buffer :  _3BYTE_S; y :byte); cdecl;
+  begin
+    global_u8bit := y;
+    global_u16bit := buffer.u16;
+  end;
+
 procedure test_param_mixed_struct_medium(buffer : _5BYTE_; y :byte); cdecl;
   begin
     global_u8bit := y;
@@ -398,6 +418,12 @@ function test_function_small_struct : _3byte_; cdecl;
     test_function_small_struct.u16:=RESULT_U16BIT;
   end;
 
+function test_function_small_struct_s : _3byte_s; cdecl;
+  begin
+    test_function_small_struct_s.w8:=RESULT_U8BIT;
+    test_function_small_struct_s.u16:=RESULT_U16BIT;
+  end;
+
 function test_function_medium_struct : _5byte_; cdecl;
   begin
     test_function_medium_struct.u8:=RESULT_U8BIT;
@@ -418,7 +444,10 @@ end.
 
 {
   $Log$
-  Revision 1.1  2002-11-04 15:17:45  pierre
+  Revision 1.2  2002-11-18 00:42:16  pierre
+   + records with really 3 byte size tests added
+
+  Revision 1.1  2002/11/04 15:17:45  pierre
    * compatibility with C checks improved
 
 

+ 40 - 1
tests/test/cg/tcalext.pp

@@ -49,6 +49,11 @@ type
   u16 : word;
  end;
 
+ _3byte_s = record
+  u16 : word;
+  w8 : byte;
+ end;
+ 
  _5byte_ = record
   u8 : byte;
   u32 : cardinal;
@@ -107,11 +112,13 @@ procedure test_param_mixed_var_u8(var x: byte;y:byte); cdecl; external;
 { structure parameter testing }
 procedure test_param_struct_tiny(buffer :   _1BYTE_); cdecl; external;
 procedure test_param_struct_small(buffer :  _3BYTE_); cdecl; external;
+procedure test_param_struct_small_s(buffer :  _3BYTE_S); cdecl; external;
 procedure test_param_struct_medium(buffer : _5BYTE_); cdecl; external;
 procedure test_param_struct_large(buffer :  _7BYTE_); cdecl; external;
 { mixed with structure parameter testing }
 procedure test_param_mixed_struct_tiny(buffer :   _1BYTE_; y :byte); cdecl; external;
 procedure test_param_mixed_struct_small(buffer :  _3BYTE_; y :byte); cdecl; external;
+procedure test_param_mixed_struct_small_s(buffer :  _3BYTE_S; y :byte); cdecl; external;
 procedure test_param_mixed_struct_medium(buffer : _5BYTE_; y :byte); cdecl; external;
 procedure test_param_mixed_struct_large(buffer :  _7BYTE_; y :byte); cdecl; external;
 { function result value testing }
@@ -128,6 +135,7 @@ function test_function_double : double; cdecl; external;
 function test_function_longdouble: extended; cdecl; external;
 function test_function_tiny_struct : _1byte_; cdecl; external;
 function test_function_small_struct : _3byte_; cdecl; external;
+function test_function_small_struct_s : _3byte_s; cdecl; external;
 function test_function_medium_struct : _5byte_; cdecl; external;
 function test_function_struct : _7byte_; cdecl; external;
 
@@ -209,6 +217,7 @@ const
 var failed : boolean;
     tinystruct : _1BYTE_;
     smallstruct : _3BYTE_;
+    smallstruct_s : _3BYTE_S;
     mediumstruct : _5BYTE_;
     bigstruct : _7BYTE_;
     pc: pchar;
@@ -514,6 +523,17 @@ begin
     failed := true;
   if global_u8bit <> RESULT_U8BIT then
     failed := true;
+    
+  clear_values;
+  clear_globals;
+
+  smallstruct_s.u16 := RESULT_U16BIT;
+  smallstruct_s.w8 := RESULT_U8BIT;
+  test_param_struct_small_s(smallstruct_s);
+  if global_u16bit <> RESULT_U16BIT then
+    failed := true;
+  if global_u8bit <> RESULT_U8BIT then
+    failed := true;
 
   clear_values;
   clear_globals;
@@ -571,6 +591,16 @@ begin
   clear_values;
   clear_globals;
 
+  smallstruct_s.u16 := RESULT_U16BIT;
+  test_param_mixed_struct_small_s(smallstruct_s,RESULT_U8BIT);
+  if global_u16bit <> RESULT_U16BIT then
+    failed := true;
+  if global_u8bit <> RESULT_U8BIT then
+    failed := true;
+
+  clear_values;
+  clear_globals;
+
   mediumstruct.u32 := RESULT_U32BIT;
   test_param_mixed_struct_medium(mediumstruct,RESULT_U8BIT);
   if global_u32bit <> RESULT_U32BIT then
@@ -713,6 +743,12 @@ begin
   if smallstruct.u16 <> RESULT_U16BIT then
     failed := true;
 
+  smallstruct_s := test_function_small_struct_s;
+  if smallstruct_s.u16 <> RESULT_U16BIT then
+    failed := true;
+  if smallstruct_s.w8 <> RESULT_U8BIT then
+    failed := true;
+
   mediumstruct := test_function_medium_struct;
   if mediumstruct.u8 <> RESULT_U8BIT then
     failed := true;
@@ -745,7 +781,10 @@ end.
 
 {
   $Log$
-  Revision 1.7  2002-11-17 21:46:17  peter
+  Revision 1.8  2002-11-18 00:42:16  pierre
+   + records with really 3 byte size tests added
+
+  Revision 1.7  2002/11/17 21:46:17  peter
     * fixed
 
   Revision 1.6  2002/11/04 15:17:45  pierre