Save away some of my tests.

This commit is contained in:
Bill Currie 2011-02-13 19:02:39 +09:00
parent 976ff8a6bb
commit ef32d1fb6d
5 changed files with 86 additions and 0 deletions

4
tools/qfcc/test/cast.r Normal file
View file

@ -0,0 +1,4 @@
void f(integer x, integer y)
{
x = (vector ()(quaternion x)) y;
}

View file

@ -0,0 +1,9 @@
void printf (string, ...) = #0;
integer main (integer argc, string *argv)
{
integer i;
for (i = 0; i < argc; i++)
printf ("%s\n", argv[i]);
return 0;
}

57
tools/qfcc/test/struct.r Normal file
View file

@ -0,0 +1,57 @@
struct _qfile_t {};
typedef struct _qfile_t *QFile;
@extern void Qclose (QFile file);
void (QFile file) Qclose = #0;
struct plitem_s {integer dummy;};
typedef struct plitem_s plitem_t;
@extern plitem_t PL_GetFromFile (QFile file);
@extern plitem_t PL_GetPropertyList (string str);
plitem_t PL_GetFromFile (QFile file) = #0;
typedef enum {
NO = 0, ///< the false value
YES ///< a true value
} BOOL;
@class Protocol;
@protocol Object
- (BOOL) conformsToProtocol: (Protocol *)aProtocol;
@end
@interface Object //<Object>
{
Class isa;
integer referenceCount;
}
- (BOOL) conformsToProtocol: (Protocol *)aProtocol;
@end
@class Array;
@interface AutoreleasePool: Object
{
Array *array; ///< a list of objects awaiting release
}
+ (void) addObject: (id)anObject;
@end
@interface Protocol : Object
{
@private
string protocol_name;
struct obj_protocol_list *protocol_list;
struct obj_method_description_list *instance_methods, *class_methods;
}
@end
void test_plist (void)
{
plitem_t pl;
pl = PL_GetPropertyList ("{}");
}

8
tools/qfcc/test/test2.qc Normal file
View file

@ -0,0 +1,8 @@
float (float a, float b) idiv =
{
return ((a & -1) / (b & -1)) & -1;
};
float (float a, float b) imod =
{
return (a & -1) - (b & -1) * (((a & -1) / (b & -1)) & -1);
};

View file

@ -0,0 +1,8 @@
@extern void bar (void *p);
void bar (void *p) = #0;
@extern void *foo (integer x);
void *foo (integer x)
{
return nil;
}