Changeset f37147b for src/tests


Ignore:
Timestamp:
Feb 28, 2017, 3:24:35 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
20221d4, dd020c0
Parents:
d0ffed1 (diff), 14f6bb39 (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' of plg2:software/cfa/cfa-cc

Location:
src/tests
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/tests/avltree/avl_test.c

    rd0ffed1 rf37147b  
    3636
    3737  // char* -> char*
    38   int ?<?(char *a, char *b) {
    39     return strcmp(a,b) < 0;
     38  struct c_str { char *str; };  // wraps a C string
     39  int ?<?(c_str a, c_str b) {
     40    return strcmp(a.str,b.str) < 0;
    4041  }
    41   tree(char *, char *) * ssmap = create("queso", "cheese");
    42   insert(&ssmap, "foo", "bar");
    43   insert(&ssmap, "hello", "world");
     42  tree(c_str, char *) * ssmap = create((c_str){"queso"}, "cheese");
     43  insert(&ssmap, (c_str){"foo"}, "bar");
     44  insert(&ssmap, (c_str){"hello"}, "world");
    4445  assert( height(ssmap) == 2 );
    4546
    46   printf("%s %s %s\n", *find(ssmap, "hello"), *find(ssmap, "foo"), *find(ssmap, "queso"));
     47  printf("%s %s %s\n", *find(ssmap, (c_str){"hello"}), *find(ssmap, (c_str){"foo"}), *find(ssmap, (c_str){"queso"}));
    4748
    48   remove(&ssmap, "foo");
     49  remove(&ssmap, (c_str){"foo"});
    4950  delete(ssmap);
    5051}
  • src/tests/monitor.c

    rd0ffed1 rf37147b  
    66struct global_t {
    77        int value;
    8         monitor m;
     8        __monitor_t m;
    99};
    1010
     
    1616
    1717void increment( /*mutex*/ global_t * this ) {
    18         monitor_guard g = { &this->m };
    19         this->value += 1;
     18        monitor_guard_t g1 = { &this->m };
     19        {
     20                monitor_guard_t g2 = { &this->m };
     21                {
     22                        monitor_guard_t g3 = { &this->m };
     23                        this->value += 1;
     24                }
     25        }
    2026}
    2127
Note: See TracChangeset for help on using the changeset viewer.