- Timestamp:
- Jun 11, 2023, 6:42:36 PM (2 years ago)
- Branches:
- ast-experimental, master
- Children:
- 32a4f3e, 576aadb, 62d62db, 8a930c03
- Parents:
- 1db6d70 (diff), 0658672 (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:
-
- 1 deleted
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/.expect/copyfile.txt
r1db6d70 r38e266ca 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 : Mon Jun 5 21:20:07 2023 13 // Update Count : 5 14 14 // 15 15 … … 30 30 exit | "Usage" | argv[0] | "[ input-file (default stdin) [ output-file (default stdout) ] ]"; 31 31 } // choose 32 } catch( Open_Failure * ex ; ex->istream == &in ) {32 } catch( open_failure * ex ; ex->istream == &in ) { 33 33 exit | "Unable to open input file" | argv[1]; 34 } catch( Open_Failure * ex ; ex->ostream == &out ) {34 } catch( open_failure * ex ; ex->ostream == &out ) { 35 35 close( in ); // optional 36 36 exit | "Unable to open output file" | argv[2]; -
tests/.in/copyfile.txt
r1db6d70 r38e266ca 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 : Mon Jun 5 21:20:07 2023 13 // Update Count : 5 14 14 // 15 15 … … 30 30 exit | "Usage" | argv[0] | "[ input-file (default stdin) [ output-file (default stdout) ] ]"; 31 31 } // choose 32 } catch( Open_Failure * ex ; ex->istream == &in ) {32 } catch( open_failure * ex ; ex->istream == &in ) { 33 33 exit | "Unable to open input file" | argv[1]; 34 } catch( Open_Failure * ex ; ex->ostream == &out ) {34 } catch( open_failure * ex ; ex->ostream == &out ) { 35 35 close( in ); // optional 36 36 exit | "Unable to open output file" | argv[2]; -
tests/concurrency/lockfree_stack.cfa
r1db6d70 r38e266ca 10 10 // Created On : Thu May 25 15:36:50 2023 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue May 30 19:02:32202313 // Update Count : 1812 // Last Modified On : Fri Jun 9 14:01:07 2023 13 // Update Count : 68 14 14 // 15 15 … … 29 29 int64_t atom; 30 30 #endif // __SIZEOF_INT128__ 31 } __attribute__(( aligned( 16 ) ));31 }; 32 32 33 33 struct Node { … … 42 42 n.next = stack; // atomic assignment unnecessary 43 43 for () { // busy wait 44 if ( CASV( stack.atom, n.next.atom, ((Link){ &n, n.next.count + 1 }.atom) ) ) break; // attempt to update top node 44 Link temp{ &n, n.next.count + 1 }; 45 if ( CASV( s.stack.atom, n.next.atom, temp.atom ) ) break; // attempt to update top node 45 46 } 46 47 } … … 50 51 for () { // busy wait 51 52 if ( t.top == NULL ) return NULL; // empty stack ? 52 if ( CASV( stack.atom, t.atom, ((Link){ t.top->next.top, t.count }.atom) ) ) return t.top; // attempt to update top node 53 Link temp{ t.top->next.top, t.count }; 54 if ( CASV( stack.atom, t.atom, temp.atom ) ) return t.top; // attempt to update top node 53 55 } 54 56 } … … 57 59 Stack stack; // global stack 58 60 59 enum { Times = 60 #if defined( __ARM_ARCH ) // ARM CASV is very slow 61 10_000 62 #else 63 1_000_000 64 #endif // __arm_64__ 65 }; 61 enum { Times = 2_000_000 }; 66 62 67 63 thread Worker {}; … … 82 78 83 79 for ( i; N ) { // push N values on stack 84 // storage must be 16-bytes aligned for cmpxchg16b 85 push( stack, *(Node *)memalign( 16, sizeof( Node ) ) ); 80 push( stack, *(Node *)new() ); // must be 16-byte aligned 86 81 } 87 82 { -
tests/configs/.expect/parseconfig.txt
r1db6d70 r38e266ca 12 12 Maximum student trips: 3 13 13 14 Open_Failure thrown when config file does not exist14 open_failure thrown when config file does not exist 15 15 Failed to open the config file 16 16 -
tests/configs/parseconfig.cfa
r1db6d70 r38e266ca 66 66 67 67 68 sout | " Open_Failure thrown when config file does not exist";68 sout | "open_failure thrown when config file does not exist"; 69 69 try { 70 70 parse_config( xstr(IN_DIR) "doesnt-exist.txt", entries, NUM_ENTRIES, parse_tabular_config_format ); 71 } catch( Open_Failure * ex ) {71 } catch( open_failure * ex ) { 72 72 sout | "Failed to open the config file"; 73 73 } -
tests/copyfile.cfa
r1db6d70 r38e266ca 10 10 // Created On : Fri Jun 19 13:44:05 2020 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Aug 15 15:00:48 202013 // Update Count : 612 // Last Modified On : Mon Jun 5 21:20:19 2023 13 // Update Count : 7 14 14 // 15 15 … … 30 30 exit | "Usage" | argv[0] | "[ input-file (default stdin) [ output-file (default stdout) ] ]"; 31 31 } // choose 32 } catch( Open_Failure * ex ; ex->istream == &in ) {32 } catch( open_failure * ex ; ex->istream == &in ) { 33 33 exit | "Unable to open input file" | argv[1]; 34 } catch( Open_Failure * ex ; ex->ostream == &out ) {34 } catch( open_failure * ex ; ex->ostream == &out ) { 35 35 close( in ); // optional 36 36 exit | "Unable to open output file" | argv[2]; -
tests/rational.cfa
r1db6d70 r38e266ca 10 10 // Created On : Mon Mar 28 08:43:12 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 20 18:13:40 202113 // Update Count : 10 712 // Last Modified On : Mon Jun 5 22:58:09 2023 13 // Update Count : 108 14 14 // 15 15 … … 19 19 #include <fstream.hfa> 20 20 21 typedef Rational(int) RatInt;21 typedef rational(int) rat_int; 22 22 double convert( int i ) { return (double)i; } // used by narrow/widen 23 23 int convert( double d ) { return (int)d; } … … 25 25 int main() { 26 26 sout | "constructor"; 27 RatInt a = { 3 }, b = { 4 }, c, d = 0, e = 1;27 rat_int a = { 3 }, b = { 4 }, c, d = 0, e = 1; 28 28 sout | "a : " | a | "b : " | b | "c : " | c | "d : " | d | "e : " | e; 29 29 30 a = ( RatInt){ 4, 8 };31 b = ( RatInt){ 5, 7 };30 a = (rat_int){ 4, 8 }; 31 b = (rat_int){ 5, 7 }; 32 32 sout | "a : " | a | "b : " | b; 33 a = ( RatInt){ -2, -3 };34 b = ( RatInt){ 3, -2 };33 a = (rat_int){ -2, -3 }; 34 b = (rat_int){ 3, -2 }; 35 35 sout | "a : " | a | "b : " | b; 36 a = ( RatInt){ -2, 3 };37 b = ( RatInt){ 3, 2 };36 a = (rat_int){ -2, 3 }; 37 b = (rat_int){ 3, 2 }; 38 38 sout | "a : " | a | "b : " | b; 39 39 sout | nl; 40 40 41 41 sout | "comparison"; 42 a = ( RatInt){ -2 };43 b = ( RatInt){ -3, 2 };42 a = (rat_int){ -2 }; 43 b = (rat_int){ -3, 2 }; 44 44 sout | "a : " | a | "b : " | b; 45 sout | "a == 0 : " | a == ( Rational(int)){0}; // FIX ME46 sout | "a == 1 : " | a == ( Rational(int)){1}; // FIX ME45 sout | "a == 0 : " | a == (rational(int)){0}; // FIX ME 46 sout | "a == 1 : " | a == (rational(int)){1}; // FIX ME 47 47 sout | "a != 0 : " | a != 0; 48 48 sout | "! a : " | ! a; … … 73 73 74 74 sout | "conversion"; 75 a = ( RatInt){ 3, 4 };75 a = (rat_int){ 3, 4 }; 76 76 sout | widen( a ); 77 a = ( RatInt){ 1, 7 };77 a = (rat_int){ 1, 7 }; 78 78 sout | widen( a ); 79 a = ( RatInt){ 355, 113 };79 a = (rat_int){ 355, 113 }; 80 80 sout | widen( a ); 81 81 sout | narrow( 0.75, 4 ); … … 90 90 91 91 sout | "more tests"; 92 RatInt x = { 1, 2 }, y = { 2 };92 rat_int x = { 1, 2 }, y = { 2 }; 93 93 sout | x - y; 94 94 sout | x > y; … … 96 96 sout | y | denominator( y, -2 ) | y; 97 97 98 RatInt z = { 0, 5 };98 rat_int z = { 0, 5 }; 99 99 sout | z; 100 100 101 101 sout | x | numerator( x, 0 ) | x; 102 102 103 x = ( RatInt){ 1, MAX } + (RatInt){ 1, MAX };103 x = (rat_int){ 1, MAX } + (rat_int){ 1, MAX }; 104 104 sout | x; 105 x = ( RatInt){ 3, MAX } + (RatInt){ 2, MAX };105 x = (rat_int){ 3, MAX } + (rat_int){ 2, MAX }; 106 106 sout | x; 107 107
Note:
See TracChangeset
for help on using the changeset viewer.