Changeset 10dc7491


Ignore:
Timestamp:
Jun 22, 2016, 4:35:32 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
8b52686
Parents:
6bc4734
Message:

add more tests

Location:
src/tests
Files:
4 added
10 edited
1 moved

Legend:

Unmodified
Added
Removed
  • src/tests/Enum.c

    r6bc4734 r10dc7491  
    11//Testing enum declaration
    2 enum Colors {
     2enum Colours {
    33        Red,
    44        Yellow,
     
    1010};
    1111
     12enum Colours c1;
     13Colours c2;
     14
    1215void f( void ) {
    1316        enum Fruits {
     
    1720                Mango
    1821        } fruit = Mango;
     22        enum Fruits f1;
     23        Fruits f2;
    1924}
    2025
    2126//Dummy main
    22 int main(int argc, char const *argv[])
    23 {
    24         return 0;
     27int main(int argc, char const *argv[]) {
    2528}
  • src/tests/GccExtensions.c

    r6bc4734 r10dc7491  
    1 int main(int argc, char const *argv[])
    2     asm( "nop" );
    3     __asm( "nop" );
    4     __asm__( "nop" );
     1int main(int argc, char const *argv[]) {
     2        asm( "nop" );
     3        __asm( "nop" );
     4        __asm__( "nop" );
    55
    6     __complex__ c1;
    7     _Complex c2;
     6        __complex__ c1;
     7        _Complex c2;
    88
    9     const int i1;
    10     __const int i2;
    11     __const__ int i3;
     9        const int i1;
     10        __const int i2;
     11        __const__ int i3;
    1212
    13     __extension__ const int ex;
     13        __extension__ const int ex;
     14        struct S {
     15                __extension__ int a, b, c;
     16        };
     17        int i = __extension__ 3;
     18        __extension__ int a, b, c;
     19        __extension__ a, __extension__ b, __extension__ c;
     20        __extension__ a = __extension__ b + __extension__ c;
     21        __extension__ a = __extension__ ( __extension__ b + __extension__ c );
    1422
    15     __inline int f1();
    16     __inline__ int f2();
     23        __inline int f1() {}
     24        __inline__ int f2() {}
    1725
    18     __signed s1;
    19     __signed s2;
     26        __signed s1;
     27        __signed s2;
    2028
    21     __otypeof(s1) t1;
    22     __otypeof__(s1) t2;
     29        __typeof(s1) t1;
     30        __typeof__(s1) t2;
    2331
    24     __volatile int v1;
    25     __volatile__ int v2;
     32        __volatile int v1;
     33        __volatile__ int v2;
    2634
    27     __attribute__(()) int a1;
    28     const __attribute(()) int a2;
    29     const static __attribute(()) int a3;
    30     const static int __attribute(()) a4;
    31     const static int a5 __attribute(());
    32     const static int a6, __attribute(()) a7;
     35        __attribute__(()) int a1;
     36        const __attribute(()) int a2;
     37        const static __attribute(()) int a3;
     38        const static int __attribute(()) a4;
     39        const static int a5 __attribute(());
     40        const static int a6, __attribute(()) a7;
    3341
    34     int * __attribute(()) p1;
    35     int (* __attribute(()) p2);
    36 //    int (__attribute(()) (p3));
    37 //    int ( __attribute(()) (* __attribute(()) p4));
     42        int * __attribute(()) p1;
     43        int (* __attribute(()) p2);
     44//      int (__attribute(()) (p3));
     45//      int ( __attribute(()) (* __attribute(()) p4));
    3846
    39     struct __attribute(()) s1;
    40     struct __attribute(()) s2 { int i; };
    41     struct __attribute(()) s3 { int i; } x1, __attribute(()) y1;
    42     struct __attribute(()) s4 { int i; } x2, y2 __attribute(());
     47        struct __attribute(()) s1;
     48        struct __attribute(()) s2 { int i; };
     49        struct __attribute(()) s3 { int i; } x1, __attribute(()) y1;
     50        struct __attribute(()) s4 { int i; } x2, y2 __attribute(());
    4351
    44     int m1 [10] __attribute(());
    45     int m2 [10][10] __attribute(());
    46     int __attribute(()) m3 [10][10];
    47 //    int ( __attribute(()) m4 [10] )[10];
     52        int m1 [10] __attribute(());
     53        int m2 [10][10] __attribute(());
     54        int __attribute(()) m3 [10][10];
     55//      int ( __attribute(()) m4 [10] )[10];
    4856
    4957        return 0;
  • src/tests/IdentFuncDeclarator.c

    r6bc4734 r10dc7491  
    11int main() {
    2         //int f0[]();
    3         //int (f0[])();
    4         //int f0()[];
    5         //int f0()();
    6         //int (*f0)()();
    7         //int ((*f0())())[];
    8 
    92        int f1;
    103        int (f2);
     
    2518        int (* const * const f14);
    2619
    27         int f15[];
     20        int f15[2];
    2821        int f16[10];
    29         int (f17[]);
     22        int (f17[2]);
    3023        int (f18[10]);
    3124
    32         int *f19[];
     25        int *f19[2];
    3326        int *f20[10];
    34         int **f21[];
     27        int **f21[2];
    3528        int **f22[10];
    36         int * const *f23[];
     29        int * const *f23[2];
    3730        int * const *f24[10];
    38         int * const * const f25[];
     31        int * const * const f25[2];
    3932        int * const * const f26[10];
    4033
    41         int *(f27[]);
     34        int *(f27[2]);
    4235        int *(f28[10]);
    43         int **(f29[]);
     36        int **(f29[2]);
    4437        int **(f30[10]);
    45         int * const *(f31[]);
     38        int * const *(f31[2]);
    4639        int * const *(f32[10]);
    47         int * const * const (f33[]);
     40        int * const * const (f33[2]);
    4841        int * const * const (f34[10]);
    4942
    50         int (*f35[]);
     43        int (*f35[2]);
    5144        int (*f36[10]);
    52         int (**f37[]);
     45        int (**f37[2]);
    5346        int (**f38[10]);
    54         int (* const *f39[]);
     47        int (* const *f39[2]);
    5548        int (* const *f40[10]);
    56         int (* const * const f41[]);
     49        int (* const * const f41[2]);
    5750        int (* const * const f42[10]);
    5851
    59         int f43[][3];
     52        int f43[2][3];
    6053        int f44[3][3];
    61         int (f45[])[3];
     54        int (f45[2])[3];
    6255        int (f46[3])[3];
    63         int ((f47[]))[3];
     56        int ((f47[2]))[3];
    6457        int ((f48[3]))[3];
    6558
    66         int *f49[][3];
     59        int *f49[2][3];
    6760        int *f50[3][3];
    68         int **f51[][3];
     61        int **f51[2][3];
    6962        int **f52[3][3];
    70         int * const *f53[][3];
     63        int * const *f53[2][3];
    7164        int * const *f54[3][3];
    72         int * const * const f55[][3];
     65        int * const * const f55[2][3];
    7366        int * const * const f56[3][3];
    7467
    75         int (*f57[][3]);
     68        int (*f57[2][3]);
    7669        int (*f58[3][3]);
    77         int (**f59[][3]);
     70        int (**f59[2][3]);
    7871        int (**f60[3][3]);
    79         int (* const *f61[][3]);
     72        int (* const *f61[2][3]);
    8073        int (* const *f62[3][3]);
    81         int (* const * const f63[][3]);
     74        int (* const * const f63[2][3]);
    8275        int (* const * const f64[3][3]);
    8376
  • src/tests/IdentFuncParamDeclarator.c

    r6bc4734 r10dc7491  
    11int fred(
    2         //int f0[](),
    3         //int (f0[])(),
    4         //int f0()[],
    5         //int f0()(),
    6         //int (*f0)()(),
    7         //int ((*f0())())[],
    8 
    92        int f1,
    103        int (f2),
     
    147140        int * const *(f116[static const 3][3]),
    148141        int * const * const (f117[static const 3][3])
    149         ) {
    150 }
     142    );
    151143
    152144//Dummy main
  • src/tests/LabelledExit.c

    r6bc4734 r10dc7491  
    1 int main() {
     1int foo() {
    22        int i;
    33        int x, y;
     
    130130        }
    131131
    132 #if 0
     132#if 1
    133133  Q: if ( i > 5 ) {
    134134                i += 1;
  • src/tests/NumericConstants.c

    r6bc4734 r10dc7491  
    11int main() {
    2     1;                                                  /* decimal */
    3     2_1;
    4     2_147_483_647;
    5     37LL;
    6     45ull;
    7     89llu;
    8     99LLu;
    9     56_lu;
    10     88_LLu;
     2        1;                                                      // decimal
     3        2_1;
     4        2_147_483_647;
     5        37LL;
     6        45ull;
     7        89llu;
     8        99LLu;
     9        56_lu;
     10        88_LLu;
    1111
    12 //    0;                                                        /* octal */
    13     0u;
    14     0_3_77;
    15     0_377_ul;
     12//      0;                                                      // octal
     13        0u;
     14        0_3_77;
     15        0_377_ul;
    1616
    17     0x1;                                                /* hexadecimal */
    18     0x1u;
    19     0xabL;
    20     0x_80000000;
    21     0x_fff;
    22     0x_ef3d_aa5c;
    23     0x_3LL;
     17        0x1;                                            // hexadecimal
     18        0x1u;
     19        0xabL;
     20        0x_80000000;
     21        0x_fff;
     22        0x_ef3d_aa5c;
     23        0x_3LL;
    2424
    25     3.;                                                 /* integral real */
    26     3_100.;
    27     1_000_000.;
     25        3.;                                                     // integral real
     26        3_100.;
     27        1_000_000.;
    2828
    29     3.1;                                                /* integral/fractional real */
    30     3.141_592_654L;
    31     123_456.123_456;
     29        3.1;                                            // integral/fractional real
     30        3.141_592_654L;
     31        123_456.123_456;
    3232
    33     3E1;                                                /* integral/exponent real */
    34     3_e1f;
    35     3_E1_1_F;
    36     3_E_11;
    37     3_e_+11;
    38     3_E_-11;
     33        3E1;                                            // integral/exponent real
     34        3_e1f;
     35        3_E1_1_F;
     36        3_E_11;
     37        3_e_+11;
     38        3_E_-11;
    3939
    40     3.0E1;                                              /* integral/fractional/exponent real */
    41     3.0_E1L;
    42     3.0_e1_1;
    43     3.0_E_11_l;
    44     3.0_e_+11l;
    45     3.0_E_-11;
    46     123_456.123_456E-16;
     40        3.0E1;                                          // integral/fractional/exponent real
     41        3.0_E1L;
     42        3.0_e1_1;
     43        3.0_E_11_l;
     44        3.0_e_+11l;
     45        3.0_E_-11;
     46        123_456.123_456E-16;
    4747
    48     0x_ff.ffp0;                                         /* hex real */
    49     0x_1.ffff_ffff_p_128_l;
     48        0x_ff.ffp0;                                     // hex real
     49        0x_1.ffff_ffff_p_128_l;
    5050}
    51 
    52 // Local Variables: //
    53 // compile-command: "../../../bin/cfa -std=c99 NumericConstants.c" //
    54 // End: //
  • src/tests/OccursError.c

    r6bc4734 r10dc7491  
    1 forall( otype T ) void f( void (*)( T, T* ) );
    2 forall( otype U ) void g( U*, U );
     1forall( otype T ) void f( void (*)( T, T * ) );
     2forall( otype U ) void g( U,  U * );
     3forall( otype U ) void h( U *, U );
    34
    45void test() {
     6    f( h );
    57    f( g );
    68}
  • src/tests/Scope.c

    r6bc4734 r10dc7491  
    33typedef float t;
    44y z;
    5 otype u = struct { int a; double b; };
     5//otype u = struct { int a; double b; };
     6typedef struct { int a; double b; } u;
    67int f( int y );
    78y q;
     9struct x { int x; };
    810
    911y w( y y, u v ) {
    10         otype x | { x t(u); };
     12//      otype x | { x t(u); };
     13        void ?{}(struct x *);
     14        void ^?{}(struct x *);
     15        extern struct x t( u );
    1116        u u = y;
    12         x z = t(u);
     17        struct x z = t(u);
    1318}
    1419
     
    4045}
    4146
     47void some_func() {}
     48
    4249t g( void ) {
    4350        typedef char x;
    44         try {
     51//      try {
    4552                some_func();
    46         } catch ( x x ) {
    47                 t y = x;
    48         }
     53//      } catch ( x x ) {
     54//              t y = x;
     55//      }
    4956        x z;
    5057}
  • src/tests/ShortCircuit.c

    r6bc4734 r10dc7491  
    1 int ?!=?( int, int );
    2 int ?!=?( float, float );
    3 int 0;
    4 
    5 void g( float );
    6 void g( int );
     1void g( float f ) {}
     2void g( int i ) {}
    73
    84void f( int a ) {
     
    1410}
    1511
    16 //Dummy main
    1712int main(int argc, char const *argv[])
    1813{
  • src/tests/StructMember.c

    r6bc4734 r10dc7491  
    1010        int (*m10)();
    1111        int *(*m11)(int);
    12         T T;
    1312        T (T);
    1413
Note: See TracChangeset for help on using the changeset viewer.