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,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
int x, y, z;
|
int x, y, z;
|
||||||
|
|
||||||
for (x = 0; x < 2; x++)
|
for (x = 0; x < 2; x++)
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
enum fred
|
enum fred
|
||||||
{
|
{
|
||||||
a,
|
a,
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
printf("including\n");
|
printf("including\n");
|
||||||
#include "18_include.h"
|
#include "18_include.h"
|
||||||
printf("done\n");
|
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,3 +1,6 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <math.h>
|
||||||
|
|
||||||
// variables
|
// variables
|
||||||
float a = 12.34 + 56.78;
|
float a = 12.34 + 56.78;
|
||||||
printf("%f\n", a);
|
printf("%f\n", a);
|
||||||
|
|
|
@ -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,3 +1,5 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
void charfunc(char a)
|
void charfunc(char a)
|
||||||
{
|
{
|
||||||
printf("char: %c\n", a);
|
printf("char: %c\n", a);
|
||||||
|
|
|
@ -4,12 +4,12 @@ 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