- Timestamp:
- Jul 10, 2020, 11:42:41 AM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 20ab637, 2fc94ced, fb98462
- Parents:
- 732b406 (diff), 49cad912 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- tests
- Files:
-
- 25 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/copyfile.cfa
r732b406 r3a32b3a 10 10 // Created On : Fri Jun 19 13:44:05 2020 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jun 19 17:58:03 202013 // Update Count : 412 // Last Modified On : Sun Jul 5 11:27:43 2020 13 // Update Count : 5 14 14 // 15 15 … … 22 22 23 23 try { 24 choose ( argc ) { 24 choose ( argc ) { // terminate if command-line errors 25 25 case 2, 3: 26 26 open( in, argv[1] ); // open input file first as output creates file 27 27 if ( argc == 3 ) open( out, argv[2] ); // do not create output unless input opens 28 28 case 1: ; // use default files 29 default: 29 default: // wrong number of options 30 30 exit | "Usage" | argv[0] | "[ input-file (default stdin) [ output-file (default stdout) ] ]"; 31 31 } // choose -
tests/exceptions/.expect/defaults.txt
r732b406 r3a32b3a 3 3 jump default handler. 4 4 Catch unhandled_exception. 5 cross terminate throw 6 cross terminate default 7 cross terminate catch 8 cross resume throw 9 cross resume default 10 cross resume catch -
tests/exceptions/defaults.cfa
r732b406 r3a32b3a 30 30 throwResume (log_message){(char *)"Should be printed.\n"}; 31 31 } catchResume (log_message * this) { 32 printf( this->virtual_table->msg(this));32 printf("%s", this->virtual_table->msg(this)); 33 33 } 34 34 // But we don't have to: … … 69 69 } 70 70 71 TRIVIAL_EXCEPTION(second); 72 73 void cross_test(void) { 74 void defaultTerminationHandler(first &) { 75 printf("cross terminate default\n"); 76 throw (second){}; 77 } 78 void defaultResumptionHandler(first &) { 79 printf("cross resume default\n"); 80 throwResume (second){}; 81 } 82 try { 83 printf("cross terminate throw\n"); 84 throw (first){}; 85 } catch (second *) { 86 printf("cross terminate catch\n"); 87 } 88 try { 89 printf("cross resume throw\n"); 90 throwResume (first){}; 91 } catchResume (second *) { 92 printf("cross resume catch\n"); 93 } 94 } 95 71 96 int main(int argc, char * argv[]) { 72 97 log_test(); 73 98 jump_test(); 74 99 unhandled_test(); 100 cross_test(); 75 101 } -
tests/manipulatorsOutput3.cfa
r732b406 r3a32b3a 13 13 sout | sign(x); 14 14 sout | nl; 15 #if 1 15 16 16 sout | bin(x); 17 17 sout | upcase(bin(x)); … … 124 124 sout | nl; 125 125 126 126 127 // extras 128 sout | "extras"; 127 129 sout | bin(divisor); 128 130 sout | upcase(bin(divisor)); … … 140 142 sout | left(sign(wd(0,40, divisor))) | 'X'; 141 143 printf( "%-+1.40dX\n", 123456789 ); 142 #endif // 0 144 145 int128 i128; 146 unsigned int128 ui128; 147 148 i128 = -10; 149 for ( 25 ) { 150 sout | left( sign( wd( 20, i128 ) ) ) | left( wd( 20, hex( i128 ) ) ) | left( wd( 20, oct( i128 ) ) ); 151 sout | left( wd( 20, bin( i128 ) ) ); 152 i128 += 1; 153 } 154 sout | nl; 155 156 i128 = 0x7fffffffffffffff; 157 i128 <<= 64; 158 i128 += 0xfffffffffffffffa; 159 160 for ( 20 ) { 161 sout | i128; 162 sout | left( sign( wd( 45, i128 ) ) ) | left( wd( 45, hex( i128 ) ) ) | left( wd( 45, oct( i128 ) ) ); 163 sout | left( wd( 45, bin( i128 ) ) ); 164 i128 += 1; 165 } 166 sout | nl; 167 168 ui128 = 0x7fffffffffffffff; 169 ui128 <<= 64; 170 ui128 += 0xfffffffffffffffa; 171 172 for ( 20 ) { 173 sout | ui128; 174 ui128 += 1; 175 } 176 sout | nl; 177 178 ui128 = 0xffffffffffffffff; 179 ui128 <<= 64; 180 ui128 += 0xfffffffffffffffa; 181 182 for ( 20 ) { 183 sout | ui128; 184 ui128 += 1; 185 } 143 186 } -
tests/pybin/test_run.py
r732b406 r3a32b3a 69 69 else : text = "FAILED with code %d" % retcode 70 70 71 text += " C%s - R%s" % ( cls.fmtDur(duration[0]), cls.fmtDur(duration[1]))71 text += " C%s - R%s" % (fmtDur(duration[0]), fmtDur(duration[1])) 72 72 return text 73 74 @staticmethod75 def fmtDur( duration ):76 if duration :77 hours, rem = divmod(duration, 3600)78 minutes, rem = divmod(rem, 60)79 seconds, millis = divmod(rem, 1)80 return "%2d:%02d.%03d" % (minutes, seconds, millis * 1000)81 return " n/a" -
tests/pybin/tools.py
r732b406 r3a32b3a 387 387 while True: 388 388 yield i.next(max(expire - time.time(), 0)) 389 390 def fmtDur( duration ): 391 if duration : 392 hours, rem = divmod(duration, 3600) 393 minutes, rem = divmod(rem, 60) 394 seconds, millis = divmod(rem, 1) 395 return "%2d:%02d.%03d" % (minutes, seconds, millis * 1000) 396 return " n/a" -
tests/test.py
r732b406 r3a32b3a 361 361 362 362 # for each build configurations, run the test 363 for arch, debug, install in itertools.product(settings.all_arch, settings.all_debug, settings.all_install): 364 settings.arch = arch 365 settings.debug = debug 366 settings.install = install 367 368 # filter out the tests for a different architecture 369 # tests are the same across debug/install 370 local_tests = settings.arch.filter( tests ) 371 options.jobs, forceJobs = job_count( options, local_tests ) 372 settings.update_make_cmd(forceJobs, options.jobs) 373 374 # check the build configuration works 375 settings.validate() 376 377 # print configuration 378 print('%s %i tests on %i cores (%s:%s)' % ( 379 'Regenerating' if settings.generating else 'Running', 380 len(local_tests), 381 options.jobs, 382 settings.arch.string, 383 settings.debug.string 384 )) 385 386 # otherwise run all tests and make sure to return the correct error code 387 failed = run_tests(local_tests, options.jobs) 388 if failed: 389 result = 1 390 if not settings.continue_: 391 break 392 393 363 with Timed() as total_dur: 364 for arch, debug, install in itertools.product(settings.all_arch, settings.all_debug, settings.all_install): 365 settings.arch = arch 366 settings.debug = debug 367 settings.install = install 368 369 # filter out the tests for a different architecture 370 # tests are the same across debug/install 371 local_tests = settings.arch.filter( tests ) 372 options.jobs, forceJobs = job_count( options, local_tests ) 373 settings.update_make_cmd(forceJobs, options.jobs) 374 375 # check the build configuration works 376 settings.validate() 377 378 # print configuration 379 print('%s %i tests on %i cores (%s:%s)' % ( 380 'Regenerating' if settings.generating else 'Running', 381 len(local_tests), 382 options.jobs, 383 settings.arch.string, 384 settings.debug.string 385 )) 386 387 # otherwise run all tests and make sure to return the correct error code 388 failed = run_tests(local_tests, options.jobs) 389 if failed: 390 result = 1 391 if not settings.continue_: 392 break 393 394 print('Tests took %s' % fmtDur( total_dur.duration )) 394 395 sys.exit( failed )
Note: See TracChangeset
for help on using the changeset viewer.