Show
Ignore:
Timestamp:
05/15/09 18:17:07 (4 years ago)
Author:
gabriel@…
Message:

Refactor some of the macros for tests and collect them into test_utils.h.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/transport_redesign_2/test/t_SimpleTransportMaster.cpp

    r1151 r1153  
    3131#define THIS_NAMESPACE t_SimpleTransportMaster 
    3232#include "test_macros.h" 
     33#include "test_utils.h" 
    3334 
    3435using namespace H2Core; 
     
    5253    }; 
    5354 
    54 #define VALID_POS(p, s) {                                                       \ 
    55     BOOST_REQUIRE( typeid(p) == typeid(H2Core::TransportPosition) );    \ 
    56     BOOST_REQUIRE( typeid(s) == typeid(H2Core::Song*) );                \ 
    57     CK( (p).bar > 0 );                                                  \ 
    58     CK( (p).bar <= song_bar_count(s) );                                 \ 
    59     CK( (p).ticks_per_beat == 48 );                                     \ 
    60     CK( (p).beats_per_bar == (ticks_in_bar((s),(p).bar)/48) );          \ 
    61     CK( (p).beat_type == 4 );                                           \ 
    62     CK( (p).beat > 0 );                                                 \ 
    63     CK( (p).beat <= (p).beats_per_bar );                                \ 
    64     CK( (p).tick < ticks_in_bar((s), (p).bar) );                        \ 
    65     CK( (p).bbt_offset < (p).frames_per_tick() );                       \ 
    66     CK( (p).bar_start_tick < song_tick_count(s) );                      \ 
    67     CK( (p).bar_start_tick == bar_start_tick((s), (p).bar) );           \ 
    68     CK( ((p).bar_start_tick + (p).tick) < song_tick_count(s) );         \ 
    69 } 
    7055 
    7156 
     
    8166    CK( 0 == x.get_current_frame() ); 
    8267    x.get_position(&pos); 
    83     VALID_POS(pos, s); 
     68    H2TEST_VALID_POS(pos, s); 
    8469    CK( pos.bar == 1 ); 
    8570    CK( pos.beat == 1 ); 
     
    10792    TransportPosition pos, posb; 
    10893    x.get_position(&pos); 
    109     VALID_POS(pos, s); 
     94    H2TEST_VALID_POS(pos, s); 
    11095    x.processed_frames(1024); 
    11196    x.get_position(&posb); 
    112     VALID_POS(posb, s); 
     97    H2TEST_VALID_POS(posb, s); 
    11398    CK( pos.frame == 0 ); 
    11499    CK( pos.bbt_offset == 0 ); 
     
    130115    for( frame = 0 ; frame <= tot_frames ; frame += delta ) { 
    131116        x.get_position(&pos); 
    132         VALID_POS(pos, s); 
     117        H2TEST_VALID_POS(pos, s); 
    133118 
    134119        CK( pos.beats_per_minute == 100.0 );