Changeset f7e749f for src/tests


Ignore:
Timestamp:
Dec 13, 2016, 3:56:44 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
fc638d2
Parents:
0f35657
Message:

added tests for polymorphic tuples and cast on tuples, updated a couple of other tests

Location:
src/tests
Files:
4 added
5 edited

Legend:

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

    r0f35657 rf7e749f  
    66constructing int
    77constructing int
     8begin construct B
     9assign b->a2
    810constructing int
    911constructing int
     12begin construct A
     13construct a->x
    1014constructing int: 1001
     15assign a->y
    1116assigning int: 0 0
     17end construct A
     18construct b->a1
    1219constructing int
    1320constructing int
     21begin construct A
     22construct a->x
    1423constructing int: 1000
     24assign a->y
    1525assigning int: 0 0
     26end construct A
     27end construct B
    1628destructing int: 0
    1729destructing int: 0
     
    2032copy constructing int: 0
    2133copy constructing int: 0
     34begin copy construct A
     35copy construct this->x
    2236copy constructing int: 1000
     37assign this->y
     38end copy construct A
    2339copy constructing int: 0
    2440copy constructing int: 0
     41begin copy construct A
     42copy construct this->x
    2543copy constructing int: 1001
     44assign this->y
     45end copy construct A
    2646copy constructing int: 0
    2747copy constructing int: 0
     48begin copy construct A
     49copy construct this->x
    2850copy constructing int: 0
     51assign this->y
     52end copy construct A
    2953End of main
    3054constructing int
    3155constructing int
     56begin construct A
     57construct a->x
    3258constructing int: 999
     59assign a->y
    3360assigning int: 0 0
     61end construct A
    3462destructing int: 0
    3563destructing int: 0
     
    4674constructing int
    4775constructing int
     76begin construct A
     77construct a->x
    4878constructing int: 999
     79assign a->y
    4980assigning int: 0 0
     81end construct A
    5082destructing int: 0
    5183destructing int: 0
  • src/tests/.expect/simpleGenericTriple.txt

    r0f35657 rf7e749f  
    11132 1001 459
     2132 1001.12 459
  • src/tests/completeTypeError.c

    r0f35657 rf7e749f  
    55forall(dtype T | sized(T)) void quux(T *);
    66
     7struct A; // incomplete
     8struct B {}; // complete
     9
    710int main() {
    811        int *i;
    912        void *v;
    1013
     14        // A * x;
     15        // A * y;
     16        // B * x;
     17        // B * z;
     18
    1119        // okay
    1220        *i;
     21        // *x; // picks B
     22        // *z;
    1323        foo(i);
    1424        bar(i);
     
    2333        // bad
    2434        *v;
     35        // *y;
    2536        baz(v);
    2637        quux(v);
    2738}
     39
    2840
    2941forall(otype T)
     
    6072        baz(z);
    6173}
    62 
  • src/tests/memberCtors.c

    r0f35657 rf7e749f  
    3232
    3333void ?{}(A * a, int x) {
     34  printf("begin construct A\n");
     35  printf("construct a->x\n");
    3436  (&a->x){ x+999 };
     37  printf("assign a->y\n");
    3538  a->y = 0; // not a constructor - default constructor will be inserted
     39  printf("end construct A\n");
    3640} // z never constructed - will be automatically default constructed
    3741
    3842void ?{}(A * this, A other) {
     43  printf("begin copy construct A\n");
     44  printf("copy construct this->x\n");
    3945  (&this->x){ other.x };
     46  printf("assign this->y\n");
    4047  this->y = other.y; // not a constructor - copy constructor will be inserted
     48  printf("end copy construct A\n");
    4149} // z never constructed - will be automatically copy constructed
    4250
     
    4654
    4755void ?{}(B * b) {
     56  printf("begin construct B\n");
     57  printf("assign b->a2\n");
    4858  b->a2 = (A) { 2 };
     59  printf("construct b->a1\n");
    4960  (&b->a1){ 1 };
    5061#ifdef ERR1
    5162  (&b->a2){ b->a3 }; // error, b->a2 was used previously but is explicitly constructed
    5263#endif
     64  printf("end construct B\n");
    5365} // a2, a3 never constructed - will be automatically default constructed
    5466
  • src/tests/simpleGenericTriple.c

    r0f35657 rf7e749f  
    2828  int x1 = 123, x3 = 456;
    2929  double x2 = 999.123;
    30   struct T3(int) L = { x1, x2, x3 };
    31   struct T3(int) R = { 9, 2, 3 };
    32   struct T3(int) ret = L+R;
    33   printf("%d %d %d\n", ret.f0, ret.f1, ret.f2);
     30  struct T3(int) Li = { x1, x2, x3 };
     31  struct T3(int) Ri = { 9, 2, 3 };
     32  struct T3(int) reti = Li+Ri;
     33  printf("%d %d %d\n", reti.f0, reti.f1, reti.f2);
     34
     35  struct T3(double) Ld = { x1, x2, x3 };
     36  struct T3(double) Rd = { 9, 2, 3 };
     37  struct T3(double) retd = Ld+Rd;
     38  printf("%g %g %g\n", retd.f0, retd.f1, retd.f2);
    3439}
    3540
Note: See TracChangeset for help on using the changeset viewer.