moved tests that need special care into misc dir
This commit is contained in:
94
test/misc/fields.c
Normal file
94
test/misc/fields.c
Normal file
@@ -0,0 +1,94 @@
|
||||
/*
|
||||
!!DESCRIPTION!! bitfield test
|
||||
!!ORIGIN!! LCC 4.1 Testsuite
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include "common.h"
|
||||
|
||||
#ifdef NO_BITFIELDS
|
||||
|
||||
main()
|
||||
{
|
||||
printf("NO_BITFIELDS\n\r");
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
#ifdef SIZEOF_INT_16BIT
|
||||
|
||||
#ifdef REFCC
|
||||
#include <stdint.h>
|
||||
struct foo {
|
||||
int16_t a;
|
||||
char b;
|
||||
int16_t x : 12, y : 4;
|
||||
int16_t zz : 1, : 0, : 4, z : 3;
|
||||
char c;
|
||||
} x = { 1, 2, 3, 4, 5, 6 };
|
||||
|
||||
struct baz { uint16_t a:2, b:4, c:16;} y = { 7, 8, 9};
|
||||
int16_t i = 8;
|
||||
|
||||
#else
|
||||
|
||||
struct foo {
|
||||
int a;
|
||||
char b;
|
||||
int x : 12, y : 4;
|
||||
int zz : 1, : 0, : 4, z : 3;
|
||||
char c;
|
||||
} x = { 1, 2, 3, 4, 5, 6 };
|
||||
|
||||
struct baz { unsigned int a:2, b:4, c:16;} y = { 7, 8, 9};
|
||||
int i = 8;
|
||||
#endif
|
||||
|
||||
#else
|
||||
struct foo {
|
||||
int a;
|
||||
char b;
|
||||
int x : 12, y : 4, : 0, : 4, z : 3;
|
||||
char c;
|
||||
} x = { 1, 2, 3, 4, 5, 6 };
|
||||
|
||||
struct baz { unsigned int a:2, b:4, c:32;} y = { 7, 8, 9};
|
||||
int i = 16;
|
||||
#endif
|
||||
|
||||
#ifdef NO_IMPLICIT_FUNC_PROTOTYPES
|
||||
f1(struct baz *p);
|
||||
f2(struct baz *p);
|
||||
#endif
|
||||
|
||||
main()
|
||||
{
|
||||
printf("x = %d b:%d %d %d %d c:%d\n", x.a, x.b, x.x, x.y, x.z, x.c);
|
||||
printf("y = %d b:%d c:%d\n", y.a, y.b, y.c);
|
||||
x.y = i;
|
||||
x.z = 070;
|
||||
printf("x = %d b:%d %d %d %d c:%d\n", x.a, x.b, x.x, x.y, x.z, x.c);
|
||||
y.a = 2;
|
||||
y.c = i;
|
||||
printf("y = %d b:%d c:%d\n", y.a, y.b, y.c);
|
||||
#ifdef CAST_STRUCT_PTR
|
||||
f2((struct baz *)&x);
|
||||
#else
|
||||
f2(&x);
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
||||
f1(struct baz *p) {
|
||||
p->a = p->b = 0;
|
||||
if (p->b)
|
||||
printf("p->b != 0!\n");
|
||||
p->a = 0x3; p->b = 0xf;
|
||||
printf("p->a = 0x%x, p->b = 0x%x\n", p->a, p->b);
|
||||
}
|
||||
f2(struct baz *p) {
|
||||
p->a = (i==0);
|
||||
p->b = (f1(p),0);
|
||||
}
|
||||
|
||||
#endif
|
||||
56
test/misc/limits.c
Normal file
56
test/misc/limits.c
Normal file
@@ -0,0 +1,56 @@
|
||||
/*
|
||||
!!DESCRIPTION!! display type limits
|
||||
!!ORIGIN!! LCC 4.1 Testsuite
|
||||
!!LICENCE!! own, freely distributeable for non-profit. read CPYRIGHT.LCC
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
|
||||
#define SSHRT_MAX SHRT_MAX
|
||||
#define SINT_MAX INT_MAX
|
||||
#define SLONG_MAX LONG_MAX
|
||||
|
||||
#define UCHAR_MIN 0
|
||||
#define USHRT_MIN 0
|
||||
#define SSHRT_MIN SHRT_MIN
|
||||
#define UINT_MIN 0
|
||||
#define SINT_MIN INT_MIN
|
||||
#define ULONG_MIN 0l
|
||||
#define SLONG_MIN LONG_MIN
|
||||
|
||||
int main(void) {
|
||||
printf("CHAR_MAX: 0x%08x=%d\n", CHAR_MAX, CHAR_MAX);
|
||||
printf("UCHAR_MAX: 0x%08x=%d\n", UCHAR_MAX, UCHAR_MAX);
|
||||
printf("SCHAR_MAX: 0x%08x=%d\n", SCHAR_MAX, SCHAR_MAX);
|
||||
|
||||
printf("SHRT_MAX: 0x%08x=%d\n", SHRT_MAX, SHRT_MAX);
|
||||
printf("USHRT_MAX: 0x%08x=%d\n", USHRT_MAX, USHRT_MAX);
|
||||
printf("SSHRT_MAX: 0x%08x=%d\n", SSHRT_MAX, SSHRT_MAX);
|
||||
|
||||
printf("INT_MAX: 0x%08x=%d\n", INT_MAX, INT_MAX);
|
||||
printf("UINT_MAX: 0x%08x=%d\n", UINT_MAX, UINT_MAX);
|
||||
printf("SINT_MAX: 0x%08x=%d\n", SINT_MAX, SINT_MAX);
|
||||
|
||||
printf("LONG_MAX: 0x%08lx=%ld\n", LONG_MAX, LONG_MAX);
|
||||
printf("ULONG_MAX: 0x%08lx=%ld\n", ULONG_MAX, ULONG_MAX);
|
||||
printf("SLONG_MAX: 0x%08lx=%ld\n", SLONG_MAX, SLONG_MAX);
|
||||
|
||||
printf("CHAR_MIN: 0x%08x=%d\n", CHAR_MIN, CHAR_MIN);
|
||||
printf("UCHAR_MIN: 0x%08x=%d\n", UCHAR_MIN, UCHAR_MIN);
|
||||
printf("SCHAR_MIN: 0x%08x=%d\n", SCHAR_MIN, SCHAR_MIN);
|
||||
|
||||
printf("SHRT_MIN: 0x%08x=%d\n", SHRT_MIN, SHRT_MIN);
|
||||
printf("USHRT_MIN: 0x%08x=%d\n", USHRT_MIN, USHRT_MIN);
|
||||
printf("SSHRT_MIN: 0x%08x=%d\n", SSHRT_MIN, SSHRT_MIN);
|
||||
|
||||
printf("INT_MIN: 0x%08x=%d\n", INT_MIN, INT_MIN);
|
||||
printf("UINT_MIN: 0x%08x=%d\n", UINT_MIN, UINT_MIN);
|
||||
printf("SINT_MIN: 0x%08x=%d\n", SINT_MIN, SINT_MIN);
|
||||
|
||||
printf("LONG_MIN: 0x%08lx=%ld\n", LONG_MIN, LONG_MIN);
|
||||
printf("ULONG_MIN: 0x%08lx=%ld\n", ULONG_MIN, ULONG_MIN);
|
||||
printf("SLONG_MIN: 0x%08lx=%ld\n", SLONG_MIN, SLONG_MIN);
|
||||
|
||||
return 0;
|
||||
}
|
||||
1591
test/misc/sitest.c
Normal file
1591
test/misc/sitest.c
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user