Changeset 2afec66 for src/tests/avltree


Ignore:
Timestamp:
Jul 26, 2017, 5:24:33 PM (5 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
aaron-thesis, arm-eh, 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, resolv-new, with_gc
Children:
25bd9074
Parents:
8a6cf7e
Message:

Update several tests for references

Location:
src/tests/avltree
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/tests/avltree/avl.h

    r8a6cf7e r2afec66  
    2323// forall( otype T, ttype Params | { void ?{}(T *, Params); } ) T * new( Params p );
    2424
    25 forall(dtype T | { void ^?{}(T *); })
     25forall(dtype T | { void ^?{}(T &); })
    2626void delete(T * x);
    2727
     
    5959
    6060forall(otype K | Comparable(K), otype V)
    61 void ?{}(tree(K, V) *t, K key, V value);
     61void ?{}(tree(K, V) &t, K key, V value);
    6262
    6363forall(otype K, otype V)
    64 void ^?{}(tree(K, V) * t);
     64void ^?{}(tree(K, V) & t);
    6565
    6666forall(otype K | Comparable(K), otype V)
  • src/tests/avltree/avl1.c

    r8a6cf7e r2afec66  
    33
    44forall(otype K | Comparable(K), otype V)
    5 void ?{}(tree(K, V) *t, K key, V value){
    6   (&t->key) { key };
    7   (&t->value) { value };
    8   t->parent = NULL;
    9   t->left = NULL;
    10   t->right = NULL;
    11   t->balance = 0;
     5void ?{}(tree(K, V) &t, K key, V value){
     6  (t.key) { key };
     7  (t.value) { value };
     8  t.parent = NULL;
     9  t.left = NULL;
     10  t.right = NULL;
     11  t.balance = 0;
    1212}
    1313
    1414forall(otype K, otype V)
    15 void ^?{}(tree(K, V) * t){
    16   delete(t->left);
    17   delete(t->right);
    18   ^(&t->key){};
    19   ^(&t->value){};
     15void ^?{}(tree(K, V) & t){
     16  delete(t.left);
     17  delete(t.right);
     18  ^(t.key){};
     19  ^(t.value){};
    2020}
    2121
     
    2424  // infinite loop trying to resolve ... t = malloc();
    2525  tree(K, V) * t = malloc(sizeof(tree(K,V)));
    26   t { key, value };
     26  (*t){ key, value };
    2727  return t;
    2828}
Note: See TracChangeset for help on using the changeset viewer.