Changeset 40:ec5dde8a6ff6 in xplra for test
- Timestamp:
- 02/14/13 18:21:47 (12 years ago)
- Branch:
- default
- Phase:
- public
- Location:
- test
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
test/basicctest.c
r36 r40 33 33 #include <stdio.h> 34 34 #include <string.h> 35 36 #ifdef _WIN32 37 #include <windows.h> 38 #else 39 #include <unistd.h> 40 #endif 41 42 //------------------------------------------------------------------------------ 43 44 #ifdef _WIN32 45 void _sleep(int ms) 46 { 47 Sleep(ms); 48 } 49 #else 50 void _sleep(int ms) 51 { 52 usleep(ms*1000); 53 } 54 #endif 55 35 56 36 57 //------------------------------------------------------------------------------ … … 74 95 } 75 96 97 printf("Showing a message...\n"); 98 if (xplra_show_message(connectionID, "[basictest] Starting tests", 5.0)<0) goto error; 99 printf("\n"); 100 76 101 printf("Querying the versions...\n"); 77 102 if (xplra_get_versions(connectionID, &xplaneVersion, … … 341 366 printf("The tail number is: '%s'\n\n", (char*)tailNum); 342 367 368 printf("Preparing for the message tests, sleeping for 5 seconds...\n"); 369 _sleep(5*1000); 370 371 printf("Showing a message for 10 seconds...\n"); 372 if (xplra_show_message(connectionID, "[basictest] this message appears for 10 seconds", 10.0)<0) { 373 goto error; 374 } 375 376 printf("Sleeping for 3 seconds...\n"); 377 _sleep(3*1000); 378 379 printf("Showing another message interrupting the previous one for 3 seconds"); 380 if (xplra_show_message(connectionID, "[basictest] but this message interrupts it, and is displayed for 3 seconds", 3.0)<0) { 381 goto error; 382 } 383 384 printf("Sleeping for 5 seconds...\n"); 385 _sleep(5*1000); 386 if (xplra_show_message(connectionID, "[basictest] and the tests come to an end!", 5.0)<0) { 387 goto error; 388 } 389 343 390 goto cleanup; 344 391 error: -
test/basictest.cc
r36 r40 31 31 #include <hu/varadiistvan/xplra/XPlane.h> 32 32 33 #include <hu/varadiistvan/scpl/Thread.h> 34 33 35 #include <cstdio> 34 36 #include <cstring> … … 39 41 using hu::varadiistvan::xplra::Exception; 40 42 using hu::varadiistvan::xplra::ProtocolException; 43 44 using hu::varadiistvan::scpl::Thread; 41 45 42 46 using std::string; … … 56 60 int xplmVersion = 0; 57 61 int xplraVersion = 0; 62 63 printf("Showing a message...\n"); 64 xplane.showMessage("[basictest] Starting tests", 5.0); 65 printf("\n"); 58 66 59 67 printf("Querying the versions...\n"); … … 242 250 } 243 251 252 printf("Preparing for the message tests, sleeping for 5 seconds...\n"); 253 Thread::sleep(5*1000); 254 255 printf("Showing a message for 10 seconds...\n"); 256 xplane.showMessage("[basictest] this message appears for 10 seconds", 10.0); 257 258 printf("Sleeping for 3 seconds...\n"); 259 Thread::sleep(3*1000); 260 261 printf("Showing another message interrupting the previous one for 3 seconds\n"); 262 xplane.showMessage("[basictest] but this message interrupts it, and is displayed for 3 seconds", 3.0); 263 264 printf("Sleeping for 5 seconds...\n"); 265 Thread::sleep(5*1000); 266 xplane.showMessage("[basictest] and the tests come to an end!", 5.0); 244 267 245 268 return 0; -
test/basictest.py
r36 r40 1 1 # Basic test program for the Python client library 2 3 #------------------------------------------------------------------------------ 4 5 import time 2 6 3 7 #------------------------------------------------------------------------------ … … 12 16 xplane.connect() 13 17 print "Connected to X-Plane." 18 print 19 20 print "Showing a message..." 21 xplane.showMessage("[basictest] Starting tests", 5.0) 14 22 print 15 23 … … 133 141 print 134 142 143 print "Preparing for the message tests, sleeping for 5 seconds..." 144 time.sleep(5.0) 145 146 print "Showing a message for 10 seconds..." 147 xplane.showMessage("[basictest] this message appears for 10 seconds", 10.0) 148 149 print "Sleeping for 3 seconds..." 150 time.sleep(3.0) 151 152 print "Showing another message interrupting the previous one for 3 seconds" 153 xplane.showMessage("[basictest] but this message interrupts it, and is displayed for 3 seconds", 3.0) 154 155 print "Sleeping for 5 seconds..." 156 time.sleep(5.0) 157 xplane.showMessage("[basictest] and the tests come to an end!", 5.0) 135 158 136 159 except Exception as e:
Note:
See TracChangeset
for help on using the changeset viewer.