Changeset f1ee72e for src/tests


Ignore:
Timestamp:
Jun 23, 2016, 12:23:00 PM (10 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
4d3ca1d8
Parents:
c2931ea (diff), d56c05d0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into ctor

Location:
src/tests
Files:
28 added
2 deleted
28 edited
1 moved

Legend:

Unmodified
Added
Removed
  • src/tests/.expect/abs.txt

    rc2931ea rf1ee72e  
    1 /usr/local/bin/cfa -g -Wall -Wno-unused-function     abs.c   -o abs
    2 CFA Version 1.0.0 (debug)
    31char                    ¿       abs A
    42signed int              -65     abs 65
  • src/tests/.expect/minmax.txt

    rc2931ea rf1ee72e  
     1char                    z a     min a
     2signed int              4 3     min 3
     3unsigned int            4 3     min 3
     4signed long int         4 3     min 3
     5unsigned long int       4 3     min 3
     6signed long long int    4 3     min 3
     7unsigned long long int  4 3     min 3
     8float                   4 3.1   min 3.1
     9double                  4 3.1   min 3.1
     10long double             4 3.1   min 3.1
     11
     12char                    z a     max z
     13signed int              4 3     max 4
     14unsigned int            4 3     max 4
     15signed long int         4 3     max 4
     16unsigned long int       4 3     max 4
     17signed long long int    4 3     max 4
     18unsigned long long int  4 3     max 4
     19float                   4 3.1   max 4
     20double                  4 3.1   max 4
     21long double             4 3.1   max 4
  • src/tests/Cast.c

    rc2931ea rf1ee72e  
    99        (int)f;
    1010        (void(*)())f;
    11         ([long, long double, *[]()])([f, f, f]);
     11//      ([long, long double, *[]()])([f, f, f]);
    1212}
    1313
  • src/tests/CommentMisc.c

    rc2931ea rf1ee72e  
    1 /* single line */
    2 // single line
    3 
    4 // single line containing */
    5 // single line containing /*
    6 // single line containing /* */
    7 
    8 /* 1st */ int i;
    9 int i; /* 2nd */
    10 /* 1st */ int i; /* 2nd */
    11 /* 1st */ /* 2nd */
    12 
    13 /* 1st
    14    2nd */ int i;
    15 
    16 /*
    17 */
    18 
    19 /*
    20 
    21 */
    22 
    23 /*
    24   1st
    25 */
    26 
    27 /*
    28   1st
    29   2nd
    30 */
    31 
    32 // ignore preprocessor directives
    33 
    34 #line 2
    35  #
    36  #include <fred>
    37         #define mary abc
    38 
    391// alternative ANSI99 brackets
    402
  • src/tests/Constant0-1.c

    rc2931ea rf1ee72e  
    1 //Constant test declaration
    2 // Cforall extension
     1// Constant test declaration
    32
    43// value
     
    65int 0;
    76const int 0;
    8 static const int 0;
    97int 1;
    108const int 1;
    11 static const int 1;
    12 int 0, 1;
    13 const int 0, 1;
     9struct { int i; } 0;
     10const struct { int i; } 1;
     11
     12#ifdef DUPS
     13
     14int 0;
     15const int 0;
     16int 1;
     17const int 1;
    1418int (0), (1);
    1519int ((0)), ((1));
    16 static const int 0, 1;
     20const int 0, 1;
     21const int (0), (1);
    1722struct { int i; } 0;
    1823const struct { int i; } 1;
    19 static const struct { int i; } 1;
     24
     25#endif // DUPS
     26
     27#ifndef NEWDECL
    2028
    2129// pointer
     30
     31int *0, *1;
     32int * const (0), * const 1;
     33struct { int i; } *0;
     34const struct { int i; } *0;
     35int (*(* const x)), **0;
     36
     37#ifdef DUPS
    2238
    2339int *0, *1;
     
    2844int (* const 0), (* const 1);
    2945int ((* const 0)), ((* const 1));
     46int (*(* const x)), *(*0);
     47int (*(* const x)), (*(*0));
    3048struct { int i; } *0;
     49const struct { int i; } *0;
     50int (*(* const x)), **0;
     51
     52#endif // DUPS
     53
     54#else
    3155
    3256// Cforall style
     
    3458* int x, 0;
    3559const * int x, 0;
    36 static const * int x, 0;
    3760* struct { int i; } 0;
    3861const * struct { int i; } 0;
    39 static const * struct { int i; } 0;
    40 static * int x, 0;
    41 static const * int x, 0;
    4262const * * int x, 0;
    4363
     64#ifdef DUPS
     65
     66* int x, 0;
     67const * int x, 0;
     68
     69#endif // DUPS
     70
     71#endif // NEWDECL
     72
    4473int main() {
     74#ifndef NEWDECL
    4575    int 1, * 0;
     76#else
    4677    * int x, 0;
     78#endif // NEWDECL
    4779}
  • src/tests/Context.c

    rc2931ea rf1ee72e  
    1 //cforall context declaration
    2 context has_q( otype T ) {
     1// trait declaration
     2
     3trait has_q( otype T ) {
    34        T q( T );
    45};
    56
    67forall( otype z | has_q( z ) ) void f() {
    7         context has_r( otype T, otype U ) {
     8        trait has_r( otype T, otype U ) {
    89                T r( T, T (T,U) );
    910        };
  • src/tests/Enum.c

    rc2931ea rf1ee72e  
    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/Exception.c

    rc2931ea rf1ee72e  
    1010    try {
    1111        x/4;
    12     } catch( int) {
     12    } catch( int ) {
    1313    } catch( int x ) {
    1414    } catch( struct { int i; } ) {
  • src/tests/Expression.c

    rc2931ea rf1ee72e  
    1 int fred() {
    2     struct s { int i; } *p;
    3     int i;
     1int main() {
     2    struct s { int i; } x, *p = &x;
     3    int i = 3;
    44
    5     // order of evaluation (GCC is different)
    6 /*
    7     i = sizeof( (int) {3} );
    8     i = sizeof (int) {3};
    9 */
    105    // operators
    116
     
    4237    i||i;
    4338    p->i;
    44     i+=i;
    45     i-=i;
    4639    i*=i;
    4740    i/=i;
    4841    i%=i;
     42    i+=i;
     43    i-=i;
    4944    i&=i;
    5045    i|=i;
     
    5449
    5550    i?i:i;
    56 
    57     // cast
    58 /*
    59     double d;
    60     int *ip;
    61     (int *) i;
    62     (* int) i;
    63     ([char, int *])[d, d];
    64     [i,ip,ip] = ([int, * int, int *])[1,(void *)2,(void *)3];
    65     [i,ip,ip] = ([int, * int, int *])([1,(void *)2,(void *)3]);
    66 */
    67 }
    68 
    69 //Dummy main
    70 int main(int argc, char const *argv[])
    71 {
    72         return 0;
    73 }
     51} // main
  • src/tests/Forall.c

    rc2931ea rf1ee72e  
    1010        void f( int );
    1111        void h( void (*p)(void) );
    12  
     12
    1313        int x;
    1414        void (*y)(void);
    1515        char z;
    1616        float w;
    17  
     17
    1818        f( x );
    1919        f( y );
     
    2626        forall( otype T ) void f( T, T );
    2727        forall( otype T, otype U ) void f( T, U );
    28  
     28
    2929        int x;
    3030        float y;
    3131        int *z;
    3232        float *w;
    33  
     33
    3434        f( x, y );
    3535        f( z, w );
     
    4646}
    4747
    48 context sumable( otype T ) {
     48trait sumable( otype T ) {
    4949        const T 0;
    5050        T ?+?(T, T);
  • src/tests/GccExtensions.c

    rc2931ea rf1ee72e  
    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

    rc2931ea rf1ee72e  
    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

    rc2931ea rf1ee72e  
    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

    rc2931ea rf1ee72e  
    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/Makefile.am

    rc2931ea rf1ee72e  
    1111## Created On       : Sun May 31 09:08:15 2015
    1212## Last Modified By : Peter A. Buhr
    13 ## Last Modified On : Mon Jan 25 22:31:42 2016
    14 ## Update Count     : 25
     13## Last Modified On : Mon Jun 20 14:30:52 2016
     14## Update Count     : 33
    1515###############################################################################
    1616
     
    1919CC = @CFA_BINDIR@/cfa
    2020
    21 noinst_PROGRAMS = fstream_test vector_test avl_test # build but do not install
     21.PHONY : list
     22EXTRA_PROGRAMS = fstream_test vector_test avl_test Constant0-1DP Constant0-1ND Constant0-1NDDP # build but do not install
     23
    2224fstream_test_SOURCES = fstream_test.c
    2325vector_test_SOURCES = vector/vector_int.c vector/array.c vector/vector_test.c
    2426avl_test_SOURCES = avltree/avl_test.c avltree/avl0.c avltree/avl1.c avltree/avl2.c avltree/avl3.c avltree/avl4.c avltree/avl-private.c
     27
     28all-local :
     29        python test.py vector_test avl_test Operators NumericConstants Expression Enum AsmName Array Typeof Cast
     30
     31all-tests :
     32        python test.py --all
     33
     34clean-local :
     35        -rm -f ${EXTRA_PROGRAMS}
     36
     37list :
     38        python test.py --list
     39
     40Constant0-1DP : Constant0-1.c
     41        ${CC} ${CFLAGS} -DDUPS ${<} -o ${@}
     42
     43Constant0-1ND : Constant0-1.c
     44        ${CC} ${CFLAGS} -DNEWDECL ${<} -o ${@}
     45
     46Constant0-1NDDP : Constant0-1.c
     47        ${CC} ${CFLAGS} -DNEWDECL -DDUPS ${<} -o ${@}
  • src/tests/Makefile.in

    rc2931ea rf1ee72e  
    1818######################## -*- Mode: Makefile-Automake -*- ######################
    1919###############################################################################
    20 
    2120VPATH = @srcdir@
    2221pkgdatadir = $(datadir)/@PACKAGE@
     
    3635PRE_UNINSTALL = :
    3736POST_UNINSTALL = :
    38 noinst_PROGRAMS = fstream_test$(EXEEXT) vector_test$(EXEEXT) \
    39         avl_test$(EXEEXT)
     37EXTRA_PROGRAMS = fstream_test$(EXEEXT) vector_test$(EXEEXT) \
     38        avl_test$(EXEEXT) Constant0-1DP$(EXEEXT) \
     39        Constant0-1ND$(EXEEXT) Constant0-1NDDP$(EXEEXT)
    4040subdir = src/tests
    4141DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
     
    4848CONFIG_CLEAN_FILES =
    4949CONFIG_CLEAN_VPATH_FILES =
    50 PROGRAMS = $(noinst_PROGRAMS)
     50Constant0_1DP_SOURCES = Constant0-1DP.c
     51Constant0_1DP_OBJECTS = Constant0-1DP.$(OBJEXT)
     52Constant0_1DP_LDADD = $(LDADD)
     53Constant0_1ND_SOURCES = Constant0-1ND.c
     54Constant0_1ND_OBJECTS = Constant0-1ND.$(OBJEXT)
     55Constant0_1ND_LDADD = $(LDADD)
     56Constant0_1NDDP_SOURCES = Constant0-1NDDP.c
     57Constant0_1NDDP_OBJECTS = Constant0-1NDDP.$(OBJEXT)
     58Constant0_1NDDP_LDADD = $(LDADD)
    5159am_avl_test_OBJECTS = avl_test.$(OBJEXT) avl0.$(OBJEXT) avl1.$(OBJEXT) \
    5260        avl2.$(OBJEXT) avl3.$(OBJEXT) avl4.$(OBJEXT) \
     
    8492am__v_GEN_ = $(am__v_GEN_@AM_DEFAULT_V@)
    8593am__v_GEN_0 = @echo "  GEN   " $@;
    86 SOURCES = $(avl_test_SOURCES) $(fstream_test_SOURCES) \
     94SOURCES = Constant0-1DP.c Constant0-1ND.c Constant0-1NDDP.c \
     95        $(avl_test_SOURCES) $(fstream_test_SOURCES) \
    8796        $(vector_test_SOURCES)
    88 DIST_SOURCES = $(avl_test_SOURCES) $(fstream_test_SOURCES) \
     97DIST_SOURCES = Constant0-1DP.c Constant0-1ND.c Constant0-1NDDP.c \
     98        $(avl_test_SOURCES) $(fstream_test_SOURCES) \
    8999        $(vector_test_SOURCES)
    90100ETAGS = etags
     
    235245        cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
    236246$(am__aclocal_m4_deps):
    237 
    238 clean-noinstPROGRAMS:
    239         -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
    240247avl_test$(EXEEXT): $(avl_test_OBJECTS) $(avl_test_DEPENDENCIES) $(EXTRA_avl_test_DEPENDENCIES)
    241248        @rm -f avl_test$(EXEEXT)
     
    254261        -rm -f *.tab.c
    255262
     263@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Constant0-1DP.Po@am__quote@
     264@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Constant0-1ND.Po@am__quote@
     265@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/Constant0-1NDDP.Po@am__quote@
    256266@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/array.Po@am__quote@
    257267@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/avl-private.Po@am__quote@
     
    504514check-am: all-am
    505515check: check-am
    506 all-am: Makefile $(PROGRAMS)
     516all-am: Makefile all-local
    507517installdirs:
    508518install: install-am
     
    538548clean: clean-am
    539549
    540 clean-am: clean-generic clean-noinstPROGRAMS mostlyclean-am
     550clean-am: clean-generic clean-local mostlyclean-am
    541551
    542552distclean: distclean-am
     
    607617.MAKE: install-am install-strip
    608618
    609 .PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
    610         clean-noinstPROGRAMS ctags distclean distclean-compile \
     619.PHONY: CTAGS GTAGS all all-am all-local check check-am clean \
     620        clean-generic clean-local ctags distclean distclean-compile \
    611621        distclean-generic distclean-tags distdir dvi dvi-am html \
    612622        html-am info info-am install install-am install-data \
     
    621631
    622632
     633.PHONY : list
     634
     635all-local :
     636        python test.py vector_test avl_test Operators NumericConstants Expression Enum AsmName Array Typeof Cast
     637
     638all-tests :
     639        python test.py --all
     640
     641clean-local :
     642        -rm -f ${EXTRA_PROGRAMS}
     643
     644list :
     645        python test.py --list
     646
     647Constant0-1DP : Constant0-1.c
     648        ${CC} ${CFLAGS} -DDUPS ${<} -o ${@}
     649
     650Constant0-1ND : Constant0-1.c
     651        ${CC} ${CFLAGS} -DNEWDECL ${<} -o ${@}
     652
     653Constant0-1NDDP : Constant0-1.c
     654        ${CC} ${CFLAGS} -DNEWDECL -DDUPS ${<} -o ${@}
     655
    623656# Tell versions [3.59,3.63) of GNU make to not export all variables.
    624657# Otherwise a system limit (for SysV at least) may be exceeded.
  • src/tests/NumericConstants.c

    rc2931ea rf1ee72e  
    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

    rc2931ea rf1ee72e  
    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/Operators.c

    rc2931ea rf1ee72e  
    1 int ?*?( int, int );
     1int ?*?( int a, int b ) {
     2        return 0;
     3}
    24
    35int ?()( int number1, int number2 ) {
     
    57}
    68
    7 int ?+?( int, int );
     9int ?+?( int a, int b ) {
     10        return 0;
     11}
    812
    9 int ?=?( int *, int );
     13int ?=?( int *a, int b ) {
     14        return 0;
     15}
    1016struct accumulator {
    1117        int total;
    1218};
    1319
    14 char ?()( struct accumulator a, char number1, char number2 );
     20char ?()( struct accumulator a, char number1, char number2 ) {
     21        return 'a';
     22}
    1523
    1624void f( void ) {
     
    2331}
    2432
     33int main(int argc, char const *argv[]) {
     34        /* code */
     35        return 0;
     36}
     37
    2538// Local Variables: //
    2639// tab-width: 4 //
  • src/tests/Scope.c

    rc2931ea rf1ee72e  
    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
    1520y p;
    1621
    17 context has_u( otype z ) {
     22trait has_u( otype z ) {
    1823        z u(z);
    1924};
     
    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

    rc2931ea rf1ee72e  
    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
     12void g() {
     13    int a;
     14    struct { int b; } a;
     15    if ( a ) {
     16                while ( a ) {
     17                        int *b;
     18                        for ( b; a; b ) {
     19                        }
     20                }
     21    }
     22}
     23
     24#include <fstream>
     25
     26struct test_t {
     27        int x;
     28};
     29
     30int ?!=?( test_t lhs, int rhs ) {
     31        sout | lhs.x | " ";
     32        return lhs.x != 0;
     33}
     34
     35
    1736int main(int argc, char const *argv[])
    1837{
     38        test_t true_val, false_val;
     39        true_val.x = 1;
     40        false_val.x = 0;
     41
     42        true_val && false_val;
     43        sout | endl;
     44
     45        true_val || false_val;
     46        sout | endl;
     47
     48        false_val && true_val;
     49        sout | endl;
     50
     51        false_val || true_val;
     52        sout | endl;
     53
    1954        return 0;
    2055}
  • src/tests/StructMember.c

    rc2931ea rf1ee72e  
    1010        int (*m10)();
    1111        int *(*m11)(int);
    12         T T;
    1312        T (T);
    1413
  • src/tests/Subrange.c

    rc2931ea rf1ee72e  
    11// A small context defining the notion of an ordered otype.  (The standard
    22// library should probably contain a context for this purpose.)
    3 context ordered(otype T) {
     3trait ordered(otype T) {
    44    int ?<?(T, T), ?<=?(T, T);
    55};
  • src/tests/Switch.c

    rc2931ea rf1ee72e  
    1 int fred() {
     1int main(int argc, char const *argv[]) {
    22    int i;
    33    switch ( i ) case 3 : i = 1;
  • src/tests/Typedef.c

    rc2931ea rf1ee72e  
    1818a c;
    1919
    20 typedef otypeof(3) x, y;  // GCC
     20typedef typeof(3) x, y;  // GCC
    2121
    2222x p;
     
    2424
    2525int main() {
    26     typedef otypeof(3) z, p;
     26    typedef typeof(3) z, p;
    2727    z w;
    2828    p x;
  • src/tests/Typeof.c

    rc2931ea rf1ee72e  
    11int main() {
    22    int *v1;
    3     otypeof(v1) v2;
    4     otypeof(*v1) v3[4];
     3    typeof(v1) v2;
     4    typeof(*v1) v3[4];
    55    char *v4[4];
    6     otypeof(otypeof(char *)[4]) v5;
    7     otypeof (int *) v6;
    8     otypeof( int ( int, int p ) ) *v7;
    9     otypeof( [int] ( int, int p ) ) *v8;
     6    typeof(typeof(char *)[4]) v5;
     7    typeof (int *) v6;
     8    typeof( int ( int, int p ) ) *v7;
     9    typeof( [int] ( int, int p ) ) *v8;
    1010}
  • src/tests/limits.c

    rc2931ea rf1ee72e  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // limits.c -- 
     7// limits.c --
    88//
    99// Author           : Peter A. Buhr
     
    1212// Last Modified On : Tue May 10 20:45:28 2016
    1313// Update Count     : 1
    14 // 
     14//
    1515
    1616#include <limits>
     
    109109long _Complex _1_sqrt_2 = _1_SQRT_2;
    110110
     111int main(int argc, char const *argv[]) {
     112        //DUMMY
     113        return 0;
     114}
     115
    111116// Local Variables: //
    112117// tab-width: 4 //
  • src/tests/test.py

    rc2931ea rf1ee72e  
    22from __future__ import print_function
    33
    4 from os import listdir
    5 from os.path import isfile, join
     4from os import listdir, environ
     5from os.path import isfile, join, splitext
    66from subprocess import Popen, PIPE, STDOUT
    77
    88import argparse
     9import os
     10import re
    911import sys
    1012
     
    1315################################################################################
    1416def listTests():
    15         list = [f.rstrip('.c') for f in listdir('.')
    16                 if not f.startswith('.') and (
    17                         not isfile(f) or f.endswith('.c')
    18                 )]
     17        list = [splitext(f)[0] for f in listdir('./.expect')
     18                if not f.startswith('.') and f.endswith('.txt')
     19                ]
    1920
    2021        return list
     
    2930                return proc.returncode
    3031
     32def file_replace(fname, pat, s_after):
     33    # first, see if the pattern is even in the file.
     34    with open(fname) as f:
     35        if not any(re.search(pat, line) for line in f):
     36            return # pattern does not occur in file so we are done.
     37
     38    # pattern is in the file, so perform replace operation.
     39    with open(fname) as f:
     40        out_fname = fname + ".tmp"
     41        out = open(out_fname, "w")
     42        for line in f:
     43            out.write(re.sub(pat, s_after, line))
     44        out.close()
     45        os.rename(out_fname, fname)
     46
     47def fix_MakeLevel(file) :
     48        if environ.get('MAKELEVEL') :
     49                file_replace(file, "make\[%i\]" % int(environ.get('MAKELEVEL')), 'make' )
     50
     51
    3152################################################################################
    3253#               running test functions
     
    4061
    4162        # build, skipping to next test on error
    42         make_ret = sh("make -j 8 %s > %s 2>&1" % (test, out_file), dry_run)
     63        make_ret = sh("make -j 8 %s 2> %s 1> /dev/null" % (test, out_file), dry_run)
    4364
    4465        if make_ret == 0 :
     
    5071
    5172        retcode = 0
     73
     74        fix_MakeLevel(out_file)
     75
    5276        if not generate :
    53                 # touch expected files so empty output are supported by default
    54                 sh("touch .expect/%s.txt" % test, dry_run)
    55 
    5677                # diff the output of the files
    5778                retcode = sh("diff .expect/%s.txt .out/%s.log" % (test, test), dry_run)
     
    6788
    6889        if generate :
    69                 print( "Regenerate tests for: ", end="" )
    70                 print( ", ".join( tests ) )
     90                print( "Regenerate tests for: " )
    7191
    7292        failed = False;
    7393        for t in tests:
    74                 if not generate :
    75                         print("%20s  " % t, end="")
     94                print("%20s  " % t, end="")
    7695                sys.stdout.flush()
    7796                test_failed = run_test_instance(t, generate, dry_run)
     
    8099                if not generate :
    81100                        print("FAILED" if test_failed else "PASSED")
     101                else :
     102                        print( "Done" )
    82103
    83104        sh('make clean > /dev/null 2>&1', dry_run)
    84105
    85         if generate :
    86                 print( "Done" )
    87 
    88         return 0 if failed else 1
     106        return 1 if failed else 0
    89107
    90108################################################################################
     
    93111parser = argparse.ArgumentParser(description='Script which runs cforall tests')
    94112parser.add_argument('--dry-run', help='Don\'t run the tests, only output the commands', action='store_true')
     113parser.add_argument('--list', help='List all test available', action='store_true')
    95114parser.add_argument('--all', help='Run all test available', action='store_true')
    96 parser.add_argument('--generate-expected', help='Regenerate the .expect by running the specified tets, can be used with --all option', action='store_true')
     115parser.add_argument('--regenerate-expected', help='Regenerate the .expect by running the specified tets, can be used with --all option', action='store_true')
    97116parser.add_argument('tests', metavar='test', type=str, nargs='*', help='a list of tests to run')
    98117
    99118options = parser.parse_args()
    100119
    101 if len(options.tests) > 0 and options.all :
     120if (len(options.tests) > 0  and     options.all and not options.list) \
     121or (len(options.tests) == 0 and not options.all and not options.list) :
    102122        print('ERROR: must have option \'--all\' or non-empty test list', file=sys.stderr)
    103123        parser.print_help()
    104124        sys.exit(1)
    105125
    106 tests = listTests() if options.all else options.tests
     126allTests = listTests()
    107127
    108 sys.exit( run_tests(tests, options.generate_expected, options.dry_run) )
     128if options.all or options.list :
     129        tests = allTests
     130
     131else :
     132        tests = []
     133        for test in options.tests:
     134                if test in allTests :
     135                        tests.append(test)
     136                else :
     137                        print('ERROR: No expected file for test %s, ignoring it' % test, file=sys.stderr)
     138
     139        if len(tests) == 0 :
     140                print('ERROR: No valid test to run', file=sys.stderr)
     141                sys.exit(1)
     142
     143if options.list :
     144        print("\n".join(tests))
     145
     146else :
     147        sys.exit( run_tests(tests, options.regenerate_expected, options.dry_run) )
Note: See TracChangeset for help on using the changeset viewer.