Ignore:
Timestamp:
Oct 1, 2023, 12:25:55 PM (9 months ago)
Author:
caparsons <caparson@…>
Branches:
master
Children:
7a925a41
Parents:
fd775ae
Message:

a bit of cleanup of the hotpotato tests

File:
1 edited

Legend:

Unmodified
Added
Removed
  • tests/exceptions/hotpotato_checked.cfa

    rfd775ae r26be854  
    3535ExceptionDecl( Explode );
    3636ExceptionDecl( Terminate, Player * victim; );
    37 ExceptionDecl( Election, Player * player; );
     37ExceptionDecl( Election );
    3838ExceptionDecl( cmd_error ); // convert(...) throws out_of_range or invalid_argument
    3939
     
    4747void countdown( Potato & potato ) with(potato) {
    4848        timer += 1;
    49         if ( timer == deadline ) throw ExceptionInst( Explode );
     49        if ( timer == deadline ) throwResume ExceptionInst( Explode );
    5050} // countdown
    5151
     
    9696            if ( partner[LEFT] == &player ) {                   // stop when only one player
    9797                sout | id | " wins the Match!";
    98                 break;
     98                return;
    9999            } // exit
    100100
     
    116116                sout | "election";
    117117                sout | " -> " | id | nonl;
    118                 if ( id > getId( *election->player ) ) election->player = &player; // set umpire to highest id so far
     118                if ( id > getId( umpire ) ) &umpire = &player; // set umpire to highest id so far
    119119        resumeAt( *partner[RIGHT], *election );
    120120        disable_ehm();              // disable ehm since we can't handle execption thrown in vote here and want to poll later
    121121                vote( *partner[RIGHT] );
    122122        enable_ehm();               // enable after vote
    123         } catch ( Explode * ) {
     123        } catchResume( Explode * ) {
    124124        sout | id | " is eliminated";
    125125        if ( &player == &umpire ) {
    126126            try {
    127127                id = -1;                                        // remove from election
    128                 resumeAt( *partner[RIGHT], ExceptionInst( Election, &player ) );
     128                resumeAt( *partner[RIGHT], ExceptionInst( Election ) );
    129129                vote( *partner[RIGHT] );                // start election
    130130                checked_poll();
    131131            } catchResume( Election * election ) {
    132                 &umpire = election->player;
    133                 sout | " : umpire " | getId( *election->player );
     132                sout | " : umpire " | getId( umpire );
    134133            } // try
    135134        } // if
Note: See TracChangeset for help on using the changeset viewer.