Changeset 41:a3f71b4eaca1 in xplra for test
- Timestamp:
- 02/14/13 18:32:21 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- test
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
test/multigetctest.c
r30 r41 51 51 52 52 int connectionID = -1; 53 int wrongGetterID = -1; 53 54 int getterID = -1; 54 55 … … 147 148 goto cleanup; 148 149 } 150 151 wrongGetterID = xplra_multi_create_getter(connectionID); 152 if (wrongGetterID<0) goto error; 153 xplra_multi_add_int(wrongGetterID, "sim/time/local_date_days"); 154 xplra_multi_add_int(wrongGetterID, "sim/time/paused"); 155 xplra_multi_add_int(wrongGetterID, "sim/time/hello_te_lo"); 156 xplra_multi_add_float(wrongGetterID, "sim/time/zulu_time_sec"); 157 xplra_multi_add_int(wrongGetterID, "sim/operation/prefs/replay_mode"); 158 159 printf("Executing a multi-dataref getter with an invalid dataref...\n"); 160 if (xplra_multi_execute(wrongGetterID)<0) { 161 printf("Error occured: %s\n\n", 162 xplra_get_last_error_string(connectionID)); 163 xplra_clear_last_error(connectionID); 164 } else { 165 printf(">>>>>>>>>>>>>>>>>>>>> Succeeded, but it should not have!!!!\n\n"); 166 } 167 168 printf("Executing a registered multi-dataref getter with an invalid dataref...\n"); 169 if (xplra_multi_register(wrongGetterID)<0) goto error; 170 if (xplra_multi_execute(wrongGetterID)<0) { 171 printf("Error occured: %s\n\n", 172 xplra_get_last_error_string(connectionID)); 173 xplra_clear_last_error(connectionID); 174 } else { 175 printf(">>>>>>>>>>>>>>>>>>>>> Succeeded, but it should not have!!!!\n\n"); 176 } 177 149 178 150 179 getterID = xplra_multi_create_getter(connectionID); -
test/multigettest.cc
r29 r41 42 42 using hu::varadiistvan::xplra::MultiGetter; 43 43 using hu::varadiistvan::xplra::Exception; 44 using hu::varadiistvan::xplra::ProtocolException; 44 45 45 46 using hu::varadiistvan::scpl::Thread; … … 62 63 xplane.connect(); 63 64 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 } 64 89 65 90 MultiGetter& getter = xplane.createMultiGetter(); -
test/multigettest.py
r35 r41 16 16 xplane.connect() 17 17 print "Connected to X-Plane." 18 print 19 20 wrongGetter = xplane.createMultiGetter(); 21 wrongGetter.addInt("sim/time/local_date_days"); 22 wrongGetter.addInt("sim/time/paused"); 23 wrongGetter.addInt("sim/time/hello_te_lo"); 24 wrongGetter.addFloat("sim/time/zulu_time_sec"); 25 wrongGetter.addInt("sim/operation/prefs/replay_mode"); 26 27 print "Executing a multi-dataref getter with an invalid dataref..." 28 try: 29 wrongGetter.execute(); 30 print ">>>>>>>>>>>>>>>>>>>>> Succeeded, but it should not have!!!!" 31 except ProtocolException, e: 32 print "Caught protocol exception: " + str(e) 33 print 34 35 print "Executing a registered multi-dataref getter with an invalid dataref..." 36 wrongGetter.register() 37 try: 38 wrongGetter.execute(); 39 print ">>>>>>>>>>>>>>>>>>>>> Succeeded, but it should not have!!!!" 40 except ProtocolException, e: 41 print "Caught protocol exception: " + str(e) 18 42 print 19 43
Note:
See TracChangeset
for help on using the changeset viewer.