- Timestamp:
- Feb 26, 2024, 3:53:42 AM (19 months ago)
- Branches:
- master
- Children:
- 3f9a8d0
- Parents:
- 0522ebe (diff), 022bce0 (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:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/.expect/attributes.arm64.txt
r0522ebe ra4da45e 6 6 7 7 } 8 struct __a nonymous0 {8 struct __attribute__ ((unused)) __anonymous0 { 9 9 }; 10 10 static inline void _X12_constructorFv_S12__anonymous0_autogen___1(struct __anonymous0 *_X4_dstS12__anonymous0_1); -
tests/.expect/attributes.x64.txt
r0522ebe ra4da45e 6 6 7 7 } 8 struct __a nonymous0 {8 struct __attribute__ ((unused)) __anonymous0 { 9 9 }; 10 10 static inline void _X12_constructorFv_S12__anonymous0_autogen___1(struct __anonymous0 *_X4_dstS12__anonymous0_1); -
tests/.expect/attributes.x86.txt
r0522ebe ra4da45e 6 6 7 7 } 8 struct __a nonymous0 {8 struct __attribute__ ((unused)) __anonymous0 { 9 9 }; 10 10 static inline void _X12_constructorFv_S12__anonymous0_autogen___1(struct __anonymous0 *_X4_dstS12__anonymous0_1); -
tests/collections/.expect/string-istream-manip.txt
r0522ebe ra4da45e 70 70 14 71 71 15 72 16 get this line 73 17 @# this line 1)-{} 74 18 @# this line 1)-{} 75 19 abc 76 20 abc 77 21 d d 78 79 d 80 22 ZC44% 81 23 ZC44% 72 82 1 yyyyyyyyyyyyyyyyyyyy 73 83 2 abcxxx … … 85 95 14 86 96 15 97 16 get this line 98 17 @# this line 1)-{} 99 18 @# this line 1)-{} 100 19 abc 101 20 abc 102 21 d d 103 104 d 105 22 ZC44% 106 23 ZC44% -
tests/collections/.in/string-istream-manip.txt
r0522ebe ra4da45e 38 38 aaaaaaaaxxxxxxxxaabbccbbdddwwwbbbbbbbbwwwwwwwwaaaaaaaawwwwwwwwaaaaaaaawwwwwwww 39 39 uuuuu 40 get this line 41 @# this line 1)-{}% 42 @# this line 2)-{}% 43 "abc" 44 'abc ' 45 { d d 46 47 d } 48 X ZC44%Y 49 X ZC55%Y 40 50 abc 41 51 cccccb … … 45 55 aaaaaaaaxxxxxxxxaabbccbbdddwwwbbbbbbbbwwwwwwwwaaaaaaaawwwwwwwwaaaaaaaawwwwwwww 46 56 uuuuu 57 get this line 58 @# this line 1)-{}% 59 @# this line 2)-{}% 60 "abc" 61 'abc ' 62 { d d 63 64 d } 65 X ZC44%Y 66 X ZC55%Y -
tests/collections/string-istream-manip.cfa
r0522ebe ra4da45e 10 10 // The test cases that use plainjane(-) are exercising the via-manipulator code path, 11 11 // just with trivial manipulation. 12 static _Istream_Sstr plainjane( string 12 static _Istream_Sstr plainjane( string & s ) { return (_Istream_Sstr)@{ s, {{0p}, -1, {.flags.rwd : false}} }; } 13 13 static _Istream_Rstr plainjane( string_res & s ) { return (_Istream_Rstr)@{ &s, {{0p}, -1, {.flags.rwd : false}} }; } 14 14 15 15 static void forceStringHeapFreeSpaceTo(int desiredSize) { 16 17 18 19 20 21 16 for (1_000_000) { 17 string x = "a"; 18 (void)x; 19 if (desiredSize == DEBUG_string_bytes_avail_until_gc(DEBUG_string_heap())) return; 20 } 21 sout | "Unable to force size" | desiredSize | "in 1,000,000 tries"; 22 22 } 23 23 24 24 int main() { 25 // These "pre" cases deal with issues analogous to the "pre" cases of io/manipulatorsInput. 26 // The acceptance criterion is simpler but driving the cases is harder. 27 // The tests just read strings and echo what they read; acceptance of simple echoing assures 28 // no spurious splitting merging. 29 // The lengths of the strings are chosen to match white-box knowledge of when the string layer 30 // has tor drive the cstring layer through a second iteration: 31 // - for no-manip, lengths are near the room at end of string heap 32 // (chosen target size of 9 showed the original bug on preS2, aligned with the other cases) 33 // - for manip, lengths are near the auxiliary buffer size of 128 34 // Only first case repeats for string_res; rest run only from the passthru string layer. 35 // Similarly, the manipulator breadth isn't checked at the cstring layer either. 36 { 37 // S: string, no manipulator 38 void echoTillX(const char * casename) { 39 string s; 40 // loop assumes behaviour not tested until main-case #15: 41 // on reading nothing, the prior string value is left alone 42 do { 43 s = ""; 44 forceStringHeapFreeSpaceTo(9); 45 sin | s; 46 sout | casename | s; 47 } while ( size(s) > 0 && s[size(s)-1] != 'x' ); 48 } 49 echoTillX("preS1"); 50 echoTillX("preS2"); 51 echoTillX("preS3"); 52 echoTillX("preS4"); 53 } 54 { 55 // SMN: string, manipulator for no-op 56 void echoTillX(const char * casename) { 57 string s; 58 do { 59 s = ""; 60 sin | plainjane( s ); 61 sout | casename | s; 62 } while ( size(s) > 0 && s[size(s)-1] != 'x' ); 63 } 64 echoTillX("preSMN1"); 65 echoTillX("preSMN2"); 66 echoTillX("preSMN3"); 67 echoTillX("preSMN4"); 68 } 69 { 70 // RMN: string_res, manipulator for no-op 71 void echoTillX(const char * casename) { 72 string_res s; 73 do { 74 s = ""; 75 sin | plainjane( s ); 76 sout | casename | s; 77 } while ( size(s) > 0 && s[size(s)-1] != 'x' ); 78 } 79 echoTillX("preRMN1"); 80 echoTillX("preRMN2"); 81 echoTillX("preRMN3"); 82 echoTillX("preRMN4"); 83 } 84 { 85 // SMI: string, manipulator `incl` 86 void echoTillX(const char * casename) { 87 string s; 88 do { 89 s = ""; 90 sin | skip("-\n"); 91 sin | incl( ".:|# x", s ); 92 sout | casename | " \"" | s | "\""; 93 } while ( size(s) > 0 && s[size(s)-1] != 'x' ); 94 } 95 echoTillX("preSMI1"); 96 echoTillX("preSMI2"); 97 echoTillX("preSMI3"); 98 echoTillX("preSMI4"); 99 } 100 { 101 // SME: string, manipulator `excl` 102 void echoTillX(const char * casename) { 103 string s; 104 do { 105 s = ""; 106 sin | skip("-\n"); 107 sin | excl( "-\n", s ); 108 sout | casename | " \"" | s | "\""; 109 } while ( size(s) > 0 && s[size(s)-1] != 'x' ); 110 } 111 echoTillX("preSME1"); 112 echoTillX("preSME2"); 113 echoTillX("preSME3"); 114 echoTillX("preSME4"); 115 } 116 sin | skip("-\n"); 117 { 118 // SMG: string, manipulator `getline` 119 void echoTillX(const char * casename) { 120 string s; 121 do { 122 s = ""; 123 sin | getline( s ); 124 sout | casename | s; 125 } while ( size(s) > 0 && s[size(s)-1] != 'x' ); 126 } 127 echoTillX("preSMG1"); 128 echoTillX("preSMG2"); 129 echoTillX("preSMG3"); 130 echoTillX("preSMG4"); 131 } 132 { 133 // SMD: string, manipulator (`getline` with custom) delimiter 134 void echoTillX(const char * casename) { 135 string s; 136 do { 137 s = ""; 138 sin | getline( s, '@' ); 139 sout | casename | s; 140 } while ( size(s) > 0 && s[size(s)-1] != 'x' ); 141 sin | skip(" \n"); 142 } 143 echoTillX("preSMD1"); 144 echoTillX("preSMD2"); 145 echoTillX("preSMD3"); 146 echoTillX("preSMD4"); 147 } 148 149 /* Keep harmonized with io/manipulatorsInput */ 150 { 151 string s = "yyyyyyyyyyyyyyyyyyyy"; 152 char sk[] = "abc"; 153 sin | "abc " | skip( sk ) | skip( 5 ); sout | "1" | s; 154 sin | s; sout | "2" | s; 155 sin | ignore( s ); sout | "3" | s; 156 sin | wdi( 8, s ); sout | "4" | s; 157 sin | ignore( wdi( 8, s ) ); sout | "5" | s; 158 159 sin | incl( "abc", s ); sout | "6" | s; 160 sin | excl( "abc", s ); sout | "7" | s; 161 sin | ignore( incl( "abc", s ) ); sout | "8" | s; 162 sin | ignore( excl( "abc", s ) ); sout | "9" | s; 163 sin | incl( "abc", wdi( 8, s ) ); sout | "10" | s; 164 sin | excl( "abc", wdi( 8, s ) ); sout | "11" | s; 165 sin | ignore( incl( "abc", wdi( 8, s ) ) ); sout | "12" | s; 166 sin | ignore( excl( "abc", wdi( 8, s ) ) ); sout | "13" | s; 25 // These "pre" cases deal with issues analogous to the "pre" cases of io/manipulatorsInput. 26 // The acceptance criterion is simpler but driving the cases is harder. 27 // The tests just read strings and echo what they read; acceptance of simple echoing assures 28 // no spurious splitting merging. 29 // The lengths of the strings are chosen to match white-box knowledge of when the string layer 30 // has tor drive the cstring layer through a second iteration: 31 // - for no-manip, lengths are near the room at end of string heap 32 // (chosen target size of 9 showed the original bug on preS2, aligned with the other cases) 33 // - for manip, lengths are near the auxiliary buffer size of 128 34 // Only first case repeats for string_res; rest run only from the passthru string layer. 35 // Similarly, the manipulator breadth isn't checked at the cstring layer either. 36 { 37 // S: string, no manipulator 38 void echoTillX(const char * casename) { 39 string s; 40 // loop assumes behaviour not tested until main-case #15: 41 // on reading nothing, the prior string value is left alone 42 do { 43 s = ""; 44 forceStringHeapFreeSpaceTo(9); 45 sin | s; 46 sout | casename | s; 47 } while ( size(s) > 0 && s[size(s)-1] != 'x' ); 48 } 49 echoTillX("preS1"); 50 echoTillX("preS2"); 51 echoTillX("preS3"); 52 echoTillX("preS4"); 53 } 54 { 55 // SMN: string, manipulator for no-op 56 void echoTillX(const char * casename) { 57 string s; 58 do { 59 s = ""; 60 sin | plainjane( s ); 61 sout | casename | s; 62 } while ( size(s) > 0 && s[size(s)-1] != 'x' ); 63 } 64 echoTillX("preSMN1"); 65 echoTillX("preSMN2"); 66 echoTillX("preSMN3"); 67 echoTillX("preSMN4"); 68 } 69 { 70 // RMN: string_res, manipulator for no-op 71 void echoTillX(const char * casename) { 72 string_res s; 73 do { 74 s = ""; 75 sin | plainjane( s ); 76 sout | casename | s; 77 } while ( size(s) > 0 && s[size(s)-1] != 'x' ); 78 } 79 echoTillX("preRMN1"); 80 echoTillX("preRMN2"); 81 echoTillX("preRMN3"); 82 echoTillX("preRMN4"); 83 } 84 { 85 // SMI: string, manipulator `incl` 86 void echoTillX(const char * casename) { 87 string s; 88 do { 89 s = ""; 90 sin | skip("-\n"); 91 sin | incl( ".:|# x", s ); 92 sout | casename | " \"" | s | "\""; 93 } while ( size(s) > 0 && s[size(s)-1] != 'x' ); 94 } 95 echoTillX("preSMI1"); 96 echoTillX("preSMI2"); 97 echoTillX("preSMI3"); 98 echoTillX("preSMI4"); 99 } 100 { 101 // SME: string, manipulator `excl` 102 void echoTillX(const char * casename) { 103 string s; 104 do { 105 s = ""; 106 sin | skip("-\n"); 107 sin | excl( "-\n", s ); 108 sout | casename | " \"" | s | "\""; 109 } while ( size(s) > 0 && s[size(s)-1] != 'x' ); 110 } 111 echoTillX("preSME1"); 112 echoTillX("preSME2"); 113 echoTillX("preSME3"); 114 echoTillX("preSME4"); 115 } 116 sin | skip("-\n"); 117 { 118 // SMG: string, manipulator `getline` 119 void echoTillX(const char * casename) { 120 string s; 121 do { 122 s = ""; 123 sin | getline( s ); 124 sout | casename | s; 125 } while ( size(s) > 0 && s[size(s)-1] != 'x' ); 126 } 127 echoTillX("preSMG1"); 128 echoTillX("preSMG2"); 129 echoTillX("preSMG3"); 130 echoTillX("preSMG4"); 131 } 132 { 133 // SMD: string, manipulator (`getline` with custom) delimiter 134 void echoTillX(const char * casename) { 135 string s; 136 do { 137 s = ""; 138 sin | getline( s, '@' ); 139 sout | casename | s; 140 } while ( size(s) > 0 && s[size(s)-1] != 'x' ); 141 sin | skip(" \n"); 142 } 143 echoTillX("preSMD1"); 144 echoTillX("preSMD2"); 145 echoTillX("preSMD3"); 146 echoTillX("preSMD4"); 147 } 148 // Keep harmonized with io/manipulatorsInput. 149 { 150 string s = "yyyyyyyyyyyyyyyyyyyy"; 151 char sk[] = "abc"; 152 sin | "abc " | skip( sk ) | skip( 5 ); sout | "1" | s; 153 sin | s; sout | "2" | s; 154 sin | ignore( s ); sout | "3" | s; 155 sin | wdi( 8, s ); sout | "4" | s; 156 sin | ignore( wdi( 8, s ) ); sout | "5" | s; 157 158 sin | incl( "abc", s ); sout | "6" | s; 159 sin | excl( "abc", s ); sout | "7" | s; 160 sin | ignore( incl( "abc", s ) ); sout | "8" | s; 161 sin | ignore( excl( "abc", s ) ); sout | "9" | s; 162 sin | incl( "abc", wdi( 8, s ) ); sout | "10" | s; 163 sin | excl( "abc", wdi( 8, s ) ); sout | "11" | s; 164 sin | ignore( incl( "abc", wdi( 8, s ) ) ); sout | "12" | s; 165 sin | ignore( excl( "abc", wdi( 8, s ) ) ); sout | "13" | s; 166 sin | nl; 167 168 s = "q"; 169 sin | incl( "abc", s ); sout | "14" | s; 170 s = "q"; 171 sin | excl( "u", s ); sout | "15" | s; 172 sin | skip( "u" ) | nl; 173 174 sin | getline( s ); sout | "16" | s; 175 sin | getline( s, '%' ) | nl; sout | "17" | s; 176 sin | ignore( getline( s, '%' ) ) | nl; sout | "18" | s; 177 178 sin | quoted( s ); sout | "19" | s; 179 sin | quoted( s, '\'' ); sout | "20" | s; 180 sin | quoted( s, '{', '}' ); sout | "21" | s; 181 sin | quoted( s, 'X', 'Y' ); sout | "22" | s; 182 sin | ignore( quoted( s, 'X', 'Y' ) ); sout | "23" | s; 183 sin | nl; 184 } 185 // Full repeat on string_res layer assures the full manipulator vocabulary is supported there. 186 { 187 string_res s = "yyyyyyyyyyyyyyyyyyyy"; 188 char sk[] = "abc"; 189 sin | "abc " | skip( sk ) | skip( 5 ); sout | "1" | s; 190 sin | s; sout | "2" | s; 191 sin | ignore( s ); sout | "3" | s; 192 sin | wdi( 8, s ); sout | "4" | s; 193 sin | ignore( wdi( 8, s ) ); sout | "5" | s; 194 195 sin | incl( "abc", s ); sout | "6" | s; 196 sin | excl( "abc", s ); sout | "7" | s; 197 sin | ignore( incl( "abc", s ) ); sout | "8" | s; 198 sin | ignore( excl( "abc", s ) ); sout | "9" | s; 199 sin | incl( "abc", wdi( 8, s ) ); sout | "10" | s; 200 sin | excl( "abc", wdi( 8, s ) ); sout | "11" | s; 201 sin | ignore( incl( "abc", wdi( 8, s ) ) ); sout | "12" | s; 202 sin | ignore( excl( "abc", wdi( 8, s ) ) ); sout | "13" | s; 167 203 sin | "\n"; 168 204 169 205 s = "q"; 170 sin | incl( "abc", s ); 171 s = "q"; 172 sin | excl( "u", s ); 206 sin | incl( "abc", s ); sout | "14" | s; 207 s = "q"; 208 sin | excl( "u", s ); sout | "15" | s; 173 209 sin | skip( "u" ); 174 210 sin | "\n"; 175 } 176 // Full repeat on string_res layer assures the full manipulator vocabulary is supported there. 177 { 178 string_res s = "yyyyyyyyyyyyyyyyyyyy"; 179 char sk[] = "abc"; 180 sin | "abc " | skip( sk ) | skip( 5 ); sout | "1" | s; 181 sin | s; sout | "2" | s; 182 sin | ignore( s ); sout | "3" | s; 183 sin | wdi( 8, s ); sout | "4" | s; 184 sin | ignore( wdi( 8, s ) ); sout | "5" | s; 185 186 sin | incl( "abc", s ); sout | "6" | s; 187 sin | excl( "abc", s ); sout | "7" | s; 188 sin | ignore( incl( "abc", s ) ); sout | "8" | s; 189 sin | ignore( excl( "abc", s ) ); sout | "9" | s; 190 sin | incl( "abc", wdi( 8, s ) ); sout | "10" | s; 191 sin | excl( "abc", wdi( 8, s ) ); sout | "11" | s; 192 sin | ignore( incl( "abc", wdi( 8, s ) ) ); sout | "12" | s; 193 sin | ignore( excl( "abc", wdi( 8, s ) ) ); sout | "13" | s; 194 sin | "\n"; 195 196 s = "q"; 197 sin | incl( "abc", s ); sout | "14" | s; 198 s = "q"; 199 sin | excl( "u", s ); sout | "15" | s; 200 sin | skip( "u" ); 201 sin | "\n"; 202 } 211 sin | getline( s ); sout | "16" | s; 212 sin | getline( s, '%' ) | nl; sout | "17" | s; 213 sin | ignore( getline( s, '%' ) ) | nl; sout | "18" | s; 214 215 sin | quoted( s ); sout | "19" | s; 216 sin | quoted( s, '\'' ); sout | "20" | s; 217 sin | quoted( s, '{', '}' ); sout | "21" | s; 218 sin | quoted( s, 'X', 'Y' ); sout | "22" | s; 219 sin | ignore( quoted( s, 'X', 'Y' ) ); sout | "23" | s; 220 } 203 221 } -
tests/configs/parsebools.cfa
r0522ebe ra4da45e 10 10 // Author : Thierry Delisle 11 11 // Created On : Wed Oct 12 15:28:01 2022 12 // Last Modified By : 13 // Last Modified On : 14 // Update Count : 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Sun Feb 11 09:26:13 2024 14 // Update Count : 2 15 15 // 16 16 17 17 #include <fstream.hfa> 18 19 18 #include "../meta/fork+exec.hfa" 20 19 … … 22 21 #include <parseargs.hfa> 23 22 24 int main( int argc, char * argv[]) {23 int main( int argc, char * argv[] ) { 25 24 check_main(argv[0]); 26 25 … … 41 40 42 41 char **left; 43 parse_args( options, "[OPTIONS]...\ntesting bool parameters", left );42 parse_args( options, "[OPTIONS]...\ntesting bool parameters", left ); 44 43 45 44 sout | "yes/no :" | YN; … … 51 50 } 52 51 53 int true_main( const char * path, char * env[]) {54 printf( "no arg:\n");55 if (pid_t child = strict_fork(); child == 0) {56 int ret = execle( path, "parsebools", (const char*)0p, env);57 if (ret < 0) {58 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno));59 exit( 1);52 int true_main( const char * path, char * env[] ) { 53 printf( "no arg:\n" ); 54 if ( pid_t child = strict_fork(); child == 0 ) { 55 int ret = execle( path, "parsebools", (const char*)0p, env ); 56 if ( ret < 0 ) { 57 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 58 exit( 1 ); 60 59 } 61 } 62 else { 63 int status = do_wait(child); 64 print_status(status); 65 } 60 } else { 61 int status = do_wait( child ); 62 print_status( status ); 63 } // if 66 64 67 printf("all true/set arg:\n"); 68 if(pid_t child = strict_fork(); child == 0) { 69 int ret = execle(path, "parsebools", "-e=yes", "-y=Y", "-n=y", "-t=true", "-s", "-u", (const char*)0p, env); 70 if(ret < 0) { 71 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 72 exit(1); 73 } 74 } 75 else { 76 int status = do_wait(child); 77 print_status(status); 78 } 65 printf( "all true/set arg:\n" ); 66 if ( pid_t child = strict_fork(); child == 0 ) { 67 int ret = execle( path, "parsebools", "-e=yes", "-y=Y", "-n=y", "-t=true", "-s", "-u", (const char*)0p, env ); 68 if ( ret < 0 ) { 69 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 70 exit( 1 ); 71 } // if 72 } else { 73 int status = do_wait( child ); 74 print_status( status ); 75 } // if 79 76 80 printf("all false/unset arg:\n"); 81 if(pid_t child = strict_fork(); child == 0) { 82 int ret = execle(path, "parsebools", "-e=no", "-y=N", "-n=n", "-t=false", (const char*)0p, env); 83 if(ret < 0) { 84 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 85 exit(1); 86 } 87 } 88 else { 89 int status = do_wait(child); 90 print_status(status); 91 } 77 printf( "all false/unset arg:\n" ); 78 if ( pid_t child = strict_fork(); child == 0 ) { 79 int ret = execle( path, "parsebools", "-e=no", "-y=N", "-n=n", "-t=false", (const char*)0p, env ); 80 if ( ret < 0 ) { 81 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 82 exit( 1 ); 83 } // if 84 } else { 85 int status = do_wait( child ); 86 print_status( status ); 87 } // if 92 88 93 printf("gibberish arg 1:\n"); 94 if(pid_t child = strict_fork(); child == 0) { 95 int ret = execle(path, "parsebools", "-y=true", (const char*)0p, env); 96 if(ret < 0) { 97 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 98 exit(1); 99 } 100 } 101 else { 102 int status = do_wait(child); 103 print_status(status); 104 } 89 printf( "gibberish arg 1:\n" ); 90 if ( pid_t child = strict_fork(); child == 0 ) { 91 int ret = execle( path, "parsebools", "-y=true", (const char*)0p, env ); 92 if ( ret < 0 ) { 93 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 94 exit( 1 ); 95 } // if 96 } else { 97 int status = do_wait( child ); 98 print_status( status ); 99 } // if 105 100 106 printf("gibberish arg 2:\n"); 107 if(pid_t child = strict_fork(); child == 0) { 108 int ret = execle(path, "parsebools", "-t=yes", (const char*)0p, env); 109 if(ret < 0) { 110 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 111 exit(1); 112 } 113 } 114 else { 115 int status = do_wait(child); 116 print_status(status); 117 } 101 printf( "gibberish arg 2:\n" ); 102 if ( pid_t child = strict_fork(); child == 0 ) { 103 int ret = execle( path, "parsebools", "-t=yes", (const char*)0p, env ); 104 if ( ret < 0 ) { 105 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 106 exit( 1 ); 107 } // if 108 } else { 109 int status = do_wait( child ); 110 print_status( status ); 111 } // if 118 112 119 printf("gibberish arg 3:\n"); 120 if(pid_t child = strict_fork(); child == 0) { 121 int ret = execle(path, "parsebools", "-s=yes", (const char*)0p, env); 122 if(ret < 0) { 123 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 124 exit(1); 125 } 126 } 127 else { 128 int status = do_wait(child); 129 print_status(status); 130 } 113 printf( "gibberish arg 3:\n" ); 114 if ( pid_t child = strict_fork(); child == 0 ) { 115 int ret = execle( path, "parsebools", "-s=yes", (const char*)0p, env ); 116 if ( ret < 0 ) { 117 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 118 exit( 1 ); 119 } // if 120 } else { 121 int status = do_wait( child ); 122 print_status( status ); 123 } // if 131 124 132 printf("gibberish arg 4:\n"); 133 if(pid_t child = strict_fork(); child == 0) { 134 int ret = execle(path, "parsebools", "-u=yes", (const char*)0p, env); 135 if(ret < 0) { 136 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 137 exit(1); 138 } 139 } 140 else { 141 int status = do_wait(child); 142 print_status(status); 143 } 125 printf( "gibberish arg 4:\n" ); 126 if ( pid_t child = strict_fork(); child == 0 ) { 127 int ret = execle( path, "parsebools", "-u=yes", ( const char*)0p, env ); 128 if ( ret < 0 ) { 129 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 130 exit( 1 ); 131 } // if 132 } else { 133 int status = do_wait( child ); 134 print_status( status ); 135 } // if 144 136 145 printf( "All Done!\n");137 printf( "All Done!\n" ); 146 138 147 139 return 0; -
tests/configs/parsenums.cfa
r0522ebe ra4da45e 32 32 #endif 33 33 34 int true_main( const char * exec);35 36 int main( int argc, char * argv[]) {37 check_main( argv[0]);34 int true_main( const char * exec ); 35 36 int main( int argc, char * argv[]) { 37 check_main( argv[0]); 38 38 39 39 int i = -3; … … 52 52 53 53 char **left; 54 parse_args( options, "[OPTIONS]...\ntesting bool parameters", left );54 parse_args( options, "[OPTIONS]...\ntesting bool parameters", left ); 55 55 56 56 sout | "int :" | i; … … 61 61 } 62 62 63 int true_main(const char * path, char * env[]) { 64 printf("no arg:\n"); 65 if(pid_t child = strict_fork(); child == 0) { 66 int ret = execle(path, "parsenums", (const char*)0p, env); 67 if(ret < 0) { 68 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 69 exit(1); 70 } 71 } 72 else { 73 int status = do_wait(child); 74 print_status(status); 75 } 76 77 printf("all 0 arg:\n"); 78 if(pid_t child = strict_fork(); child == 0) { 79 int ret = execle(path, "parsenums", "-i=0", "-u=0", "-l=0", "-L=0", "-d=0", (const char*)0p, env); 80 if(ret < 0) { 81 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 82 exit(1); 83 } 84 } 85 else { 86 int status = do_wait(child); 87 print_status(status); 88 } 89 90 printf("negative vals arg:\n"); 91 if(pid_t child = strict_fork(); child == 0) { 92 int ret = execle(path, "parsenums", "-i=-1", "-d=-1", (const char*)0p, env); 93 if(ret < 0) { 94 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 95 exit(1); 96 } 97 } 98 else { 99 int status = do_wait(child); 100 print_status(status); 101 } 102 103 printf("funky notation arg:\n"); 104 if(pid_t child = strict_fork(); child == 0) { 105 int ret = execle(path, "parsenums", "-i=0x10", "-u=0x20", "-l=0x300", "-L=0x4000", "-d=5e6", (const char*)0p, env); 106 if(ret < 0) { 107 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 108 exit(1); 109 } 110 } 111 else { 112 int status = do_wait(child); 113 print_status(status); 114 } 115 116 printf("big values arg:\n"); 117 if(pid_t child = strict_fork(); child == 0) { 118 int ret = execle(path, "parsenums", "-i=2147483647", "-u=4294967295", "-l=" BIG_UNSIGNED_LONG, "-L=18446744073709551615", "-d=5e6", (const char*)0p, env); 119 if(ret < 0) { 120 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 121 exit(1); 122 } 123 } 124 else { 125 int status = do_wait(child); 126 print_status(status); 127 } 128 129 printf("too big values arg:\n"); 130 if(pid_t child = strict_fork(); child == 0) { 131 int ret = execle(path, "parsenums", "-i=2147483648", (const char*)0p, env); 132 if(ret < 0) { 133 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 134 exit(1); 135 } 136 } 137 else { 138 int status = do_wait(child); 139 print_status(status); 140 } 141 142 if(pid_t child = strict_fork(); child == 0) { 143 int ret = execle(path, "parsenums", "-u=4294967296", (const char*)0p, env); 144 if(ret < 0) { 145 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 146 exit(1); 147 } 148 } 149 else { 150 int status = do_wait(child); 151 print_status(status); 152 } 153 154 if(pid_t child = strict_fork(); child == 0) { 155 int ret = execle(path, "parsenums", "-l=" TOO_BIG_UNSIGNED_LONG, (const char*)0p, env); 156 if(ret < 0) { 157 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 158 exit(1); 159 } 160 } 161 else { 162 int status = do_wait(child); 163 print_status(status); 164 } 165 166 if(pid_t child = strict_fork(); child == 0) { 167 int ret = execle(path, "parsenums", "-L=18446744073709551616", (const char*)0p, env); 168 if(ret < 0) { 169 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 170 exit(1); 171 } 172 } 173 else { 174 int status = do_wait(child); 175 print_status(status); 176 } 177 178 printf("negative errors arg:\n"); 179 if(pid_t child = strict_fork(); child == 0) { 180 int ret = execle(path, "parsenums", "-u=-1", (const char*)0p, env); 181 if(ret < 0) { 182 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 183 exit(1); 184 } 185 } 186 else { 187 int status = do_wait(child); 188 print_status(status); 189 } 190 191 if(pid_t child = strict_fork(); child == 0) { 192 int ret = execle(path, "parsenums", "-l=-1", (const char*)0p, env); 193 if(ret < 0) { 194 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 195 exit(1); 196 } 197 } 198 else { 199 int status = do_wait(child); 200 print_status(status); 201 } 202 203 if(pid_t child = strict_fork(); child == 0) { 204 int ret = execle(path, "parsenums", "-L=-1", (const char*)0p, env); 205 if(ret < 0) { 206 fprintf(stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror(errno)); 207 exit(1); 208 } 209 } 210 else { 211 int status = do_wait(child); 212 print_status(status); 213 } 214 215 printf("All Done!\n"); 63 int true_main( const char * path, char * env[] ) { 64 printf( "no arg:\n" ); 65 if ( pid_t child = strict_fork(); child == 0 ) { 66 int ret = execle( path, "parsenums", (const char*)0p, env ); 67 if ( ret < 0 ) { 68 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 69 exit( 1 ); 70 } // if 71 } else { 72 int status = do_wait( child ); 73 print_status( status ); 74 } // if 75 76 printf( "all 0 arg:\n" ); 77 if ( pid_t child = strict_fork(); child == 0 ) { 78 int ret = execle( path, "parsenums", "-i=0", "-u=0", "-l=0", "-L=0", "-d=0", (const char*)0p, env ); 79 if ( ret < 0 ) { 80 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 81 exit( 1 ); 82 } // if 83 } else { 84 int status = do_wait( child ); 85 print_status( status ); 86 } // if 87 88 printf( "negative vals arg:\n" ); 89 if ( pid_t child = strict_fork(); child == 0 ) { 90 int ret = execle( path, "parsenums", "-i=-1", "-d=-1", (const char*)0p, env ); 91 if ( ret < 0 ) { 92 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 93 exit( 1 ); 94 } // if 95 } else { 96 int status = do_wait( child ); 97 print_status( status ); 98 } // if 99 100 printf( "funky notation arg:\n" ); 101 if ( pid_t child = strict_fork(); child == 0 ) { 102 int ret = execle( path, "parsenums", "-i=0x10", "-u=0x20", "-l=0x300", "-L=0x4000", "-d=5e6", (const char*)0p, env ); 103 if ( ret < 0 ) { 104 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 105 exit( 1 ); 106 } // if 107 } else { 108 int status = do_wait( child ); 109 print_status( status ); 110 } // if 111 112 printf( "big values arg:\n" ); 113 if ( pid_t child = strict_fork(); child == 0 ) { 114 int ret = execle( path, "parsenums", "-i=2147483647", "-u=4294967295", "-l=" BIG_UNSIGNED_LONG, "-L=18446744073709551615", "-d=5e6", (const char*)0p, env ); 115 if ( ret < 0 ) { 116 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 117 exit( 1 ); 118 } // if 119 } else { 120 int status = do_wait( child ); 121 print_status( status ); 122 } // if 123 124 printf( "too big values arg:\n" ); 125 if ( pid_t child = strict_fork(); child == 0 ) { 126 int ret = execle( path, "parsenums", "-i=2147483648", (const char*)0p, env ); 127 if ( ret < 0 ) { 128 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 129 exit( 1 ); 130 } // if 131 } else { 132 int status = do_wait( child ); 133 print_status( status ); 134 } // if 135 136 if ( pid_t child = strict_fork(); child == 0 ) { 137 int ret = execle( path, "parsenums", "-u=4294967296", (const char*)0p, env ); 138 if ( ret < 0 ) { 139 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 140 exit( 1 ); 141 } // if 142 } else { 143 int status = do_wait( child ); 144 print_status( status ); 145 } // if 146 147 if ( pid_t child = strict_fork(); child == 0 ) { 148 int ret = execle( path, "parsenums", "-l=" TOO_BIG_UNSIGNED_LONG, (const char*)0p, env ); 149 if ( ret < 0 ) { 150 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 151 exit( 1 ); 152 } // if 153 } else { 154 int status = do_wait( child ); 155 print_status( status ); 156 } // if 157 158 if ( pid_t child = strict_fork(); child == 0 ) { 159 int ret = execle( path, "parsenums", "-L=18446744073709551616", (const char*)0p, env ); 160 if ( ret < 0 ) { 161 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 162 exit( 1 ); 163 } // if 164 } else { 165 int status = do_wait( child ); 166 print_status( status ); 167 } // if 168 169 printf( "negative errors arg:\n" ); 170 if ( pid_t child = strict_fork(); child == 0 ) { 171 int ret = execle( path, "parsenums", "-u=-1", (const char*)0p, env ); 172 if ( ret < 0 ) { 173 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 174 exit( 1 ); 175 } // if 176 } else { 177 int status = do_wait( child ); 178 print_status( status ); 179 } // if 180 181 if ( pid_t child = strict_fork(); child == 0 ) { 182 int ret = execle( path, "parsenums", "-l=-1", (const char*)0p, env ); 183 if ( ret < 0 ) { 184 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 185 exit( 1 ); 186 } // if 187 } else { 188 int status = do_wait( child ); 189 print_status( status ); 190 } // if 191 192 if ( pid_t child = strict_fork(); child == 0 ) { 193 int ret = execle( path, "parsenums", "-L=-1", (const char*)0p, env ); 194 if ( ret < 0 ) { 195 fprintf( stderr, "Execl 2 returned with error: %d '%s'\n", errno, strerror( errno ) ); 196 exit( 1 ); 197 } // if 198 } else { 199 int status = do_wait( child ); 200 print_status( status ); 201 } // if 202 203 printf( "All Done!\n" ); 216 204 217 205 return 0; -
tests/configs/usage.cfa
r0522ebe ra4da45e 10 10 // Author : Thierry Delisle 11 11 // Created On : Wed Oct 12 15:28:01 2022 12 // Last Modified By : 13 // Last Modified On : 14 // Update Count : 12 // Last Modified By : Peter A. Buhr 13 // Last Modified On : Sun Feb 11 09:29:51 2024 14 // Update Count : 1 15 15 // 16 16 … … 24 24 25 25 sout | "No args, no errors"; 26 if (pid_t child = strict_fork(); child == 0) {26 if ( pid_t child = strict_fork(); child == 0 ) { 27 27 array( cfa_option, 0 ) opts; 28 print_args_usage(1, fake_argv, opts, "Test usage", false); 29 } 30 else { 31 int status = do_wait(child); 32 print_status(status); 33 } 28 print_args_usage(1, fake_argv, opts, "Test usage", false ); 29 } else { 30 int status = do_wait( child ); 31 print_status( status ); 32 } // if 34 33 35 34 sout | "No args, with errors"; 36 if (pid_t child = strict_fork(); child == 0) {35 if ( pid_t child = strict_fork(); child == 0 ) { 37 36 array( cfa_option, 0 ) opts; 38 print_args_usage(1, fake_argv, opts, "Test usage", true); 39 } 40 else { 41 int status = do_wait(child); 42 print_status(status); 43 } 37 print_args_usage(1, fake_argv, opts, "Test usage", true ); 38 } else { 39 int status = do_wait( child ); 40 print_status( status ); 41 } // if 44 42 45 43 sout | "Args with short names only:"; 46 if (pid_t child = strict_fork(); child == 0) {44 if ( pid_t child = strict_fork(); child == 0 ) { 47 45 int a, b, c; 48 46 array( cfa_option, 3 ) opts; … … 50 48 opts[1] = (cfa_option){'b', "", "Second arg", b }; 51 49 opts[2] = (cfa_option){'c', "", "Third arg", c }; 52 print_args_usage(1, fake_argv, opts, "Test usage", false); 53 } 54 else { 55 int status = do_wait(child); 56 print_status(status); 57 } 50 print_args_usage(1, fake_argv, opts, "Test usage", false ); 51 } else { 52 int status = do_wait( child ); 53 print_status( status ); 54 } // if 58 55 59 56 sout | "Args with long names only:"; 60 if (pid_t child = strict_fork(); child == 0) {57 if ( pid_t child = strict_fork(); child == 0 ) { 61 58 int a, b, c; 62 59 array( cfa_option, 3 ) opts; … … 64 61 opts[1] = (cfa_option){'\0', "BB", "Second arg", b }; 65 62 opts[2] = (cfa_option){'\0', "CC", "Third arg", c }; 66 print_args_usage(1, fake_argv, opts, "Test usage", false); 67 } 68 else { 69 int status = do_wait(child); 70 print_status(status); 71 } 63 print_args_usage(1, fake_argv, opts, "Test usage", false ); 64 } else { 65 int status = do_wait( child ); 66 print_status( status ); 67 } // if 72 68 73 69 sout | "Mix of short and long args:"; 74 if (pid_t child = strict_fork(); child == 0) {70 if ( pid_t child = strict_fork(); child == 0 ) { 75 71 int a, b, c; 76 72 array( cfa_option, 3 ) opts; … … 78 74 opts[1] = (cfa_option){'b', "BBBB", "Second arg", b }; 79 75 opts[2] = (cfa_option){'\0', "CC", "Third arg", c }; 80 print_args_usage(1, fake_argv, opts, "Test usage", false); 81 } 82 else { 83 int status = do_wait(child); 84 print_status(status); 85 } 76 print_args_usage(1, fake_argv, opts, "Test usage", false ); 77 } else { 78 int status = do_wait( child ); 79 print_status( status ); 80 } // if 86 81 87 82 sout | "Mix of short and long and some missing description:"; 88 if (pid_t child = strict_fork(); child == 0) {83 if ( pid_t child = strict_fork(); child == 0 ) { 89 84 int a, b, c; 90 85 array( cfa_option, 3 ) opts; … … 92 87 opts[1] = (cfa_option){'b', "BBBB", "", b }; 93 88 opts[2] = (cfa_option){'\0', "CC", "Third arg", c }; 94 print_args_usage(1, fake_argv, opts, "Test usage", false); 95 } 96 else { 97 int status = do_wait(child); 98 print_status(status); 99 } 89 print_args_usage(1, fake_argv, opts, "Test usage", false ); 90 } else { 91 int status = do_wait( child ); 92 print_status( status ); 93 } // if 100 94 101 95 sout | "Mix of short and long and some long description:"; 102 if (pid_t child = strict_fork(); child == 0) {96 if ( pid_t child = strict_fork(); child == 0 ) { 103 97 int a, b, c; 104 98 array( cfa_option, 3 ) opts; … … 106 100 opts[1] = (cfa_option){'b', "BBBB", "12345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890", b }; 107 101 opts[2] = (cfa_option){'\0', "CC", "Third arg", c }; 108 print_args_usage(1, fake_argv, opts, "Test usage", false); 109 } 110 else { 111 int status = do_wait(child); 112 print_status(status); 113 } 102 print_args_usage(1, fake_argv, opts, "Test usage", false ); 103 } else { 104 int status = do_wait( child ); 105 print_status( status ); 106 } // if 114 107 } 115 108 116 109 // no used 117 static int true_main( const char * path, char * env[]) { return 0; }110 static int true_main( const char * path, char * env[]) { return 0; } -
tests/errors/.expect/declaration.txt
r0522ebe ra4da45e 8 8 with members 9 9 i: int 10 10 with body 11 11 12 12 … … 14 14 with members 15 15 i: int 16 16 with body 17 17 18 18 -
tests/exceptions/pingpong_nonlocal.cfa
r0522ebe ra4da45e 2 2 #include <thread.hfa> 3 3 #include <mutex_stmt.hfa> 4 #include <Exception.hfa> 4 5 5 exception num_ping_pongs { int num; }; 6 vtable(num_ping_pongs) num_ping_pongs_vt; 6 ExceptionDecl( num_ping_pongs, int num; ); 7 7 8 8 thread Ping_Pong { … … 16 16 this.name = name; 17 17 cnt = 0; 18 ?{}( except, &num_ping_pongs_vt, 0);18 ?{}( except, ExceptionArgs( num_ping_pongs, 0 ) ); 19 19 } 20 20 … … 29 29 for () { 30 30 while( ! poll( this ) ) { yield(); } 31 31 inc_resume_at( cnt ); 32 32 } 33 33 } catchResume( num_ping_pongs * e; e->num < numtimes ) { … … 37 37 mutex( sout ) sout | name | "catch" | cnt | e->num; 38 38 if ( e->num == numtimes ) { 39 39 inc_resume_at( e->num ); 40 40 } 41 41 } … … 49 49 &ping.partner = &pong; // create cycle 50 50 &pong.partner = &ping; 51 num_ping_pongs except{ &num_ping_pongs_vt, 0 }; 52 resumeAt( pong, except ); 51 resumeAt( pong, ExceptionInst( num_ping_pongs, 0 ) ); 53 52 } 54 53 sout | "main end"; -
tests/io/.in/manipulatorsInput.txt
r0522ebe ra4da45e 13 13 @# this line 1)-{}% 14 14 @# this line 2)-{}% 15 "abc"15 "abc" 16 16 'abc ' 17 17 { d d … … 35 35 @# this line 1)-{}% 36 36 @# this line 2)-{}% 37 "abc"37 "abc" 38 38 'abc ' 39 39 { d d -
tests/io/manipulatorsInput.cfa
r0522ebe ra4da45e 7 7 // Created On : Sat Jun 8 17:58:54 2019 8 8 // Last Modified By : Peter A. Buhr 9 // Last Modified On : Sun Jan 28 11:59:55202410 // Update Count : 13 39 // Last Modified On : Mon Feb 5 21:54:49 2024 10 // Update Count : 134 11 11 // 12 12 … … 114 114 sin | wdi( sizeof(s), s ); sout | "2" | s; 115 115 sin | ignore( s ); sout | "3" | s; 116 116 sin | wdi( sizeof(s), 8, s ); sout | "4" | s; 117 117 sin | ignore( wdi( sizeof(s), 8, s ) ); sout | "5" | s; 118 118 … … 131 131 s[0] = 'q'; s[1] = '\0'; 132 132 sin | excl( "u", wdi( sizeof(s), s ) ); sout | "15" | s; 133 sin | skip( "u" ) | "\n";133 sin | skip( "u" ) | nl; 134 134 sin | getline( wdi( sizeof(s), s ) ); sout | "16" | s; 135 sin | getline( wdi( sizeof(s), s ), '%' ) | "\n"; sout | "17" | s;136 sin | ignore( getline( wdi( sizeof(s), s ), '%' ) ) | "\n"; sout | "18" | s;135 sin | getline( wdi( sizeof(s), s ), '%' ) | nl; sout | "17" | s; 136 sin | ignore( getline( wdi( sizeof(s), s ), '%' ) ) | nl; sout | "18" | s; 137 137 138 138 sin | quoted( wdi( sizeof(s), s ) ); sout | "19" | s;
Note:
See TracChangeset
for help on using the changeset viewer.