- Timestamp:
- Aug 31, 2023, 11:31:15 PM (2 years ago)
- Branches:
- master
- Children:
- 950c58e
- Parents:
- 92355883 (diff), 686912c (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
- 8 deleted
- 51 edited
- 15 moved
-
.expect/alloc.txt (modified) (1 diff)
-
.expect/typedefRedef-ERR1.txt (modified) (1 diff)
-
Makefile.am (modified) (3 diffs)
-
PRNG.cfa (modified) (10 diffs)
-
array-collections/.expect/array-basic.txt (moved) (moved from tests/array-container/.expect/array-basic.txt )
-
array-collections/.expect/array-md-sbscr-cases.arm64.txt (moved) (moved from tests/array-container/.expect/array-md-sbscr-cases.arm64.txt )
-
array-collections/.expect/array-md-sbscr-cases.x64.txt (moved) (moved from tests/array-container/.expect/array-md-sbscr-cases.x64.txt )
-
array-collections/.expect/array-sbscr-types.txt (moved) (moved from tests/array-container/.expect/array-sbscr-types.txt )
-
array-collections/.expect/dimexpr-match-c-ERRS.arm64.txt (added)
-
array-collections/.expect/dimexpr-match-c-ERRS.x64.txt (added)
-
array-collections/.expect/dimexpr-match-c-ERRS.x86.txt (added)
-
array-collections/.expect/dimexpr-match-c.txt (moved) (moved from tests/array-container/.expect/dimexpr-match-c.txt ) (4 diffs)
-
array-collections/.expect/dimexpr-match-cfa-ERRS.arm64.txt (added)
-
array-collections/.expect/dimexpr-match-cfa-ERRS.x64.txt (added)
-
array-collections/.expect/dimexpr-match-cfa-ERRS.x86.txt (added)
-
array-collections/.expect/dimexpr-match-cfa.txt (added)
-
array-collections/.expect/language-dim-mismatch.txt (added)
-
array-collections/.expect/safety-summary.txt (added)
-
array-collections/.expect/symtab-collision.txt (added)
-
array-collections/array-basic.cfa (moved) (moved from tests/array-container/array-basic.cfa ) (1 diff)
-
array-collections/array-md-sbscr-cases.cfa (moved) (moved from tests/array-container/array-md-sbscr-cases.cfa ) (1 diff)
-
array-collections/array-sbscr-types.cfa (moved) (moved from tests/array-container/array-sbscr-types.cfa ) (1 diff)
-
array-collections/dimexpr-match-c.cfa (moved) (moved from tests/array-container/dimexpr-match-c.cfa ) (4 diffs)
-
array-collections/dimexpr-match-cfa.cfa (moved) (moved from tests/array-container/dimexpr-match-cfa.cfa ) (4 diffs)
-
array-collections/dimexpr-match-detail.sh (moved) (moved from tests/array-container/dimexpr-match-detail.sh )
-
array-collections/dimexpr-match.hfa (moved) (moved from tests/array-container/dimexpr-match.hfa ) (1 diff)
-
array-collections/language-dim-mismatch.cfa (moved) (moved from tests/array-container/language-dim-mismatch.cfa )
-
array-collections/safety-summary.cfa (added)
-
array-collections/symtab-collision.cfa (added)
-
array-container/.expect/dimexpr-match-c-ERRS.arm64.txt (deleted)
-
array-container/.expect/dimexpr-match-c-ERRS.x64.txt (deleted)
-
array-container/.expect/dimexpr-match-c-ERRS.x86.txt (deleted)
-
array-container/.expect/dimexpr-match-cfa-ERRS.arm64.txt (deleted)
-
array-container/.expect/dimexpr-match-cfa-ERRS.x64.txt (deleted)
-
array-container/.expect/dimexpr-match-cfa-ERRS.x86.txt (deleted)
-
array-container/.expect/dimexpr-match-cfa.txt (deleted)
-
array-container/.expect/language-dim-mismatch.txt (deleted)
-
collections/.expect/string-istream.txt (added)
-
collections/.in/string-istream.txt (added)
-
collections/atomic_mpsc.cfa (modified) (1 diff)
-
collections/string-api-coverage.cfa (modified) (1 diff)
-
collections/string-istream.cfa (added)
-
collections/string-overwrite.cfa (modified) (1 diff)
-
collections/vector-demo.cfa (modified) (1 diff)
-
concurrency/actors/inherit.cfa (modified) (1 diff)
-
concurrency/channels/daisy_chain.cfa (modified) (2 diffs)
-
concurrency/mutexstmt/.expect/tuple.txt (added)
-
concurrency/mutexstmt/tuple.cfa (added)
-
concurrency/unified_locking/thread_test.cfa (modified) (1 diff)
-
concurrency/waituntil/.expect/repeat_close.txt (added)
-
concurrency/waituntil/all_types.cfa (modified) (1 diff)
-
concurrency/waituntil/channel_close.cfa (modified) (3 diffs)
-
concurrency/waituntil/channel_zero_size.cfa (modified) (1 diff)
-
concurrency/waituntil/channels.cfa (modified) (1 diff)
-
concurrency/waituntil/one_chan.cfa (modified) (1 diff)
-
concurrency/waituntil/repeat_close.cfa (added)
-
concurrency/waituntil/timeout.cfa (modified) (1 diff)
-
designations.cfa (modified) (13 diffs)
-
exceptions/.expect/cor_resumer.txt (added)
-
exceptions/.expect/fibonacci_nonlocal.txt (added)
-
exceptions/.expect/pingpong_nonlocal.txt (added)
-
exceptions/.expect/polymorphic.txt (modified) (1 diff)
-
exceptions/cancel/coroutine.cfa (modified) (2 diffs)
-
exceptions/cancel/thread.cfa (modified) (3 diffs)
-
exceptions/conditional.cfa (modified) (2 diffs)
-
exceptions/cor_resumer.cfa (added)
-
exceptions/data-except.cfa (modified) (2 diffs)
-
exceptions/defaults.cfa (modified) (6 diffs)
-
exceptions/except-io.hfa (modified) (3 diffs)
-
exceptions/fibonacci_nonlocal.cfa (added)
-
exceptions/finally.cfa (modified) (2 diffs)
-
exceptions/interact.cfa (modified) (8 diffs)
-
exceptions/pingpong_nonlocal.cfa (added)
-
exceptions/polymorphic.cfa (modified) (7 diffs)
-
exceptions/resume.cfa (modified) (8 diffs)
-
exceptions/terminate.cfa (modified) (8 diffs)
-
exceptions/trash.cfa (modified) (2 diffs)
-
exceptions/virtual-cast.cfa (modified) (2 diffs)
-
exceptions/virtual-poly.cfa (modified) (2 diffs)
-
include/.expect/vector-collections.txt (moved) (moved from tests/include/.expect/vector-containers.txt )
-
include/vector-collections.cfa (moved) (moved from tests/include/vector-containers.cfa ) (1 diff)
-
io/.expect/io.txt (modified) (1 diff)
-
io/.expect/manipulatorsOutput2.arm64.txt (modified) (1 diff)
-
io/.expect/manipulatorsOutput2.x64.txt (modified) (1 diff)
-
io/.expect/manipulatorsOutput2.x86.txt (modified) (1 diff)
-
io/.expect/manipulatorsOutput3.arm64.txt (modified) (1 diff)
-
io/.expect/manipulatorsOutput3.x64.txt (modified) (1 diff)
-
io/io.cfa (modified) (7 diffs)
-
io/manipulatorsInput.cfa (modified) (2 diffs)
-
list/dlist-insert-remove.cfa (modified) (1 diff)
-
maybe.cfa (modified) (1 diff)
-
raii/.expect/memberCtors-ERR1.txt (modified) (1 diff)
-
raii/dtor-early-exit.cfa (modified) (2 diffs)
-
raii/memberCtors.cfa (modified) (2 diffs)
-
result.cfa (modified) (1 diff)
-
zombies/gc_no_raii/premake4.lua (modified) (1 diff)
-
zombies/hashtable.cfa (modified) (1 diff)
-
zombies/hashtable2.cfa (modified) (1 diff)
-
zombies/linked-list-perf/experiment.koad (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
tests/.expect/alloc.txt
r92355883 r2a301ff 6 6 7 7 C array calloc, fill 0 8 0 0 0 0 0 0 0 0 008 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 9 9 CFA array calloc, fill 0 10 0 0 0 0 0 0 0 0 0010 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 0x0 11 11 CFA array alloc, no fill 12 12 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef 0xdeadbeef -
tests/.expect/typedefRedef-ERR1.txt
r92355883 r2a301ff 1 1 typedefRedef.cfa:75:25: warning: Compiled 2 2 typedefRedef.cfa:4:1 error: Cannot redefine typedef: Foo 3 typedefRedef.cfa:31:1 error: Cannot redefine typedef: ARR 3 4 typedefRedef.cfa:65:1 error: Cannot redefine typedef: ARR -
tests/Makefile.am
r92355883 r2a301ff 11 11 ## Created On : Sun May 31 09:08:15 2015 12 12 ## Last Modified By : Peter A. Buhr 13 ## Last Modified On : Sun May 28 08:15:43202314 ## Update Count : 19 613 ## Last Modified On : Wed Aug 30 22:31:45 2023 14 ## Update Count : 197 15 15 ############################################################################### 16 16 … … 91 91 concurrency/unified_locking/mutex_test.hfa \ 92 92 concurrency/channels/parallel_harness.hfa \ 93 array-co ntainer/dimexpr-match.hfa \94 array-co ntainer/dimexpr-match-detail.sh93 array-collections/dimexpr-match.hfa \ 94 array-collections/dimexpr-match-detail.sh 95 95 96 96 dist-hook: … … 227 227 -cp ${test} ${abspath ${@}} 228 228 229 array-co ntainer/dimexpr-match-c-ERRS : array-container/dimexpr-match-c.cfa229 array-collections/dimexpr-match-c-ERRS : array-collections/dimexpr-match-c.cfa 230 230 ${CFACOMPILE_SYNTAX} -DERRS 231 231 -cp ${test} ${abspath ${@}} 232 232 233 array-co ntainer/dimexpr-match-cfa-ERRS : array-container/dimexpr-match-cfa.cfa233 array-collections/dimexpr-match-cfa-ERRS : array-collections/dimexpr-match-cfa.cfa 234 234 ${CFACOMPILE_SYNTAX} -DERRS 235 235 -cp ${test} ${abspath ${@}} -
tests/PRNG.cfa
r92355883 r2a301ff 10 10 // Created On : Wed Dec 29 09:38:12 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu May 25 15:39:52202313 // Update Count : 42 212 // Last Modified On : Mon Aug 14 08:49:53 2023 13 // Update Count : 425 14 14 // 15 15 … … 27 27 #define str(s) #s 28 28 29 #if defined( __x86_64__ ) || defined( __aarch64__ ) // 64-bit architecture30 #define PRNG PRNG6431 #else // 32-bit architecture32 #define PRNG PRNG3233 #endif // __x86_64__34 35 29 //#define TIME 36 30 … … 144 138 srand( rseed ); 145 139 146 sout | sep Disable;140 sout | sepOff; 147 141 sout | nl | wd(26, "rand()" ) | wd(12, "rand(5)") | wd(12, "rand(0,5)" ); 148 142 for ( 20 ) { … … 151 145 sout | wd(12, rand() % (5 - 0 + 1) + 0); 152 146 } // for 153 sout | sep Enable;147 sout | sepOn; 154 148 sout | "seed" | rseed; 155 149 … … 185 179 if ( seed != 0 ) set_seed( prng, seed ); 186 180 187 sout | sep Disable;181 sout | sepOff; 188 182 sout | nl | wd(26, "PRNG()" ) | wd(12, "PRNG(5)") | wd(12, "PRNG(0,5)" ); 189 183 for ( 20 ) { … … 192 186 sout | wd(12, prng( prng, 0, 5 )); 193 187 } // for 194 sout | sep Enable;188 sout | sepOn; 195 189 sout | "seed" | get_seed( prng ); 196 190 … … 220 214 if ( seed != 0 ) set_seed( seed ); 221 215 222 sout | sep Disable;216 sout | sepOff; 223 217 sout | nl | wd(26, "prng()" ) | wd(12, "prng(5)") | wd(12, "prng(0,5)" ); 224 218 for ( 20 ) { … … 227 221 sout | wd(12, prng( 0, 5 )); 228 222 } // for 229 sout | sep Enable;223 sout | sepOn; 230 224 sout | "seed" | get_seed( prng ); 231 225 … … 256 250 thread$ & th = *active_thread(); 257 251 258 sout | sep Disable;252 sout | sepOff; 259 253 sout | nl | wd(26, "prng(t)" ) | wd(12, "prng(t,5)") | wd(12, "prng(t,0,5)" ); 260 254 for ( 20 ) { … … 263 257 sout | wd(12, prng( th, 0, 5 )); 264 258 } // for 265 sout | sep Enable;259 sout | sepOn; 266 260 sout | "seed" | get_seed( prng ); 267 261 -
tests/array-collections/.expect/dimexpr-match-c.txt
r92355883 r2a301ff 13 13 skip STA NE UNS, L=enu7, R=mut42 14 14 done DYN EQ DYN, L=cpr7, R=cpr7 15 doneDYN NE DYN, L=cpr7, R=cpr4215 skip DYN NE DYN, L=cpr7, R=cpr42 16 16 skip DYN NE STA, L=cpr7, R=42 17 17 skip DYN NE STA, L=cpr7, R=enu42 18 doneDYN NE UNS, L=cpr7, R=mut4219 doneUNS EQ UNS, L=mut7, R=mut720 doneUNS NE UNS, L=mut7, R=mut4218 skip DYN NE UNS, L=cpr7, R=mut42 19 skip UNS EQ UNS, L=mut7, R=mut7 20 skip UNS NE UNS, L=mut7, R=mut42 21 21 skip UNS NE STA, L=mut7, R=42 22 22 skip UNS NE STA, L=mut7, R=enu42 23 done UNS NE DYN, L=mut7, R=cpr42 23 skip UNS NE DYN, L=mut7, R=cpr42 24 skip STA NE DYN, L=7, R=dim42 25 skip STA NE DYN, L=enu7, R=dim42 26 skip DYN NE DYN, L=cpr7, R=dim42 27 done DYN EQ DYN, L=dim7, R=dim7 28 skip DYN NE DYN, L=dim7, R=dim42 29 skip DYN NE STA, L=dim7, R=42 30 skip DYN NE STA, L=dim7, R=enu42 31 skip DYN NE DYN, L=dim7, R=cpr42 32 skip DYN NE UNS, L=dim7, R=mut42 33 skip UNS NE DYN, L=mut7, R=dim42 24 34 ---- PTRVAR_INIT: { float a[__R__]; float (*b)[__L__] = & a; } 25 35 done STA EQ STA, L=7, R=7 … … 36 46 skip STA NE UNS, L=enu7, R=mut42 37 47 done DYN EQ DYN, L=cpr7, R=cpr7 38 doneDYN NE DYN, L=cpr7, R=cpr4248 skip DYN NE DYN, L=cpr7, R=cpr42 39 49 skip DYN NE STA, L=cpr7, R=42 40 50 skip DYN NE STA, L=cpr7, R=enu42 41 doneDYN NE UNS, L=cpr7, R=mut4242 doneUNS EQ UNS, L=mut7, R=mut743 doneUNS NE UNS, L=mut7, R=mut4251 skip DYN NE UNS, L=cpr7, R=mut42 52 skip UNS EQ UNS, L=mut7, R=mut7 53 skip UNS NE UNS, L=mut7, R=mut42 44 54 skip UNS NE STA, L=mut7, R=42 45 55 skip UNS NE STA, L=mut7, R=enu42 46 done UNS NE DYN, L=mut7, R=cpr42 56 skip UNS NE DYN, L=mut7, R=cpr42 57 skip STA NE DYN, L=7, R=dim42 58 skip STA NE DYN, L=enu7, R=dim42 59 skip DYN NE DYN, L=cpr7, R=dim42 60 done DYN EQ DYN, L=dim7, R=dim7 61 skip DYN NE DYN, L=dim7, R=dim42 62 skip DYN NE STA, L=dim7, R=42 63 skip DYN NE STA, L=dim7, R=enu42 64 skip DYN NE DYN, L=dim7, R=cpr42 65 skip DYN NE UNS, L=dim7, R=mut42 66 skip UNS NE DYN, L=mut7, R=dim42 47 67 ---- PTRVAR_ASGN: { float a[__R__]; float (*b)[__L__] = 0p; b = & a; } 48 68 done STA EQ STA, L=7, R=7 … … 59 79 skip STA NE UNS, L=enu7, R=mut42 60 80 done DYN EQ DYN, L=cpr7, R=cpr7 61 doneDYN NE DYN, L=cpr7, R=cpr4281 skip DYN NE DYN, L=cpr7, R=cpr42 62 82 skip DYN NE STA, L=cpr7, R=42 63 83 skip DYN NE STA, L=cpr7, R=enu42 64 doneDYN NE UNS, L=cpr7, R=mut4265 doneUNS EQ UNS, L=mut7, R=mut766 doneUNS NE UNS, L=mut7, R=mut4284 skip DYN NE UNS, L=cpr7, R=mut42 85 skip UNS EQ UNS, L=mut7, R=mut7 86 skip UNS NE UNS, L=mut7, R=mut42 67 87 skip UNS NE STA, L=mut7, R=42 68 88 skip UNS NE STA, L=mut7, R=enu42 69 done UNS NE DYN, L=mut7, R=cpr42 89 skip UNS NE DYN, L=mut7, R=cpr42 90 skip STA NE DYN, L=7, R=dim42 91 skip STA NE DYN, L=enu7, R=dim42 92 skip DYN NE DYN, L=cpr7, R=dim42 93 done DYN EQ DYN, L=dim7, R=dim7 94 skip DYN NE DYN, L=dim7, R=dim42 95 skip DYN NE STA, L=dim7, R=42 96 skip DYN NE STA, L=dim7, R=enu42 97 skip DYN NE DYN, L=dim7, R=cpr42 98 skip DYN NE UNS, L=dim7, R=mut42 99 skip UNS NE DYN, L=mut7, R=dim42 70 100 ---- REFVAR_ASGN: { float a[__R__]; float (&b)[__L__] = *0p; & b = & a; } 71 101 done STA EQ STA, L=7, R=7 … … 82 112 skip STA NE UNS, L=enu7, R=mut42 83 113 done DYN EQ DYN, L=cpr7, R=cpr7 84 doneDYN NE DYN, L=cpr7, R=cpr42114 skip DYN NE DYN, L=cpr7, R=cpr42 85 115 skip DYN NE STA, L=cpr7, R=42 86 116 skip DYN NE STA, L=cpr7, R=enu42 87 doneDYN NE UNS, L=cpr7, R=mut4288 doneUNS EQ UNS, L=mut7, R=mut789 doneUNS NE UNS, L=mut7, R=mut42117 skip DYN NE UNS, L=cpr7, R=mut42 118 skip UNS EQ UNS, L=mut7, R=mut7 119 skip UNS NE UNS, L=mut7, R=mut42 90 120 skip UNS NE STA, L=mut7, R=42 91 121 skip UNS NE STA, L=mut7, R=enu42 92 done UNS NE DYN, L=mut7, R=cpr42 122 skip UNS NE DYN, L=mut7, R=cpr42 123 skip STA NE DYN, L=7, R=dim42 124 skip STA NE DYN, L=enu7, R=dim42 125 skip DYN NE DYN, L=cpr7, R=dim42 126 done DYN EQ DYN, L=dim7, R=dim7 127 skip DYN NE DYN, L=dim7, R=dim42 128 skip DYN NE STA, L=dim7, R=42 129 skip DYN NE STA, L=dim7, R=enu42 130 skip DYN NE DYN, L=dim7, R=cpr42 131 skip DYN NE UNS, L=dim7, R=mut42 132 skip UNS NE DYN, L=mut7, R=dim42 -
tests/array-collections/array-basic.cfa
r92355883 r2a301ff 1 #include <co ntainers/array.hfa>1 #include <collections/array.hfa> 2 2 3 3 // -
tests/array-collections/array-md-sbscr-cases.cfa
r92355883 r2a301ff 1 #include <co ntainers/array.hfa>1 #include <collections/array.hfa> 2 2 3 3 #include <assert.h> -
tests/array-collections/array-sbscr-types.cfa
r92355883 r2a301ff 1 #include <co ntainers/array.hfa>1 #include <collections/array.hfa> 2 2 3 3 // Shows support for many required ways a user can index into a new array. -
tests/array-collections/dimexpr-match-c.cfa
r92355883 r2a301ff 16 16 #include "dimexpr-match.hfa" // test framework 17 17 18 #ifdef TRY_WISH_1 // "unification as-if" 19 forall( [N] ) 20 void zip( float (*a)[N], float (*b)[N] ) {} 21 #endif 22 18 23 DECLN_runTests { 19 24 … … 21 26 int mut7 = 7, mut42 = 42; 22 27 23 24 28 #define TRY_COMPAT( LV, RV ) \ 25 29 { \ … … 79 83 80 84 #ifdef TRY_WISH_1 // "unification as-if" 81 forall( [N] )82 void zip( float (*a)[N], float (*b)[N] ) {}83 84 85 #define TRY_COMPAT( LV, RV ) \ 85 86 { \ … … 93 94 94 95 #endif 95 96 97 98 96 } -
tests/array-collections/dimexpr-match-cfa.cfa
r92355883 r2a301ff 9 9 #ifdef INCLUDE_MINIMAL 10 10 #define POUNDINCLUDE #include 11 POUNDINCLUDE <co ntainers/array.hfa>11 POUNDINCLUDE <collections/array.hfa> 12 12 #else 13 #include <co ntainers/array.hfa>// part of SUT13 #include <collections/array.hfa> // part of SUT 14 14 #endif 15 15 16 #include "dimexpr-match.hfa" // test framework16 #include "dimexpr-match.hfa" // test framework 17 17 18 18 // CFA "classic" behaviour is inconsistent between "C array" and "new array." … … 44 44 #endif 45 45 46 forall( [N] ) 47 void zip( array(float, N) & a, array(float, N) & b ) {} 46 48 47 49 DECLN_runTests { … … 50 52 int mut7 = 7, mut42 = 42; 51 53 52 53 54 #define TRY_COMPAT( LV, RV ) \ 54 55 { \ … … 103 104 #undef TRY_COMPAT 104 105 105 106 forall( [N] )107 void zip( array(float, N) & a, array(float, N) & b ) {}108 109 106 #define TRY_COMPAT( LV, RV ) \ 110 107 { \ -
tests/array-collections/dimexpr-match.hfa
r92355883 r2a301ff 145 145 #define EXPAND_AND_QUOTE(str) QUOTE(str) 146 146 #define TRY_COMPAT_E EXPAND_AND_QUOTE(TRY_COMPAT(__L__,__R__)) 147 148 // Temporary: CFA is classic by default149 #if defined CFA_IS_PREVIEW && defined CFA_IS_CLASSIC150 #error Must not define both CFA_IS_CLASSIC, CFA_IS_PREVIEW151 #endif152 #if ! defined CFA_IS_PREVIEW && ! defined CFA_IS_CLASSIC153 #define CFA_IS_CLASSIC154 #endif155 147 156 148 #if ! defined __cforall -
tests/collections/atomic_mpsc.cfa
r92355883 r2a301ff 1 1 #include <fstream.hfa> 2 #include <co ntainers/lockfree.hfa>2 #include <collections/lockfree.hfa> 3 3 #include <thread.hfa> 4 4 -
tests/collections/string-api-coverage.cfa
r92355883 r2a301ff 1 #include <co ntainers/string.hfa>1 #include <collections/string.hfa> 2 2 #include <string_sharectx.hfa> 3 3 -
tests/collections/string-overwrite.cfa
r92355883 r2a301ff 1 #include <co ntainers/string.hfa>1 #include <collections/string.hfa> 2 2 #include <string_sharectx.hfa> 3 3 -
tests/collections/vector-demo.cfa
r92355883 r2a301ff 1 #include <co ntainers/vector2.hfa>1 #include <collections/vector2.hfa> 2 2 3 3 void raiiTests() { -
tests/concurrency/actors/inherit.cfa
r92355883 r2a301ff 13 13 struct D_msg { int a; inline message; }; 14 14 void ?{}( D_msg & this ) { set_allocation( this, Delete ); } 15 void ^?{}( D_msg & this) { mutex(sout) sout | 'A'; }15 void ^?{}( D_msg & ) { mutex(sout) sout | 'A'; } 16 16 17 17 struct D_msg2 { inline D_msg; }; -
tests/concurrency/channels/daisy_chain.cfa
r92355883 r2a301ff 19 19 void main(Task & this) { 20 20 size_t runs = 0; 21 int token = 0; 21 22 try{ 22 23 for ( ;; ) { 23 remove( *chain );24 insert( *chain, 0 );24 token << *chain; 25 *chain << token; 25 26 runs++; 26 27 } … … 59 60 Channel chainChan{ 1 }; 60 61 61 insert( chainChan, 0);62 chainChan << ((int)0); 62 63 63 64 chain = &chainChan; -
tests/concurrency/unified_locking/thread_test.cfa
r92355883 r2a301ff 3 3 #include <stdlib.hfa> 4 4 #include <thread.hfa> 5 #include <co ntainers/array.hfa>5 #include <collections/array.hfa> 6 6 7 7 static unsigned int taskCount = 4; -
tests/concurrency/waituntil/all_types.cfa
r92355883 r2a301ff 96 96 Churner c; 97 97 for( long long int j = 0; j < numtimes; j++ ) { 98 when( j % 2 == 0 ) waituntil( j >> A) { total += j; }98 when( j % 2 == 0 ) waituntil( A << j ) { total += j; } 99 99 or when( j % 4 < 2 ) waituntil( B ) { produce_b_val( total ); } 100 and when( j % 8 < 4 ) waituntil( j >> C) { total += j; }100 and when( j % 8 < 4 ) waituntil( C << j ) { total += j; } 101 101 and waituntil( timeout( 1`ns ) ) {} 102 102 if ( j == numtimes / 2 ) -
tests/concurrency/waituntil/channel_close.cfa
r92355883 r2a301ff 13 13 try { 14 14 for( long long int i = 0;;i++ ) { 15 waituntil( (i >> A)) { inserts++; }16 and waituntil( (i >> B)) { inserts++; }15 waituntil( A << i ) { inserts++; } 16 and waituntil( B << i ) { inserts++; } 17 17 } 18 18 } catch ( channel_closed * e ) {} … … 31 31 } 32 32 waituntil( (in << A) ) { assert( A_removes == in ); A_removes++; removes++; } 33 or waituntil( (in 2 << B) ) { assert( B_removes == in2); B_removes++; removes++; }33 or waituntil( (in << B) ) { assert( B_removes == in ); B_removes++; removes++; } 34 34 } 35 35 } catchResume ( channel_closed * e ) {} // continue to remove until would block … … 74 74 ^B{}; 75 75 76 useAnd = true; 77 76 78 inserts = 0; 77 79 removes = 0; -
tests/concurrency/waituntil/channel_zero_size.cfa
r92355883 r2a301ff 37 37 for( long long int j = 0; j < numtimes; j++ ) { 38 38 // printf("loop\n"); 39 waituntil( j >> A) { total += j; }40 or waituntil( j >> B) { total += j; }41 or waituntil( j >> C) { total += j; }39 waituntil( A << j ) { total += j; } 40 or waituntil( B << j ) { total += j; } 41 or waituntil( C << j ) { total += j; } 42 42 } 43 43 printf("sending sentinels\n"); -
tests/concurrency/waituntil/channels.cfa
r92355883 r2a301ff 69 69 Churner c; 70 70 for( long long int j = 0; j < numtimes; j++ ) { 71 when( j % 2 == 0 ) waituntil( j >> A) { total += j; }72 or when( j % 4 < 2 ) waituntil( j >> B) { total += j; }73 and when( j % 8 < 4 ) waituntil( j >> C) { total += j; }71 when( j % 2 == 0 ) waituntil( A << j ) { total += j; } 72 or when( j % 4 < 2 ) waituntil( B << j ) { total += j; } 73 and when( j % 8 < 4 ) waituntil( C << j ) { total += j; } 74 74 } 75 75 done = true; -
tests/concurrency/waituntil/one_chan.cfa
r92355883 r2a301ff 31 31 Server1 s[numServers]; 32 32 for( long long int j = 0; j < numtimes; j++ ) { 33 waituntil( j >> C) { total += j; }33 waituntil( C << j ) { total += j; } 34 34 } 35 35 printf("waiting for empty channels\n"); -
tests/concurrency/waituntil/timeout.cfa
r92355883 r2a301ff 15 15 16 16 assert( count == 1000 ); 17 sleep( 1`ms ); 17 18 printf("done\n"); 18 19 } -
tests/designations.cfa
r92355883 r2a301ff 10 10 // Created On : Thu Jun 29 15:26:36 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Mar 28 22:41:55 2022 13 // Update Count : 15 14 // 12 // Last Modified On : Thu Jun 29 11:31:21 2023 13 // Update Count : 28 14 // 15 16 #include <fstream.hfa> 15 17 16 18 // Note: this test case has been crafted so that it compiles with both cfa and with gcc without any modifications. … … 21 23 #define AT @ 22 24 #else 23 int printf( const char *, ...);24 25 #define _ = 25 26 #define AT … … 28 29 const int indentAmt = 2; 29 30 void indent( int level ) { 30 for ( int i = 0; i < level; ++i ) { 31 printf( " " ); 32 } 31 sout | wd( level, "" ) | nonl; 33 32 } 34 33 … … 40 39 void printA( struct A a, int level ) { 41 40 indent( level ); 42 printf( "(A){ %d %d %p }\n", a.x, a.y, a.ptr );41 sout | "(A){ " | a.x | a.y | a.ptr | " }"; 43 42 } 44 43 … … 49 48 void printB( struct B b, int level ) { 50 49 indent( level ); 51 printf( "(B){\n" );50 sout | "(B){"; 52 51 printA( b.a0, level+indentAmt ); 53 52 printA( b.a1, level+indentAmt ); 54 53 indent( level ); 55 printf( "}\n" );54 sout | "}"; 56 55 } 57 56 … … 63 62 void printC( struct C c, int level ) { 64 63 indent( level ); 65 printf( "(C){\n" );64 sout | "(C){"; 66 65 indent( level+indentAmt ); 67 printf( "(int[]{ %d %d %d }\n", c.arr[0], c.arr[1], c.arr[2]);66 sout | "(int[]{ " | c.arr[0] | c.arr[1] | c.arr[2] | " }"; 68 67 printB( c.b, level+indentAmt ); 69 68 indent( level ); 70 printf( "}\n" );69 sout | "}"; 71 70 } 72 71 … … 79 78 void printD( struct D d, int level ) { 80 79 indent( level); 81 printf( "(D ){ %d }\n", d.x );80 sout | "(D){ " | d.x | "}"; 82 81 } 83 82 … … 92 91 93 92 struct Fred { 94 double i[3];95 int j;96 struct Mary {97 struct Jane {98 double j;99 } j;100 double i;101 } m;93 double i[3]; 94 int j; 95 struct Mary { 96 struct Jane { 97 double j; 98 } j; 99 double i; 100 } m; 102 101 }; 103 102 struct Fred s1 AT= { .m.j _ 3 }; … … 129 128 #endif 130 129 131 printf( "=====A=====\n" );130 sout | "=====A====="; 132 131 printA( y0, 0 ); 133 132 printA( y1, 0 ); 134 133 printA( y2, 0 ); 135 printf( "=====A=====\n\n" );134 sout | "=====A=====" | nl | nl; 136 135 137 136 // initialize only first element (z0.a.x), leaving everything else default-initialized (zero), no nested curly-braces … … 172 171 }; 173 172 174 printf( "=====B=====\n" );173 sout | "=====B====="; 175 174 printB( z0, 0 ); 176 175 printB( z1, 0 ); … … 179 178 printB( z5, 0 ); 180 179 printB( z6, 0 ); 181 printf( "=====B=====\n\n" );180 sout | "=====B=====" | nl | nl; 182 181 183 182 // TODO: what about extra things in a nested init? are empty structs skipped?? … … 190 189 }; 191 190 192 printf( "=====C=====\n" );191 sout | "=====C====="; 193 192 printC( c1, 0 ); 194 printf( "=====C=====\n\n" );193 sout | "=====C=====" | nl | nl; 195 194 196 195 #if ERROR … … 246 245 }; 247 246 248 printf( "=====E=====\n" );247 sout | "=====E====="; 249 248 printA( e0.a, 0 ); 250 249 printA( e1.a, 0 ); 251 250 printA( e2.a, 0 ); 252 251 printB( e3.b, 0 ); 253 printf( "=====E=====\n\n" );252 sout | "=====E=====" | nl | nl; 254 253 255 254 // special case of initialization: char[] can be initialized with a string literal -
tests/exceptions/.expect/polymorphic.txt
r92355883 r2a301ff 4 4 5 5 -7 6 0 7 1 6 false 7 true -
tests/exceptions/cancel/coroutine.cfa
r92355883 r2a301ff 1 1 // Try cancelling a coroutine. 2 2 3 #include <fstream.hfa> 3 4 #include <coroutine.hfa> 4 5 … … 13 14 14 15 void main(WillCancel & wc) { 15 printf("1");16 sout | '1'; 16 17 cancel_stack((internal_error){&internal_vt}); 17 printf("!");18 sout | '!'; 18 19 } 19 20 20 21 int main(int argc, char * argv[]) { 22 sout | nlOff; 21 23 WillCancel cancel; 22 24 try { 23 printf("0");25 sout | '0'; 24 26 resume(cancel); 25 printf("4");27 sout | '4'; 26 28 } catchResume (CoroutineCancelled(WillCancel) * error) { 27 printf("2");29 sout | '2'; 28 30 if ((virtual internal_error *)error->the_exception) { 29 printf("3");31 sout | '3'; 30 32 } 31 33 } 32 printf("5\n");34 sout | '5' | nl; 33 35 } -
tests/exceptions/cancel/thread.cfa
r92355883 r2a301ff 1 1 // Try cancelling a thread. 2 2 3 #include <fstream.hfa> 3 4 #include <thread.hfa> 4 5 … … 13 14 14 15 void main(WillCancel &) { 15 printf("1");16 sout | '1'; 16 17 cancel_stack((internal_error){&internal_vt}); 17 printf("!");18 sout | '!'; 18 19 } 19 20 20 21 void explicit() { 21 22 try { 22 printf("0");23 sout | '0'; 23 24 WillCancel cancel; 24 printf("1");25 sout | '1'; 25 26 join(cancel); 26 printf("4");27 sout | '4'; 27 28 } catchResume (ThreadCancelled(WillCancel) * error) { 28 printf("2");29 sout | '2'; 29 30 if ((virtual internal_error *)error->the_exception) { 30 printf("3");31 sout | '3'; 31 32 } 32 33 } 33 printf("5\n");34 sout | '5' | nl; 34 35 } 35 36 … … 37 38 try { 38 39 { 39 printf("0");40 sout | '0'; 40 41 WillCancel cancel; 41 printf("1");42 sout | '1'; 42 43 } 43 printf("4");44 sout | '4'; 44 45 } catchResume (ThreadCancelled(WillCancel) * error) { 45 printf("2");46 sout | '2'; 46 47 if ((virtual internal_error *)error->the_exception) { 47 printf("3");48 sout | '3'; 48 49 } 49 50 } 50 printf("5\n");51 sout | '5' | nl; 51 52 } 52 53 53 54 int main(int argc, char * argv[]) { 55 sout | nlOff; 54 56 explicit(); 55 57 implicit(); -
tests/exceptions/conditional.cfa
r92355883 r2a301ff 3 3 // I may fold this back into terminate.cfa and resume.cfa once setting 4 4 // up the non-trivial exception is reasonable to do. 5 6 #include <fstream.hfa> 5 7 6 8 exception num_error { … … 11 13 12 14 void caught_num_error(int expect, num_error * actual) { 13 printf("Caught num_error: expected=%d actual=%d.\n", expect, actual->num);15 sout | "Caught num_error: expected=" | expect | "actual=" | actual->num | '.'; 14 16 } 15 17 -
tests/exceptions/data-except.cfa
r92355883 r2a301ff 1 1 // Test exceptions that add data but no functionality. 2 3 #include <fstream.hfa> 2 4 3 5 exception paired { … … 18 20 throw except; 19 21 } catch (paired * exc) { 20 printf("%s(%d, %d)\n", virtual_msg(exc), exc->first, exc->second);22 sout | virtual_msg(exc) | '(' | exc->first | ", " | exc->second | ')'; 21 23 ++exc->first; 22 24 } 23 25 24 printf("%s(%d, %d)\n", virtual_msg(&except), except.first, except.second);26 sout | virtual_msg(&except) | '(' | except.first | ", " | except.second | ')'; 25 27 26 28 try { 27 29 throwResume except; 28 30 } catchResume (paired * exc) { 29 printf("%s(%d, %d)\n", virtual_msg(exc), exc->first, exc->second);31 sout | virtual_msg(exc) | '(' | exc->first | ", " | exc->second | ')'; 30 32 ++exc->first; 31 33 } 32 34 33 printf("%s(%d, %d)\n", virtual_msg(&except), except.first, except.second);35 sout | virtual_msg(&except) | '(' | except.first | ", " | except.second | ')'; 34 36 } -
tests/exceptions/defaults.cfa
r92355883 r2a301ff 1 1 // Tests for providing new default operations. 2 2 3 #include <fstream.hfa> 3 4 #include <string.h> 4 5 … … 35 36 throwResume (log_message){&log_vt, "Should be printed.\n"}; 36 37 } catchResume (log_message * this) { 37 printf("%s", this->virtual_table->msg(this));38 sout | this->virtual_table->msg(this) | nonl; 38 39 } 39 40 // But we don't have to: … … 44 45 exception jump {}; 45 46 void defaultTerminationHandler(jump &) { 46 printf("jump default handler.\n");47 sout | "jump default handler."; 47 48 } 48 49 … … 53 54 throw (jump){&jump_vt}; 54 55 } catch (jump * this) { 55 printf("jump catch handler.\n");56 sout | "jump catch handler."; 56 57 } 57 58 throw (jump){&jump_vt}; … … 75 76 throw (first){&first_vt}; 76 77 } catch (unhandled_exception * t) { 77 printf("Catch unhandled_exception.\n");78 sout | "Catch unhandled_exception."; 78 79 } 79 80 } … … 84 85 void cross_test(void) { 85 86 void defaultTerminationHandler(first &) { 86 printf("cross terminate default\n");87 sout | "cross terminate default"; 87 88 throw (second){&second_vt}; 88 89 } 89 90 void defaultResumptionHandler(first &) { 90 printf("cross resume default\n");91 sout | "cross resume default"; 91 92 throwResume (second){&second_vt}; 92 93 } 93 94 try { 94 printf("cross terminate throw\n");95 sout | "cross terminate throw"; 95 96 throw (first){&first_vt}; 96 97 } catch (second *) { 97 printf("cross terminate catch\n");98 sout | "cross terminate catch"; 98 99 } 99 100 try { 100 printf("cross resume throw\n");101 sout | "cross resume throw"; 101 102 throwResume (first){&first_vt}; 102 103 } catchResume (second *) { 103 printf("cross resume catch\n");104 sout | "cross resume catch"; 104 105 } 105 106 } -
tests/exceptions/except-io.hfa
r92355883 r2a301ff 2 2 3 3 // Echo when a destructor is run and an area/block is left. 4 5 #include <fstream.hfa> 6 4 7 struct loud_exit { 5 8 const char * area; … … 11 14 12 15 inline void ^?{}(loud_exit & this) { 13 printf("Exiting: %s\n", this.area);16 sout | "Exiting: " | this.area; 14 17 } 15 18 … … 20 23 inline void ?{}(loud_region & this, const char * region) { 21 24 this.region = region; 22 printf("Entering: %s\n", region);25 sout | "Entering: " | region; 23 26 } 24 27 25 28 inline void ^?{}(loud_region & this) { 26 printf("Exiting: %s\n", this.region);29 sout | "Exiting: " | this.region; 27 30 } -
tests/exceptions/finally.cfa
r92355883 r2a301ff 1 1 // Finally Clause Tests 2 2 3 #include <fstream.hfa> 3 4 #include "except-io.hfa" 4 5 … … 12 13 try { 13 14 try { 14 printf("termination throw\n");15 sout | "termination throw"; 15 16 throw exc; 16 17 } finally { 17 18 loud_exit a = "termination inner finally"; 18 printf("finally during unwind\n");19 sout | "finally during unwind"; 19 20 } 20 21 } catch (myth * error) { 21 printf("termination catch\n");22 sout | "termination catch"; 22 23 } finally { 23 24 loud_exit a = "termination outer finally"; 24 printf("finally after catch\n");25 sout | "finally after catch"; 25 26 } 26 printf("\n");27 sout | nl; 27 28 28 29 try { 29 30 try { 30 printf("resumption throw\n");31 sout | "resumption throw"; 31 32 throwResume exc; 32 33 } finally { 33 34 loud_exit a = "resumption inner finally"; 34 printf("finally after resume\n");35 sout | "finally after resume"; 35 36 } 36 37 } catchResume (myth * error) { 37 printf("resumption catch\n");38 sout | "resumption catch"; 38 39 } finally { 39 40 loud_exit a = "resumption outer finally"; 40 printf("finally after catch\n");41 sout | "finally after catch"; 41 42 } 42 printf("\n");43 sout | ""; 43 44 44 45 try { 45 printf("walking out of try\n");46 sout | "walking out of try"; 46 47 } finally { 47 48 loud_exit a = "walking finally"; 48 printf("walking through finally\n");49 sout | "walking through finally"; 49 50 } 50 printf("\n");51 sout | ""; 51 52 52 53 try { 53 printf("jumping out of try\n");54 sout | "jumping out of try"; 54 55 goto endoffunction; 55 56 } finally { 56 57 loud_exit a = "jumping finally"; 57 printf("jumping through finally\n");58 sout | "jumping through finally"; 58 59 } 59 60 endoffunction: -
tests/exceptions/interact.cfa
r92355883 r2a301ff 1 1 // Testing Interactions Between Termination and Resumption 2 2 3 #include <fstream.hfa> 3 4 #include "except-io.hfa" 4 5 … … 14 15 throwResume (star){&star_vt}; 15 16 } catch (star *) { 16 printf("caught as termination\n");17 sout | "caught as termination"; 17 18 } 18 19 // Variant of the above to check timing. … … 21 22 throwResume (star){&star_vt}; 22 23 } catch (star *) { 23 printf("caught as termination\n");24 sout | "caught as termination"; 24 25 } catchResume (star *) { 25 printf("intermediate rethrow\n");26 sout | "intermediate rethrow"; 26 27 throwResume; 27 28 } 28 printf("\n");29 sout | nl; 29 30 30 31 // Resume does not catch terminate. … … 33 34 throw (star){&star_vt}; 34 35 } catchResume (star *) { 35 printf("resume catch on terminate\n");36 sout | "resume catch on terminate"; 36 37 } 37 38 } catchResume (star *) { 38 printf("resume catch on terminate\n");39 sout | "resume catch on terminate"; 39 40 } catch (star *) { 40 printf("terminate catch on terminate\n");41 sout | "terminate catch on terminate"; 41 42 } 42 printf("\n");43 sout | nl; 43 44 44 45 // Terminate does not catch resume. … … 47 48 throwResume (star){&star_vt}; 48 49 } catch (star *) { 49 printf("terminate catch on resume\n");50 sout | "terminate catch on resume"; 50 51 } 51 52 } catch (star *) { 52 printf("terminate catch on resume\n");53 sout | "terminate catch on resume"; 53 54 } catchResume (star *) { 54 printf("resume catch on resume\n");55 sout | "resume catch on resume"; 55 56 } 56 printf("\n");57 sout | nl; 57 58 58 59 // Resume a termination exception. … … 62 63 throw (star){&star_vt}; 63 64 } catchResume (star *) { 64 printf("inner resume catch (error)\n");65 sout | "inner resume catch (error)"; 65 66 } 66 67 } catch (star * error) { 67 printf("termination catch, will resume\n");68 sout | "termination catch, will resume"; 68 69 throwResume *error; 69 70 } 70 71 } catchResume (star *) { 71 printf("outer resume catch\n");72 sout | "outer resume catch"; 72 73 } 73 printf("\n");74 sout | nl; 74 75 75 76 // Terminate a resumption exception. … … 79 80 throwResume (star){&star_vt}; 80 81 } catch (star *) { 81 printf("inner termination catch\n");82 sout | "inner termination catch"; 82 83 } 83 84 } catchResume (star * error) { 84 printf("resumption catch, will terminate\n");85 sout | "resumption catch, will terminate"; 85 86 throw *error; 86 87 } 87 88 } catch (star *) { 88 printf("outer terminate catch (error)\n");89 sout | "outer terminate catch (error)"; 89 90 } 90 printf("\n");91 sout | nl; 91 92 92 93 // Unwinding a resumption catch does not break the system. … … 95 96 try { 96 97 try { 97 printf("throwing resume moon\n");98 sout | "throwing resume moon"; 98 99 throwResume (moon){&moon_vt}; 99 100 } catch (star *) { 100 printf("termination catch\n");101 sout | "termination catch"; 101 102 } 102 printf("throwing resume star\n");103 sout | "throwing resume star"; 103 104 throwResume (star){&star_vt}; 104 105 } catchResume (star *) { 105 printf("resumption star catch\n");106 sout | "resumption star catch"; 106 107 } 107 108 } catchResume (moon *) { 108 printf("resumption moon catch, will terminate\n");109 sout | "resumption moon catch, will terminate"; 109 110 throw (star){&star_vt}; 110 111 } 111 112 } catchResume (star *) { 112 printf("outermost catch (error)\n");113 sout | "outermost catch (error)"; 113 114 } 114 115 } -
tests/exceptions/polymorphic.cfa
r92355883 r2a301ff 1 1 // Testing polymophic exception types. 2 3 #include <fstream.hfa> 2 4 3 5 forall(T &) exception proxy {}; … … 13 15 throw an_int; 14 16 } catch (proxy(int) *) { 15 printf("terminate catch\n");17 sout | "terminate catch"; 16 18 } 17 19 … … 19 21 throwResume a_char; 20 22 } catchResume (proxy(char) *) { 21 printf("resume catch\n");23 sout | "resume catch"; 22 24 } 23 25 … … 25 27 throw a_char; 26 28 } catch (proxy(int) *) { 27 printf("caught proxy(int)\n");29 sout | "caught proxy(int)"; 28 30 } catch (proxy(char) *) { 29 printf("caught proxy(char)\n");31 sout | "caught proxy(char)"; 30 32 } 31 33 } … … 44 46 throw except; 45 47 } catch (cell(int) * error) { 46 printf("%d\n", error->data);48 sout | error->data; 47 49 } 48 50 … … 50 52 cell(bool) ball = {&bool_cell, false}; 51 53 throwResume ball; 52 printf("%i\n", ball.data);54 sout | ball.data; 53 55 } catchResume (cell(bool) * error) { 54 printf("%i\n", error->data);56 sout | error->data; 55 57 error->data = true; 56 58 } … … 59 61 int main(int argc, char * argv[]) { 60 62 proxy_test(); 61 printf("\n");63 sout | nl; 62 64 cell_test(); 63 65 } -
tests/exceptions/resume.cfa
r92355883 r2a301ff 1 1 // Resumption Exception Tests 2 2 3 #include <fstream.hfa> 3 4 #include "except-io.hfa" 4 5 … … 21 22 try { 22 23 loud_exit a = "simple try clause"; 23 printf("simple throw\n");24 sout | "simple throw"; 24 25 throwResume a_zen; 25 printf("end of try clause\n");26 sout | "end of try clause"; 26 27 } catchResume (zen * error) { 27 28 loud_exit a = "simple catch clause"; 28 printf("simple catch\n");29 sout | "simple catch"; 29 30 } 30 printf("\n");31 sout | nl; 31 32 32 33 // Throw catch-all test. … … 34 35 throwResume a_zen; 35 36 } catchResume (exception_t * error) { 36 printf("catch-all\n");37 sout | "catch-all"; 37 38 } 38 printf("\n");39 sout | nl; 39 40 40 41 // Don't catch if handler does not match exception. … … 43 44 throwResume a_yin; 44 45 } catchResume (zen *) { 45 printf("caught yin as zen\n");46 sout | "caught yin as zen"; 46 47 } 47 48 } catchResume (yang *) { 48 printf("caught yin as yang\n");49 sout | "caught yin as yang"; 49 50 } catchResume (yin *) { 50 printf("caught yin as yin\n");51 sout | "caught yin as yin"; 51 52 } 52 printf("\n");53 sout | nl; 53 54 54 55 // Test rethrowing an exception. … … 56 57 try { 57 58 loud_exit a = "rethrow inner try"; 58 printf("rethrow inner try\n");59 sout | "rethrow inner try"; 59 60 throwResume a_zen; 60 61 } catchResume (zen *) { 61 62 loud_exit a = "rethrowing catch clause"; 62 printf("caught throw, will rethrow\n");63 sout | "caught throw, will rethrow"; 63 64 throwResume; 64 65 } 65 66 } catchResume (zen *) { 66 67 loud_exit a = "rethrow catch clause"; 67 printf("caught rethrow\n");68 sout | "caught rethrow"; 68 69 } 69 printf("\n");70 sout | nl; 70 71 71 72 // Throw a different exception in a catch. … … 74 75 throwResume a_yin; 75 76 } catchResume (yin *) { 76 printf("caught yin, will throw yang\n");77 sout | "caught yin, will throw yang"; 77 78 throwResume a_yang; 78 79 } catchResume (yang *) { 79 printf("caught exception from same try\n");80 sout | "caught exception from same try"; 80 81 } 81 82 } catchResume (yang *) { 82 printf("caught yang\n");83 sout | "caught yang"; 83 84 } 84 printf("\n");85 sout | nl; 85 86 86 87 // Another throw in the catch does not interfere. 87 88 try { 88 89 try { 89 printf("throwing first exception\n");90 sout | "throwing first exception"; 90 91 throwResume a_yin; 91 92 } catchResume (yin *) { 92 printf("caught first exception\n");93 sout | "caught first exception"; 93 94 try { 94 printf("throwing second exception\n");95 sout | "throwing second exception"; 95 96 throwResume a_yang; 96 97 } catchResume (yang *) { 97 printf("caught second exception\n");98 sout | "caught second exception"; 98 99 } 99 100 throwResume; 100 101 } 101 102 } catchResume (yin *) { 102 printf("recaught first exception\n");103 sout | "recaught first exception"; 103 104 } catchResume (yang *) { 104 printf("caught second exception (bad location)\n");105 sout | "caught second exception (bad location)"; 105 106 } 106 printf("\n");107 sout | nl; 107 108 108 109 // Check successive operations. … … 112 113 throwResume a_zen; 113 114 } catchResume (zen *) { 114 printf("inner catch\n");115 sout | "inner catch"; 115 116 } 116 117 throwResume a_zen; 117 118 } catchResume (zen *) { 118 printf("outer catch\n");119 sout | "outer catch"; 119 120 } 120 printf("\n");121 sout | nl; 121 122 122 123 in_void(); … … 128 129 try { 129 130 try { 130 printf("throw\n");131 sout | "throw"; 131 132 throwResume a_zen; 132 133 } catchResume (zen *) { 133 printf("rethrow\n");134 sout | "rethrow"; 134 135 throwResume; 135 136 } 136 137 } catchResume (zen *) { 137 printf("handle\n");138 sout | "handle"; 138 139 } 139 140 } -
tests/exceptions/terminate.cfa
r92355883 r2a301ff 1 1 // Termination Exception Tests 2 2 3 #include <fstream.hfa> 3 4 #include "except-io.hfa" 4 5 … … 21 22 try { 22 23 loud_exit a = "simple try clause"; 23 printf("simple throw\n");24 sout | "simple throw"; 24 25 throw a_zen; 25 printf("end of try clause\n");26 sout | "end of try clause"; 26 27 } catch (zen * error) { 27 28 loud_exit a = "simple catch clause"; 28 printf("simple catch\n");29 sout | "simple catch"; 29 30 } 30 printf("\n");31 sout | nl; 31 32 32 33 // Throw catch-all test. … … 34 35 throw a_zen; 35 36 } catch (exception_t * error) { 36 printf("catch-all\n");37 sout | "catch-all"; 37 38 } 38 printf("\n");39 sout | nl; 39 40 40 41 // Don't catch if handler does not match exception. … … 43 44 throw a_yin; 44 45 } catch (zen *) { 45 printf("caught yin as zen\n");46 sout | "caught yin as zen"; 46 47 } 47 48 } catch (yang *) { 48 printf("caught yin as yang\n");49 sout | "caught yin as yang"; 49 50 } catch (yin *) { 50 printf("caught yin as yin\n");51 sout | "caught yin as yin"; 51 52 } 52 printf("\n");53 sout | nl; 53 54 54 55 // Test rethrowing an exception. … … 56 57 try { 57 58 loud_exit a = "rethrow inner try"; 58 printf("rethrow inner try\n");59 sout | "rethrow inner try"; 59 60 throw a_zen; 60 61 } catch (zen *) { 61 62 loud_exit a = "rethrowing catch clause"; 62 printf("caught throw, will rethrow\n");63 sout | "caught throw, will rethrow"; 63 64 throw; 64 65 } 65 66 } catch (zen *) { 66 67 loud_exit a = "rethrow catch clause"; 67 printf("caught rethrow\n");68 sout | "caught rethrow"; 68 69 } 69 printf("\n");70 sout | nl; 70 71 71 72 // Throw a different exception in a catch. … … 74 75 throw a_yin; 75 76 } catch (yin *) { 76 printf("caught yin, will throw yang\n");77 sout | "caught yin, will throw yang"; 77 78 throw a_yang; 78 79 } catch (yang *) { 79 printf("caught exception from same try\n");80 sout | "caught exception from same try"; 80 81 } 81 82 } catch (yang *) { 82 printf("caught yang\n");83 sout | "caught yang"; 83 84 } 84 printf("\n");85 sout | nl; 85 86 86 87 // Another throw in the catch does not interfere. 87 88 try { 88 89 try { 89 printf("throwing first exception\n");90 sout | "throwing first exception"; 90 91 throw a_yin; 91 92 } catch (yin *) { 92 printf("caught first exception\n");93 sout | "caught first exception"; 93 94 try { 94 printf("throwing second exception\n");95 sout | "throwing second exception"; 95 96 throw a_yang; 96 97 } catch (yang *) { 97 printf("caught second exception\n");98 sout | "caught second exception"; 98 99 } 99 100 throw; 100 101 } 101 102 } catch (yin *) { 102 printf("recaught first exception\n");103 sout | "recaught first exception"; 103 104 } catch (yang *) { 104 printf("caught second exception (bad location)\n");105 sout | "caught second exception (bad location)"; 105 106 } 106 printf("\n");107 sout | nl; 107 108 108 109 // Check successive operations. … … 112 113 throw a_zen; 113 114 } catch (zen *) { 114 printf("inner catch\n");115 sout | "inner catch"; 115 116 } 116 117 throw a_zen; 117 118 } catch (zen *) { 118 printf("outer catch\n");119 sout | "outer catch"; 119 120 } 120 printf("\n");121 sout | nl; 121 122 122 123 in_void(); … … 128 129 try { 129 130 try { 130 printf("throw\n");131 sout | "throw"; 131 132 throw a_zen; 132 133 } catch (zen *) { 133 printf("rethrow\n");134 sout | "rethrow"; 134 135 throw; 135 136 } 136 137 } catch (zen *) { 137 printf("handle\n");138 sout | "handle"; 138 139 } 139 140 } -
tests/exceptions/trash.cfa
r92355883 r2a301ff 1 1 // Make sure throw-catch during unwind does not trash internal data. 2 3 #include <fstream.hfa> 2 4 3 5 exception yin {}; … … 15 17 throw (yang){&yang_vt}; 16 18 } catch (yin *) { 17 printf("inner yin\n");19 sout | "inner yin"; 18 20 } catch (yang *) { 19 printf("inner yang\n");21 sout | "inner yang"; 20 22 } 21 23 } 22 24 } catch (yin *) { 23 printf("outer yin\n");25 sout | "outer yin"; 24 26 } catch (yang *) { 25 printf("outer yang\n");27 sout | "outer yang"; 26 28 } 27 29 } -
tests/exceptions/virtual-cast.cfa
r92355883 r2a301ff 9 9 */ 10 10 11 #include <fstream.hfa> 11 12 #include <stdlib.hfa> 12 13 #include <assert.h> 13 14 15 14 16 15 // Hand defined alpha virtual type: … … 106 105 free(tri); 107 106 free(top); 108 printf( "done\n" );// non-empty .expect file107 sout | "done"; // non-empty .expect file 109 108 } -
tests/exceptions/virtual-poly.cfa
r92355883 r2a301ff 6 6 */ 7 7 8 #include <fstream.hfa> 8 9 #include <assert.h> 9 10 … … 105 106 mono_poly_test(); 106 107 poly_poly_test(); 107 printf( "done\n" );108 sout | "done"; 108 109 } -
tests/include/vector-collections.cfa
r92355883 r2a301ff 1 1 #include <vector.hfa> 2 #include <bits/co ntainers.hfa>2 #include <bits/collections.hfa> 3 3 4 4 int main() { -
tests/io/.expect/io.txt
r92355883 r2a301ff 61 61 1, 2, 3 4, 5, 6 62 62 63 check sep On/sepOff63 check sep/nosep 64 64 1 2 3 65 65 12 3 -
tests/io/.expect/manipulatorsOutput2.arm64.txt
r92355883 r2a301ff 4 4 0 033 033 033 033 5 5 0345 0177745 037777777745 01777777777777777777745 6 0 0x1b 0x1b 0x1b 0x1b6 0x0 0x1b 0x1b 0x1b 0x1b 7 7 0xe5 0xffe5 0xffffffe5 0xffffffffffffffe5 8 0x0p+0 .0x1.b8p+4 0x1.b8p+4 0x1.b8p+48 0x0p+0 0x1.b8p+4 0x1.b8p+4 0x1.b8p+4 9 9 -0x1.b8p+4 -0x1.b8p+4 -0x1.b8p+4 10 10 0.000000e+00 2.750000e+01 -2.750000e+01 -
tests/io/.expect/manipulatorsOutput2.x64.txt
r92355883 r2a301ff 4 4 0 033 033 033 033 5 5 0345 0177745 037777777745 01777777777777777777745 6 0 0x1b 0x1b 0x1b 0x1b6 0x0 0x1b 0x1b 0x1b 0x1b 7 7 0xe5 0xffe5 0xffffffe5 0xffffffffffffffe5 8 0x0p+0 .0x1.b8p+4 0x1.b8p+4 0xd.cp+18 0x0p+0 0x1.b8p+4 0x1.b8p+4 0xd.cp+1 9 9 -0x1.b8p+4 -0x1.b8p+4 -0xd.cp+1 10 10 0.000000e+00 2.750000e+01 -2.750000e+01 -
tests/io/.expect/manipulatorsOutput2.x86.txt
r92355883 r2a301ff 4 4 0 033 033 033 033 5 5 0345 0177745 037777777745 037777777745 6 0 0x1b 0x1b 0x1b 0x1b6 0x0 0x1b 0x1b 0x1b 0x1b 7 7 0xe5 0xffe5 0xffffffe5 0xffffffe5 8 0x0p+0 .0x1.b8p+4 0x1.b8p+4 0xd.cp+18 0x0p+0 0x1.b8p+4 0x1.b8p+4 0xd.cp+1 9 9 -0x1.b8p+4 -0x1.b8p+4 -0xd.cp+1 10 10 0.000000e+00 2.750000e+01 -2.750000e+01 -
tests/io/.expect/manipulatorsOutput3.arm64.txt
r92355883 r2a301ff 246 246 -1 0xffffffffffffffffffffffffffffffff 03777777777777777777777777777777777777777777 247 247 0b11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 248 +0 0 0248 +0 0x0 0 249 249 0b0 250 250 +1 0x1 01 -
tests/io/.expect/manipulatorsOutput3.x64.txt
r92355883 r2a301ff 246 246 -1 0xffffffffffffffffffffffffffffffff 03777777777777777777777777777777777777777777 247 247 0b11111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111111 248 +0 0 0248 +0 0x0 0 249 249 0b0 250 250 +1 0x1 01 -
tests/io/io.cfa
r92355883 r2a301ff 10 10 // Created On : Wed Mar 2 16:56:02 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Feb 21 10:56:33 202113 // Update Count : 12 112 // Last Modified On : Tue Aug 8 23:18:32 2023 13 // Update Count : 128 14 14 // 15 15 … … 104 104 in | f | d | ld; // floating point 105 105 in | fc | dc | ldc; // floating-point complex 106 in | s1 | wdi( size, s2 );// C string, length unchecked and checked106 in | wdi(size, s1) | wdi( size, s2 ); // C string, length unchecked and checked 107 107 sout | nl; 108 108 … … 122 122 sout | "toggle separator"; 123 123 sout | f | "" | d | "" | ld; // floating point without separator 124 sout | sep Disable | fc | dc | ldc;// complex without separator125 sout | fc | sep On | dc | ldc;// local separator add126 sout | sep Enable | fc | dc | ldc;// complex with separator127 sout | fc | sepOff| dc | ldc; // local separator removal128 sout | s1 | sepOff | s2;// local separator removal124 sout | sepOff | fc | dc | ldc; // complex without separator 125 sout | fc | sep | dc | ldc; // local separator add 126 sout | sepOn | fc | dc | ldc; // complex with separator 127 sout | fc | nosep | dc | ldc; // local separator removal 128 sout | s1 | nosep | s2; // local separator removal 129 129 sout | s1 | "" | s2; // local separator removal 130 130 sout | nl; 131 131 132 132 sout | "change separator"; 133 sout | "from \"" | sep | "\"" | nonl;133 sout | "from \"" | sepVal | "\"" | nonl; 134 134 sepSet( sout, ", $" ); // change separator, maximum of 15 characters 135 sout | " to \"" | sep | "\"";135 sout | " to \"" | sepVal | "\""; 136 136 sout | f | d | ld; 137 137 sout | fc | dc | ldc; … … 139 139 sout | t1 | t2; // print tuple 140 140 sout | nl; 141 sout | "from \"" | sep | "\" " | nonl;141 sout | "from \"" | sepVal | "\" " | nonl; 142 142 sepSet( sout, " " ); // restore separator 143 sout | "to \"" | sep | "\"";143 sout | "to \"" | sepVal | "\""; 144 144 sout | f | d | ld; 145 145 sout | fc | dc | ldc; … … 148 148 sout | nl; 149 149 150 sout | "check sep On/sepOff";151 sout | sep On | 1 | 2 | 3 | sepOn;// no separator at start/end of line152 sout | 1 | sepOff| 2 | 3; // locally turn off implicit separator153 sout | sep On | sepOn | 1 | 2 | 3 | sepOn | sepOff | sepOn| '\n' | nonl; // no separator at start/end of line154 sout | 1 | 2 | 3 | "\n\n" | sep On | nonl;// no separator at start of next line150 sout | "check sep/nosep"; 151 sout | sep | 1 | 2 | 3 | sep; // no separator at start/end of line 152 sout | 1 | nosep | 2 | 3; // locally turn off implicit separator 153 sout | sep | sep | 1 | 2 | 3 | sep | nosep | sep | '\n' | nonl; // no separator at start/end of line 154 sout | 1 | 2 | 3 | "\n\n" | sep | nonl; // no separator at start of next line 155 155 sout | 1 | 2 | 3; 156 156 sout | nl; 157 157 158 158 sout | "check enable/disable"; 159 sout | sep Disable | 1 | 2 | 3;// globally turn off implicit separation160 sout | 1 | sep On | 2 | 3;// locally turn on implicit separator161 sout | sep Enable | 1 | 2 | 3 | sepDisable;// globally turn on/off implicit separation162 sout | 1 | 2 | 3 | sep Enable;// globally turn on implicit separation163 sout | 1 | 2 | 3 | sep On | sepDisable;// ignore seperate at end of line164 sout | 1 | 2 | 3 | sep On | sepEnable;// separator at end of line159 sout | sepOff | 1 | 2 | 3; // globally turn off implicit separation 160 sout | 1 | sep | 2 | 3; // locally turn on implicit separator 161 sout | sepOn | 1 | 2 | 3 | sepOff; // globally turn on/off implicit separation 162 sout | 1 | 2 | 3 | sepOn; // globally turn on implicit separation 163 sout | 1 | 2 | 3 | sep | sepOff; // ignore seperate at end of line 164 sout | 1 | 2 | 3 | sep | sepOn; // separator at end of line 165 165 sout | 1 | 2 | 3; 166 166 sout | nl; … … 169 169 170 170 sepSetTuple( sout, " " ); // set tuple separator from ", " to " " 171 sout | t1 | t2 | " \"" | sep | "\"";171 sout | t1 | t2 | " \"" | sepVal | "\""; 172 172 sepSetTuple( sout, ", " ); // reset tuple separator to ", " 173 sout | t1 | t2 | " \"" | sep | "\"";173 sout | t1 | t2 | " \"" | sepVal | "\""; 174 174 sout | t1 | t2; // print tuple 175 175 sout | nl; … … 180 180 sepSetTuple( sout, " " ); 181 181 sout | t3; 182 sout | sep On | t3 | sepDisable | t3 | sepEnable| t3;182 sout | sep | t3 | sepOff | t3 | sepOn | t3; 183 183 sepSet( sout, "^" ); 184 184 sepSetTuple( sout, "-" ); -
tests/io/manipulatorsInput.cfa
r92355883 r2a301ff 7 7 // Created On : Sat Jun 8 17:58:54 2019 8 8 // Last Modified By : Peter A. Buhr 9 // Last Modified On : Sat Jun 17 07:56:02 202310 // Update Count : 489 // Last Modified On : Mon Aug 14 17:38:52 2023 10 // Update Count : 63 11 11 // 12 12 … … 19 19 const char sk[] = "abc"; 20 20 scanf( "abc " ); scanf( sk ); for ( 5 ) scanf( "%*c" ); printf( "1 %s\n", s ); 21 scanf( "%s", s ); printf( "2 %s\n", s );22 scanf( "%*s" ); printf( "3 %s\n", s );23 scanf( "%8s", s ); printf( "4 %s\n", s );24 scanf( "%*8s" ); printf( "5 %s\n", s );21 scanf( "%s", s ); printf( "2 %s\n", s ); 22 scanf( "%*s" ); printf( "3 %s\n", s ); 23 scanf( "%8s", s ); printf( "4 %s\n", s ); 24 scanf( "%*8s" ); printf( "5 %s\n", s ); 25 25 26 scanf( "%[abc]", s ); printf( "6 %s\n", s );27 scanf( "%[^abc]", s ); printf( "7 %s\n", s );28 scanf( "%*[abc]" ); printf( "8 %s\n", s );29 scanf( "%*[^abc]" ); printf( "9 %s\n", s );30 scanf( "%8[abc]", s ); printf( "10 %s\n", s );31 scanf( "%8[^abc]", s ); printf( "11 %s\n", s );32 scanf( "%*8[abc]" ); printf( "12 %s\n", s );33 scanf( "%*8[^abc]" ); printf( "13 %s\n", s );26 scanf( "%[abc]", s ); printf( "6 %s\n", s ); 27 scanf( "%[^abc]", s ); printf( "7 %s\n", s ); 28 scanf( "%*[abc]" ); printf( "8 %s\n", s ); 29 scanf( "%*[^abc]" ); printf( "9 %s\n", s ); 30 scanf( "%8[abc]", s ); printf( "10 %s\n", s ); 31 scanf( "%8[^abc]", s ); printf( "11 %s\n", s ); 32 scanf( "%*8[abc]" ); printf( "12 %s\n", s ); 33 scanf( "%*8[^abc]" ); printf( "13 %s\n", s ); 34 34 } 35 35 { 36 36 char s[] = "yyyyyyyyyyyyyyyyyyyy"; 37 37 char sk[] = "abc"; 38 sin /*| "abc "*/ | skip( sk ) | skip( 5 ); sout | "1" | s;39 sin | s;sout | "2" | s;40 sin | ignore( s ); sout | "3" | s;41 sin | wdi( 8, s );sout | "4" | s;42 sin | ignore( wdi( 8, s ) ); sout | "5" | s;38 sin /*| "abc "*/ | skip( sk ) | skip( 5 ); sout | "1" | s; 39 sin | wdi( sizeof(s), s ); sout | "2" | s; 40 sin | ignore( s ); sout | "3" | s; 41 sin | wdi( sizeof(s), 8, s ); sout | "4" | s; 42 sin | ignore( wdi( sizeof(s), 8, s ) ); sout | "5" | s; 43 43 44 sin | incl( "abc", s );sout | "6" | s;45 sin | excl( "abc", s );sout | "7" | s;46 sin | ignore( incl( "abc", s ) );sout | "8" | s;47 sin | ignore( excl( "abc", s ) );sout | "9" | s;48 sin | wdi( 8, incl( "abc", s ) );sout | "10" | s;49 sin | wdi( 8, excl( "abc", s ) );sout | "11" | s;50 sin | ignore( wdi( 8, incl( "abc", s ) ) );sout | "12" | s;51 sin | ignore( wdi( 8, excl( "abc", s ) ) );sout | "13" | s;44 sin | incl( "abc", wdi( sizeof(s), s ) ); sout | "6" | s; 45 sin | excl( "abc", wdi( sizeof(s), s ) ); sout | "7" | s; 46 sin | ignore( incl( "abc", wdi( sizeof(s), s ) ) ); sout | "8" | s; 47 sin | ignore( excl( "abc", wdi( sizeof(s), s ) ) ); sout | "9" | s; 48 sin | incl( "abc", wdi( sizeof(s), 8, s ) ); sout | "10" | s; 49 sin | excl( "abc", wdi( sizeof(s), 8, s ) ); sout | "11" | s; 50 sin | ignore( incl( "abc", wdi( sizeof(s), 8, s ) ) ); sout | "12" | s; 51 sin | ignore( excl( "abc", wdi( sizeof(s), 8, s ) ) ); sout | "13" | s; 52 52 } 53 53 { 54 54 char c; 55 sin | c; sout | c;56 sin | ignore( c ); sout | c;55 sin | c; sout | c; 56 sin | ignore( c ); sout | c; 57 57 58 58 signed char sc; 59 sin | sc; sout | sc;60 sin | wdi( 3, sc ); sout | sc;61 sin | ignore( sc ); sout | sc;62 sin | ignore( wdi( 3, sc ) ); sout | sc;59 sin | sc; sout | sc; 60 sin | wdi( 3, sc ); sout | sc; 61 sin | ignore( sc ); sout | sc; 62 sin | ignore( wdi( 3, sc ) ); sout | sc; 63 63 64 64 unsigned char usc; 65 sin | usc; sout | usc;66 sin | wdi( 3, usc ); sout | usc;67 sin | ignore( usc ); sout | usc;68 sin | ignore( wdi( 3, usc ) ); sout | usc;65 sin | usc; sout | usc; 66 sin | wdi( 3, usc ); sout | usc; 67 sin | ignore( usc ); sout | usc; 68 sin | ignore( wdi( 3, usc ) ); sout | usc; 69 69 70 70 signed short int ssi; 71 sin | ssi; sout | ssi;72 sin | wdi( 3, ssi ); sout | ssi;73 sin | ignore( ssi ); sout | ssi;74 sin | ignore( wdi( 3, ssi ) ); sout | ssi;71 sin | ssi; sout | ssi; 72 sin | wdi( 3, ssi ); sout | ssi; 73 sin | ignore( ssi ); sout | ssi; 74 sin | ignore( wdi( 3, ssi ) ); sout | ssi; 75 75 76 76 unsigned short int usi; 77 sin | usi; sout | usi;78 sin | wdi( 3, usi ); sout | usi;79 sin | ignore( usi ); sout | usi;80 sin | ignore( wdi( 3, usi ) ); sout | usi;77 sin | usi; sout | usi; 78 sin | wdi( 3, usi ); sout | usi; 79 sin | ignore( usi ); sout | usi; 80 sin | ignore( wdi( 3, usi ) ); sout | usi; 81 81 82 82 signed int si; 83 sin | si; sout | si;84 sin | wdi( 3, si ); sout | si;85 sin | ignore( si ); sout | si;86 sin | ignore( wdi( 3, si ) ); sout | si;83 sin | si; sout | si; 84 sin | wdi( 3, si ); sout | si; 85 sin | ignore( si ); sout | si; 86 sin | ignore( wdi( 3, si ) ); sout | si; 87 87 88 88 unsigned int ui; 89 sin | ui; sout | ui;90 sin | wdi( 3, ui ); sout | ui;91 sin | ignore( ui ); sout | ui;92 sin | ignore( wdi( 3, ui ) ); sout | ui;89 sin | ui; sout | ui; 90 sin | wdi( 3, ui ); sout | ui; 91 sin | ignore( ui ); sout | ui; 92 sin | ignore( wdi( 3, ui ) ); sout | ui; 93 93 94 94 signed long int sli; 95 sin | sli; sout | sli;96 sin | wdi( 3, sli ); sout | sli;97 sin | ignore( sli ); sout | sli;98 sin | ignore( wdi( 3, sli ) ); sout | sli;95 sin | sli; sout | sli; 96 sin | wdi( 3, sli ); sout | sli; 97 sin | ignore( sli ); sout | sli; 98 sin | ignore( wdi( 3, sli ) ); sout | sli; 99 99 100 100 unsigned long int uli; 101 sin | uli; sout | uli;102 sin | wdi( 3, uli ); sout | uli;103 sin | ignore( uli ); sout | uli;104 sin | ignore( wdi( 3, uli ) ); sout | uli;101 sin | uli; sout | uli; 102 sin | wdi( 3, uli ); sout | uli; 103 sin | ignore( uli ); sout | uli; 104 sin | ignore( wdi( 3, uli ) ); sout | uli; 105 105 106 106 signed long long int slli; 107 sin | slli; sout | slli;108 sin | wdi( 3, slli ); sout | slli;109 sin | ignore( slli ); sout | slli;110 sin | ignore( wdi( 3, slli ) ); sout | slli;107 sin | slli; sout | slli; 108 sin | wdi( 3, slli ); sout | slli; 109 sin | ignore( slli ); sout | slli; 110 sin | ignore( wdi( 3, slli ) ); sout | slli; 111 111 112 112 unsigned long long int ulli; 113 sin | ulli; sout | ulli;114 sin | wdi( 3, ulli ); sout | ulli;115 sin | ignore( ulli ); sout | ulli;116 sin | ignore( wdi( 3, ulli ) ); sout | ulli;113 sin | ulli; sout | ulli; 114 sin | wdi( 3, ulli ); sout | ulli; 115 sin | ignore( ulli ); sout | ulli; 116 sin | ignore( wdi( 3, ulli ) ); sout | ulli; 117 117 118 118 float f; 119 sin | f; sout | f;120 sin | wdi( 8, f ); sout | f;121 sin | ignore( f ); sout | f;122 sin | ignore( wdi( 8, f ) ); sout | f;119 sin | f; sout | f; 120 sin | wdi( 8, f ); sout | f; 121 sin | ignore( f ); sout | f; 122 sin | ignore( wdi( 8, f ) ); sout | f; 123 123 124 124 double d; 125 sin | d; sout | d;126 sin | wdi( 8, d ); sout | d;127 sin | ignore( d ); sout | d;128 sin | ignore( wdi( 8, d ) ); sout | d;125 sin | d; sout | d; 126 sin | wdi( 8, d ); sout | d; 127 sin | ignore( d ); sout | d; 128 sin | ignore( wdi( 8, d ) ); sout | d; 129 129 130 130 long double ld; 131 sin | ld; sout | ld;132 sin | wdi( 8, ld ); sout | ld;133 sin | ignore( ld ); sout | ld;134 sin | ignore( wdi( 8, ld ) ); sout | ld;131 sin | ld; sout | ld; 132 sin | wdi( 8, ld ); sout | ld; 133 sin | ignore( ld ); sout | ld; 134 sin | ignore( wdi( 8, ld ) ); sout | ld; 135 135 136 136 float _Complex fc; 137 sin | fc; sout | fc;138 sin | wdi( 8, fc ); sout | fc;139 sin | ignore( fc ); sout | fc;140 sin | ignore( wdi( 8, fc ) ); sout | fc;137 sin | fc; sout | fc; 138 sin | wdi( 8, fc ); sout | fc; 139 sin | ignore( fc ); sout | fc; 140 sin | ignore( wdi( 8, fc ) ); sout | fc; 141 141 142 142 double _Complex dc; 143 sin | dc; sout | dc;144 sin | wdi( 8, dc ); sout | dc;145 sin | ignore( dc ); sout | dc;146 sin | ignore( wdi( 8, dc ) ); sout | dc;143 sin | dc; sout | dc; 144 sin | wdi( 8, dc ); sout | dc; 145 sin | ignore( dc ); sout | dc; 146 sin | ignore( wdi( 8, dc ) ); sout | dc; 147 147 148 148 long double _Complex ldc; 149 sin | ldc; sout | ldc;150 sin | wdi( 8, ldc ); sout | ldc;151 sin | ignore( ldc ); sout | ldc;152 sin | ignore( wdi( 8, ldc ) ); sout | ldc;149 sin | ldc; sout | ldc; 150 sin | wdi( 8, ldc ); sout | ldc; 151 sin | ignore( ldc ); sout | ldc; 152 sin | ignore( wdi( 8, ldc ) ); sout | ldc; 153 153 } 154 154 #if defined( __SIZEOF_INT128__ ) -
tests/list/dlist-insert-remove.cfa
r92355883 r2a301ff 1 #include <co ntainers/list.hfa>1 #include <collections/list.hfa> 2 2 #include <fstream.hfa> 3 3 #include <assert.h> -
tests/maybe.cfa
r92355883 r2a301ff 10 10 // Created On : Thr May 25 16:02:00 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Sep 25 15:13:28 202013 // Update Count : 212 // Last Modified On : Wed Aug 30 21:45:27 2023 13 // Update Count : 3 14 14 // 15 15 16 16 #include <assert.h> 17 #include <co ntainers/maybe.hfa>17 #include <collections/maybe.hfa> 18 18 19 19 void checkPredicates() { -
tests/raii/.expect/memberCtors-ERR1.txt
r92355883 r2a301ff 1 raii/memberCtors.cfa:9 2:1 error: in ?{}, field a2 used before being constructed1 raii/memberCtors.cfa:94:1 error: in ?{}, field a2 used before being constructed -
tests/raii/dtor-early-exit.cfa
r92355883 r2a301ff 10 10 // Created On : Wed Aug 17 08:26:25 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Dec 21 08:45:19 201813 // Update Count : 1 012 // Last Modified On : Thu Jun 29 11:15:56 2023 13 // Update Count : 11 14 14 // 15 15 … … 244 244 245 245 int main() { 246 sep Disable(sout);246 sepOff(sout); 247 247 for (int i = 0; i < 4; i++) { 248 248 f(i); -
tests/raii/memberCtors.cfa
r92355883 r2a301ff 1 #include <fstream.hfa> 2 1 3 struct WrappedInt { 2 int x;3 int id;4 int x; 5 int id; 4 6 }; 5 7 int intID = 0; 6 8 7 void ?{}( WrappedInt & this) {8 this.id = intID++;9 printf("constructing int id: %d\n", this.id);10 this.x = 0;9 void ?{}( WrappedInt & this ) { 10 this.id = intID++; 11 sout | "constructing int id: " | this.id; 12 this.x = 0; 11 13 } 12 14 13 void ?{}( WrappedInt & this, WrappedInt other) {14 this.id = intID++;15 printf("copy constructing int: %d id: %d\n", other.x, this.id);16 this.x = other.x;15 void ?{}( WrappedInt & this, WrappedInt other ) { 16 this.id = intID++; 17 sout | "copy constructing int: " | other.x | "id: " | this.id; 18 this.x = other.x; 17 19 } 18 20 19 void ?{}( WrappedInt & this, int x) {20 this.id = intID++;21 printf("constructing int: %d id: %d\n", x, this.id);22 this.x = x;21 void ?{}( WrappedInt & this, int x ) { 22 this.id = intID++; 23 sout | "constructing int: " | x | "id: " | this.id; 24 this.x = x; 23 25 } 24 26 25 void ^?{}( WrappedInt & this) {26 printf("destructing int: %d id: %d\n", this.x, this.id);27 void ^?{}( WrappedInt & this ) { 28 sout | "destructing int: " | this.x | "id: " | this.id; 27 29 } 28 30 29 /* WrappedInt */ void ?=?( WrappedInt & this, int x) {30 printf("assigning int: %d %d id: %d\n", this.x, x, this.id);31 this.x = x;32 // return this;31 /* WrappedInt */ void ?=?( WrappedInt & this, int x ) { 32 sout | "assigning int: " | this.x | x | "id: " | this.id; 33 this.x = x; 34 // return this; 33 35 } 34 36 35 // WrappedInt ?=?( WrappedInt & this, WrappedInt other) {36 // printf("assigning int: %d %d\n", this.x, other.x);37 // WrappedInt ?=?( WrappedInt & this, WrappedInt other ) { 38 // sout | "assigning int: " | this.x | other.x; 37 39 // this.x = other.x; 38 40 // return this; … … 40 42 41 43 struct A { 42 WrappedInt x, y, z;43 int id;44 WrappedInt x, y, z; 45 int id; 44 46 }; 45 47 int AID = 0; 46 48 47 void ?{}( A & a) {48 // currently must define default ctor, since there's no "= default" syntax49 a.id = AID++;50 printf("default construct A %d\n", a.id);49 void ?{}( A & a ) { 50 // currently must define default ctor, since there's no "= default" syntax 51 a.id = AID++; 52 sout | "default construct A" | a.id; 51 53 } 52 54 53 void ?{}( A & a, int x) {54 a.id = AID++;55 printf("begin construct A id: %d\n", a.id);56 printf("construct a.x\n");57 (a.x){ x+999 };58 printf("assign a.y\n");59 a.y = 0; // not a constructor - default constructor will be inserted60 printf("end construct A\n");55 void ?{}( A & a, int x ) { 56 a.id = AID++; 57 sout | "begin construct A id: " | a.id; 58 sout | "construct a.x"; 59 (a.x){ x+999 }; 60 sout | "assign a.y"; 61 a.y = 0; // not a constructor - default constructor will be inserted 62 sout | "end construct A"; 61 63 } // z never constructed - will be automatically default constructed 62 64 63 void ?{}( A & this, A other) {64 this.id = AID++;65 printf("begin copy construct A id: %d\n", this.id);66 printf("copy construct this.x\n");67 (this.x){ other.x };68 printf("assign this.y\n");69 this.y = other.y; // not a constructor - copy constructor will be inserted70 printf("end copy construct A\n");65 void ?{}( A & this, A other ) { 66 this.id = AID++; 67 sout | "begin copy construct A id: " | this.id; 68 sout | "copy construct this.x"; 69 (this.x){ other.x }; 70 sout | "assign this.y"; 71 this.y = other.y; // not a constructor - copy constructor will be inserted 72 sout | "end copy construct A"; 71 73 } // z never constructed - will be automatically copy constructed 72 74 73 A ?=?( A & this, A other) {74 printf("begin ?=? A id: %d\n", this.id);75 this.x = other.x;76 this.y = other.y;77 this.z = other.z;78 printf("end ?=? A\n");79 return this;75 A ?=?( A & this, A other ) { 76 sout | "begin ?=? A id: " | this.id; 77 this.x = other.x; 78 this.y = other.y; 79 this.z = other.z; 80 sout | "end ?=? A"; 81 return this; 80 82 } 81 83 82 84 struct B { 83 A a1, a2, a3;84 int id;85 A a1, a2, a3; 86 int id; 85 87 }; 86 88 int BID = 0; 87 89 88 void ?{}( B & b) {89 b.id = BID++;90 printf("begin construct B id: %d\n", b.id);91 printf("assign b.a2\n");92 b.a2 = (A){ 2 };93 printf("construct b.a1\n");94 (b.a1){ 1 };90 void ?{}( B & b ) { 91 b.id = BID++; 92 sout | "begin construct B id: " | b.id; 93 sout | "assign b.a2"; 94 b.a2 = (A){ 2 }; 95 sout | "construct b.a1"; 96 (b.a1){ 1 }; 95 97 #ifdef ERR1 96 (b.a2){ b.a3 }; // error, b->a2 was used previously but is explicitly constructed98 (b.a2){ b.a3 }; // error, b->a2 was used previously but is explicitly constructed 97 99 #endif 98 printf("end construct B\n");100 sout | "end construct B"; 99 101 } // a2, a3 never constructed - will be automatically default constructed 100 102 101 void ^?{}( B & b) {102 b.id = BID++;103 printf("begin destruct B id: %d\n", b.id);104 b.a2 = (A) { 0 };105 ^(b.a1){};106 printf("end destruct B\n");103 void ^?{}( B & b ) { 104 b.id = BID++; 105 sout | "begin destruct B id: " | b.id; 106 b.a2 = (A) { 0 }; 107 ^(b.a1){}; 108 sout | "end destruct B"; 107 109 } // a2, a3 never destructed - will be automatically destructed 108 110 109 111 int main() { 110 printf("Before declaration of b1\n");111 B b1; // b1 = { { 1000, 0, 0 }, { 1001, 0, 0 }, { 0, 0, 0 } }112 printf("Before declaration of b2\n");113 B b2 = b1;114 printf("End of main\n");112 sout | "Before declaration of b1"; 113 B b1; // b1 = { { 1000, 0, 0 }, { 1001, 0, 0 }, { 0, 0, 0 } } 114 sout | "Before declaration of b2"; 115 B b2 = b1; 116 sout | "End of main"; 115 117 } -
tests/result.cfa
r92355883 r2a301ff 10 10 // Created On : Thr May 25 16:50:00 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Sep 25 15:22:59 202013 // Update Count : 212 // Last Modified On : Wed Aug 30 21:46:34 2023 13 // Update Count : 3 14 14 // 15 15 16 16 #include <assert.h> 17 #include <co ntainers/result.hfa>17 #include <collections/result.hfa> 18 18 19 19 void checkPredicates() { -
tests/zombies/gc_no_raii/premake4.lua
r92355883 r2a301ff 48 48 linkoptions (linkOptionList) 49 49 includedirs (includeDirList) 50 files { "src/**.c", "co ntainers/**.c" }50 files { "src/**.c", "collections/**.c" } 51 51 52 52 configuration "debug" -
tests/zombies/hashtable.cfa
r92355883 r2a301ff 1 1 2 #include <co ntainers/list.hfa>2 #include <collections/list.hfa> 3 3 4 4 #include <exception.hfa> -
tests/zombies/hashtable2.cfa
r92355883 r2a301ff 1 1 2 #include <co ntainers/list.hfa>2 #include <collections/list.hfa> 3 3 4 4 typedef unsigned int K; -
tests/zombies/linked-list-perf/experiment.koad
r92355883 r2a301ff 67 67 #elif defined IMPL_CFA_MIKE_NEW 68 68 69 #include <co ntainers/list.hfa>69 #include <collections/list.hfa> 70 70 struct S { 71 71 int f[64]; // FIXME: make "is volatile" consistent; given bug #TBD
Note:
See TracChangeset
for help on using the changeset viewer.