Changeset 41:a3f71b4eaca1 in xplra for test/multigettest.cc


Ignore:
Timestamp:
02/14/13 18:32:21 (11 years ago)
Author:
István Váradi <ivaradi@…>
Branch:
default
Phase:
public
Message:

Added test cases for the 'unknown dataref' error with position information

File:
1 edited

Legend:

Unmodified
Added
Removed
  • test/multigettest.cc

    r29 r41  
    4242using hu::varadiistvan::xplra::MultiGetter;
    4343using hu::varadiistvan::xplra::Exception;
     44using hu::varadiistvan::xplra::ProtocolException;
    4445
    4546using hu::varadiistvan::scpl::Thread;
     
    6263        xplane.connect();
    6364        printf("Connected to X-Plane.\n\n");
     65
     66        MultiGetter& wrongGetter = xplane.createMultiGetter();
     67        wrongGetter.addInt("sim/time/local_date_days");
     68        wrongGetter.addInt("sim/time/paused");
     69        wrongGetter.addInt("sim/time/hello_te_lo");
     70        wrongGetter.addFloat("sim/time/zulu_time_sec");
     71        wrongGetter.addInt("sim/operation/prefs/replay_mode");
     72
     73        printf("Executing a multi-dataref getter with an invalid dataref...\n");
     74        try {
     75            wrongGetter.execute();
     76            printf(">>>>>>>>>>>>>>>>>>>>> Succeeded, but it should not have!!!!\n\n");
     77        } catch(const ProtocolException& e) {
     78            printf("Caught protocol exception: %s\n\n", e.what());
     79        }
     80
     81        printf("Executing a registered multi-dataref getter with an invalid dataref...\n");
     82        wrongGetter.registerInXPlane();
     83        try {
     84            wrongGetter.execute();
     85            printf(">>>>>>>>>>>>>>>>>>>>> Succeeded, but it should not have!!!!\n\n");
     86        } catch(const ProtocolException& e) {
     87            printf("Caught protocol exception: %s\n\n", e.what());
     88        }
    6489
    6590        MultiGetter& getter = xplane.createMultiGetter();
Note: See TracChangeset for help on using the changeset viewer.