Changed tests to new standard library.
Fixed some regressions when converting to new standard library. git-svn-id: http://picoc.googlecode.com/svn/trunk@432 21eae674-98b7-11dd-bd71-f92a316d2d60
This commit is contained in:
parent
16a1872035
commit
2dd0dfb049
|
@ -9,6 +9,8 @@
|
||||||
|
|
||||||
FILE *CStdOut;
|
FILE *CStdOut;
|
||||||
|
|
||||||
|
static int ZeroValue = 0;
|
||||||
|
static int TRUEValue = 1;
|
||||||
static int EOFValue = EOF;
|
static int EOFValue = EOF;
|
||||||
static int SEEK_SETValue = SEEK_SET;
|
static int SEEK_SETValue = SEEK_SET;
|
||||||
static int SEEK_CURValue = SEEK_CUR;
|
static int SEEK_CURValue = SEEK_CUR;
|
||||||
|
@ -251,7 +253,7 @@ int StdioBasePrintf(struct ParseState *Parser, FILE *Stream, char *StrOut, int S
|
||||||
if (ShowType == &IntType)
|
if (ShowType == &IntType)
|
||||||
{
|
{
|
||||||
/* show a signed integer */
|
/* show a signed integer */
|
||||||
if (IS_INTEGER_NUMERIC(ThisArg))
|
if (IS_NUMERIC_COERCIBLE(ThisArg))
|
||||||
StdioFprintfWord(&SOStream, OneFormatBuf, ExpressionCoerceUnsignedInteger(ThisArg));
|
StdioFprintfWord(&SOStream, OneFormatBuf, ExpressionCoerceUnsignedInteger(ThisArg));
|
||||||
else
|
else
|
||||||
StdioOutPuts("XXX", &SOStream);
|
StdioOutPuts("XXX", &SOStream);
|
||||||
|
@ -259,7 +261,7 @@ int StdioBasePrintf(struct ParseState *Parser, FILE *Stream, char *StrOut, int S
|
||||||
else if (ShowType == &FPType)
|
else if (ShowType == &FPType)
|
||||||
{
|
{
|
||||||
/* show a floating point number */
|
/* show a floating point number */
|
||||||
if (IS_FP(ThisArg))
|
if (IS_NUMERIC_COERCIBLE(ThisArg))
|
||||||
StdioFprintfFP(&SOStream, OneFormatBuf, ExpressionCoerceFP(ThisArg));
|
StdioFprintfFP(&SOStream, OneFormatBuf, ExpressionCoerceFP(ThisArg));
|
||||||
else
|
else
|
||||||
StdioOutPuts("XXX", &SOStream);
|
StdioOutPuts("XXX", &SOStream);
|
||||||
|
@ -681,6 +683,11 @@ void StdioSetupFunc(void)
|
||||||
VariableDefinePlatformVar(NULL, "stdin", FilePtrType, (union AnyValue *)&stdinValue, FALSE);
|
VariableDefinePlatformVar(NULL, "stdin", FilePtrType, (union AnyValue *)&stdinValue, FALSE);
|
||||||
VariableDefinePlatformVar(NULL, "stdout", FilePtrType, (union AnyValue *)&stdoutValue, FALSE);
|
VariableDefinePlatformVar(NULL, "stdout", FilePtrType, (union AnyValue *)&stdoutValue, FALSE);
|
||||||
VariableDefinePlatformVar(NULL, "stderr", FilePtrType, (union AnyValue *)&stderrValue, FALSE);
|
VariableDefinePlatformVar(NULL, "stderr", FilePtrType, (union AnyValue *)&stderrValue, FALSE);
|
||||||
|
|
||||||
|
/* define NULL, TRUE and FALSE */
|
||||||
|
VariableDefinePlatformVar(NULL, "NULL", &IntType, (union AnyValue *)&ZeroValue, FALSE);
|
||||||
|
VariableDefinePlatformVar(NULL, "TRUE", &IntType, (union AnyValue *)&TRUEValue, FALSE);
|
||||||
|
VariableDefinePlatformVar(NULL, "FALSE", &IntType, (union AnyValue *)&ZeroValue, FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* portability-related I/O calls */
|
/* portability-related I/O calls */
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int a;
|
int a;
|
||||||
a = 42;
|
a = 42;
|
||||||
printf("%d\n", a);
|
printf("%d\n", a);
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
printf("Hello\n");
|
printf("Hello\n");
|
||||||
printf("Hello\n"); /* this is a comment */ printf("Hello\n");
|
printf("Hello\n"); /* this is a comment */ printf("Hello\n");
|
||||||
printf("Hello\n");
|
printf("Hello\n");
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
printf("Hello world\n");
|
printf("Hello world\n");
|
||||||
|
|
||||||
int Count;
|
int Count;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
struct fred
|
struct fred
|
||||||
{
|
{
|
||||||
int boris;
|
int boris;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int Count;
|
int Count;
|
||||||
|
|
||||||
for (Count = 1; Count <= 10; Count++)
|
for (Count = 1; Count <= 10; Count++)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int Count;
|
int Count;
|
||||||
int Array[10];
|
int Array[10];
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int Count;
|
int Count;
|
||||||
|
|
||||||
for (Count = 0; Count < 4; Count++)
|
for (Count = 0; Count < 4; Count++)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int myfunc(int x)
|
int myfunc(int x)
|
||||||
{
|
{
|
||||||
return x * x;
|
return x * x;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int a;
|
int a;
|
||||||
int p;
|
int p;
|
||||||
int t;
|
int t;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int a;
|
int a;
|
||||||
int p;
|
int p;
|
||||||
int t;
|
int t;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int a;
|
int a;
|
||||||
int *b;
|
int *b;
|
||||||
int c;
|
int c;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int a;
|
int a;
|
||||||
int b;
|
int b;
|
||||||
int c;
|
int c;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
#define FRED 12
|
#define FRED 12
|
||||||
#define BLOGGS(x) (12*(x))
|
#define BLOGGS(x) (12*(x))
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int a = 24680;
|
int a = 24680;
|
||||||
int b = 01234567;
|
int b = 01234567;
|
||||||
int c = 0x2468ac;
|
int c = 0x2468ac;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int a = 1;
|
int a = 1;
|
||||||
|
|
||||||
if (a)
|
if (a)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int factorial(int i)
|
int factorial(int i)
|
||||||
{
|
{
|
||||||
if (i < 2)
|
if (i < 2)
|
||||||
|
|
|
@ -1,12 +1,14 @@
|
||||||
int x, y, z;
|
#include <stdio.h>
|
||||||
|
|
||||||
for (x = 0; x < 2; x++)
|
int x, y, z;
|
||||||
{
|
|
||||||
for (y = 0; y < 3; y++)
|
for (x = 0; x < 2; x++)
|
||||||
{
|
{
|
||||||
for (z = 0; z < 3; z++)
|
for (y = 0; y < 3; y++)
|
||||||
{
|
{
|
||||||
printf("%d %d %d\n", x, y, z);
|
for (z = 0; z < 3; z++)
|
||||||
}
|
{
|
||||||
}
|
printf("%d %d %d\n", x, y, z);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -1,20 +1,22 @@
|
||||||
enum fred
|
#include <stdio.h>
|
||||||
{
|
|
||||||
a,
|
enum fred
|
||||||
b,
|
{
|
||||||
c,
|
a,
|
||||||
d,
|
b,
|
||||||
e = 54,
|
c,
|
||||||
f = 73,
|
d,
|
||||||
g,
|
e = 54,
|
||||||
h
|
f = 73,
|
||||||
};
|
g,
|
||||||
|
h
|
||||||
|
};
|
||||||
|
|
||||||
enum fred frod;
|
enum fred frod;
|
||||||
|
|
||||||
printf("%d %d %d %d %d %d %d %d\n", a, b, c, d, e, f, g, h);
|
printf("%d %d %d %d %d %d %d %d\n", a, b, c, d, e, f, g, h);
|
||||||
printf("%d\n", frod);
|
printf("%d\n", frod);
|
||||||
frod = 12;
|
frod = 12;
|
||||||
printf("%d\n", frod);
|
printf("%d\n", frod);
|
||||||
frod = e;
|
frod = e;
|
||||||
printf("%d\n", frod);
|
printf("%d\n", frod);
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
printf("including\n");
|
#include <stdio.h>
|
||||||
#include "18_include.h"
|
|
||||||
printf("done\n");
|
printf("including\n");
|
||||||
|
#include "18_include.h"
|
||||||
|
printf("done\n");
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int a;
|
int a;
|
||||||
int *b;
|
int *b;
|
||||||
int *c;
|
int *c;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int a;
|
int a;
|
||||||
int b;
|
int b;
|
||||||
int *d;
|
int *d;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int x = 'a';
|
int x = 'a';
|
||||||
char y = x;
|
char y = x;
|
||||||
|
|
||||||
|
|
|
@ -1,40 +1,43 @@
|
||||||
// variables
|
#include <stdio.h>
|
||||||
float a = 12.34 + 56.78;
|
#include <math.h>
|
||||||
printf("%f\n", a);
|
|
||||||
|
// variables
|
||||||
// infix operators
|
float a = 12.34 + 56.78;
|
||||||
printf("%f\n", 12.34 + 56.78);
|
printf("%f\n", a);
|
||||||
printf("%f\n", 12.34 - 56.78);
|
|
||||||
printf("%f\n", 12.34 * 56.78);
|
// infix operators
|
||||||
printf("%f\n", 12.34 / 56.78);
|
printf("%f\n", 12.34 + 56.78);
|
||||||
|
printf("%f\n", 12.34 - 56.78);
|
||||||
// comparison operators
|
printf("%f\n", 12.34 * 56.78);
|
||||||
printf("%d %d %d %d %d %d\n", 12.34 < 56.78, 12.34 <= 56.78, 12.34 == 56.78, 12.34 >= 56.78, 12.34 > 56.78, 12.34 != 56.78);
|
printf("%f\n", 12.34 / 56.78);
|
||||||
printf("%d %d %d %d %d %d\n", 12.34 < 12.34, 12.34 <= 12.34, 12.34 == 12.34, 12.34 >= 12.34, 12.34 > 12.34, 12.34 != 12.34);
|
|
||||||
printf("%d %d %d %d %d %d\n", 56.78 < 12.34, 56.78 <= 12.34, 56.78 == 12.34, 56.78 >= 12.34, 56.78 > 12.34, 56.78 != 12.34);
|
// comparison operators
|
||||||
|
printf("%d %d %d %d %d %d\n", 12.34 < 56.78, 12.34 <= 56.78, 12.34 == 56.78, 12.34 >= 56.78, 12.34 > 56.78, 12.34 != 56.78);
|
||||||
// assignment operators
|
printf("%d %d %d %d %d %d\n", 12.34 < 12.34, 12.34 <= 12.34, 12.34 == 12.34, 12.34 >= 12.34, 12.34 > 12.34, 12.34 != 12.34);
|
||||||
a = 12.34;
|
printf("%d %d %d %d %d %d\n", 56.78 < 12.34, 56.78 <= 12.34, 56.78 == 12.34, 56.78 >= 12.34, 56.78 > 12.34, 56.78 != 12.34);
|
||||||
a += 56.78;
|
|
||||||
printf("%f\n", a);
|
// assignment operators
|
||||||
|
a = 12.34;
|
||||||
a = 12.34;
|
a += 56.78;
|
||||||
a -= 56.78;
|
printf("%f\n", a);
|
||||||
printf("%f\n", a);
|
|
||||||
|
a = 12.34;
|
||||||
a = 12.34;
|
a -= 56.78;
|
||||||
a *= 56.78;
|
printf("%f\n", a);
|
||||||
printf("%f\n", a);
|
|
||||||
|
a = 12.34;
|
||||||
a = 12.34;
|
a *= 56.78;
|
||||||
a /= 56.78;
|
printf("%f\n", a);
|
||||||
printf("%f\n", a);
|
|
||||||
|
a = 12.34;
|
||||||
// prefix operators
|
a /= 56.78;
|
||||||
printf("%f\n", +12.34);
|
printf("%f\n", a);
|
||||||
printf("%f\n", -12.34);
|
|
||||||
|
// prefix operators
|
||||||
// type coercion
|
printf("%f\n", +12.34);
|
||||||
a = 2;
|
printf("%f\n", -12.34);
|
||||||
printf("%f\n", a);
|
|
||||||
printf("%f\n", sin(2));
|
// type coercion
|
||||||
|
a = 2;
|
||||||
|
printf("%f\n", a);
|
||||||
|
printf("%f\n", sin(2));
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
69.12
|
69.120000
|
||||||
69.12
|
69.120000
|
||||||
-44.44
|
-44.440000
|
||||||
700.6652
|
700.665200
|
||||||
0.217330
|
0.217330
|
||||||
1 1 0 0 0 1
|
1 1 0 0 0 1
|
||||||
0 1 1 1 0 0
|
0 1 1 1 0 0
|
||||||
0 0 0 1 1 1
|
0 0 0 1 1 1
|
||||||
69.12
|
69.120000
|
||||||
-44.44
|
-44.440000
|
||||||
700.6652
|
700.665200
|
||||||
0.217330
|
0.217330
|
||||||
12.34
|
12.340000
|
||||||
-12.34
|
-12.340000
|
||||||
2.0
|
2.000000
|
||||||
0.909297
|
0.909297
|
||||||
|
|
|
@ -1,45 +1,47 @@
|
||||||
void charfunc(char a)
|
#include <stdio.h>
|
||||||
{
|
|
||||||
printf("char: %c\n", a);
|
void charfunc(char a)
|
||||||
}
|
{
|
||||||
|
printf("char: %c\n", a);
|
||||||
void intfunc(int a)
|
}
|
||||||
{
|
|
||||||
printf("int: %d\n", a);
|
void intfunc(int a)
|
||||||
}
|
{
|
||||||
|
printf("int: %d\n", a);
|
||||||
void floatfunc(float a)
|
}
|
||||||
{
|
|
||||||
printf("float: %f\n", a);
|
void floatfunc(float a)
|
||||||
}
|
{
|
||||||
|
printf("float: %f\n", a);
|
||||||
charfunc('a');
|
}
|
||||||
charfunc(98);
|
|
||||||
charfunc(99.0);
|
charfunc('a');
|
||||||
|
charfunc(98);
|
||||||
intfunc('a');
|
charfunc(99.0);
|
||||||
intfunc(98);
|
|
||||||
intfunc(99.0);
|
intfunc('a');
|
||||||
|
intfunc(98);
|
||||||
floatfunc('a');
|
intfunc(99.0);
|
||||||
floatfunc(98);
|
|
||||||
floatfunc(99.0);
|
floatfunc('a');
|
||||||
|
floatfunc(98);
|
||||||
printf("%c %d %f\n", 'a', 'b', 'c');
|
floatfunc(99.0);
|
||||||
printf("%c %d %f\n", 97, 98, 99);
|
|
||||||
printf("%c %d %f\n", 97.0, 98.0, 99.0);
|
printf("%c %d %f\n", 'a', 'b', 'c');
|
||||||
|
printf("%c %d %f\n", 97, 98, 99);
|
||||||
char b = 97;
|
printf("%c %d %f\n", 97.0, 98.0, 99.0);
|
||||||
char c = 97.0;
|
|
||||||
|
char b = 97;
|
||||||
printf("%d %d\n", b, c);
|
char c = 97.0;
|
||||||
|
|
||||||
int d = 'a';
|
printf("%d %d\n", b, c);
|
||||||
int e = 97.0;
|
|
||||||
|
int d = 'a';
|
||||||
printf("%d %d\n", d, e);
|
int e = 97.0;
|
||||||
|
|
||||||
float f = 'a';
|
printf("%d %d\n", d, e);
|
||||||
float g = 97;
|
|
||||||
|
float f = 'a';
|
||||||
printf("%f %f\n", f, g);
|
float g = 97;
|
||||||
|
|
||||||
|
printf("%f %f\n", f, g);
|
||||||
|
|
|
@ -1,15 +1,15 @@
|
||||||
char: a
|
char: a
|
||||||
char: b
|
char: b
|
||||||
char: c
|
char: c
|
||||||
int: 97
|
int: 97
|
||||||
int: 98
|
int: 98
|
||||||
int: 99
|
int: 99
|
||||||
float: 97.0
|
float: 97.000000
|
||||||
float: 98.0
|
float: 98.000000
|
||||||
float: 99.0
|
float: 99.000000
|
||||||
a 98 99.0
|
a 98 99.000000
|
||||||
a 98 99.0
|
a 98 99.000000
|
||||||
a 98 99.0
|
a 98 99.000000
|
||||||
97 97
|
97 97
|
||||||
97 97
|
97 97
|
||||||
97.0 97.0
|
97.000000 97.000000
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
printf("%f\n", sin(0.12));
|
printf("%f\n", sin(0.12));
|
||||||
printf("%f\n", cos(0.12));
|
printf("%f\n", cos(0.12));
|
||||||
printf("%f\n", tan(0.12));
|
printf("%f\n", tan(0.12));
|
||||||
|
|
|
@ -1,18 +1,18 @@
|
||||||
0.119712
|
0.119712
|
||||||
0.992808
|
0.992809
|
||||||
0.120579
|
0.120579
|
||||||
0.120289
|
0.120290
|
||||||
1.450506
|
1.450506
|
||||||
0.119428
|
0.119429
|
||||||
0.120288
|
0.120288
|
||||||
1.007208
|
1.007209
|
||||||
0.119427
|
0.119427
|
||||||
1.127496
|
1.127497
|
||||||
0.12
|
0.120000
|
||||||
-2.120263
|
-2.120264
|
||||||
-0.920818
|
-0.920819
|
||||||
0.775357
|
0.775357
|
||||||
0.346410
|
0.346410
|
||||||
12.0
|
12.000000
|
||||||
13.0
|
13.000000
|
||||||
12.0
|
12.000000
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int array[16];
|
int array[16];
|
||||||
|
|
||||||
//Swap integer values by array indexes
|
//Swap integer values by array indexes
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
printf("%d\n", '\1');
|
printf("%d\n", '\1');
|
||||||
printf("%d\n", '\10');
|
printf("%d\n", '\10');
|
||||||
printf("%d\n", '\100');
|
printf("%d\n", '\100');
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
char a;
|
char a;
|
||||||
int b;
|
int b;
|
||||||
double c;
|
double c;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
char a[10];
|
char a[10];
|
||||||
|
|
||||||
strcpy(a, "hello");
|
strcpy(a, "hello");
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
char a[10];
|
char a[10];
|
||||||
strcpy(a, "abcdef");
|
strcpy(a, "abcdef");
|
||||||
printf("%s\n", &a[1]);
|
printf("%s\n", &a[1]);
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int a[4];
|
int a[4];
|
||||||
|
|
||||||
a[0] = 12;
|
a[0] = 12;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
char a;
|
char a;
|
||||||
short b;
|
short b;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int Count;
|
int Count;
|
||||||
|
|
||||||
int Array[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753 };
|
int Array[10] = { 12, 34, 56, 78, 90, 123, 456, 789, 8642, 9753 };
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
char Buf[100];
|
char Buf[100];
|
||||||
int Count;
|
int Count;
|
||||||
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int a[4][4];
|
int a[4][4];
|
||||||
int b = 0;
|
int b = 0;
|
||||||
int x;
|
int x;
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
typedef int MyInt;
|
typedef int MyInt;
|
||||||
|
|
||||||
MyInt a = 1;
|
MyInt a = 1;
|
||||||
|
|
Loading…
Reference in a new issue