Changeset c565d68
- Timestamp:
- Oct 13, 2024, 1:15:29 PM (3 weeks ago)
- Branches:
- master
- Children:
- 4e0168a
- Parents:
- 1a7203d
- Location:
- tests
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
tests/collections/string-istream-manip.cfa
r1a7203d rc565d68 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 & s ) { return (_Istream_Sstr)@{ s, {{0p}, -1, {.flags.rwd :false}} }; }13 static _Istream_Rstr plainjane( string_res & s ) { return (_Istream_Rstr)@{ &s, {{0p}, -1, {.flags.rwd :false}} }; }12 static _Istream_Sstr plainjane( string & s ) { return (_Istream_Sstr)@{ s, {{0p}, -1, {.flags.rwd = false}} }; } 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) { -
tests/designations.cfa
r1a7203d rc565d68 10 10 // Created On : Thu Jun 29 15:26:36 2017 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Jun 29 11:31:21 202313 // Update Count : 2812 // Last Modified On : Sun Oct 13 11:53:16 2024 13 // Update Count : 31 14 14 // 15 15 … … 17 17 18 18 // Note: this test case has been crafted so that it compiles with both cfa and with gcc without any modifications. 19 // In particular, since the syntax for designations in Cforall differs from that of C, preprocessor substitution20 // is used for the designation syntax21 19 #ifdef __cforall 22 #define _ :23 20 #define AT @ 24 21 #else 25 #define _ =26 22 #define AT 27 23 #endif … … 100 96 } m; 101 97 }; 102 struct Fred s1 AT= { .m.j _3 };103 struct Fred s2 AT= { .i _ { [2] _2 } };98 struct Fred s1 AT= { .m.j = 3 }; 99 struct Fred s2 AT= { .i = { [2] = 2 } }; 104 100 105 101 int main() { 106 102 // simple designation case - starting from beginning of structure, leaves ptr default-initialized (zero) 107 103 struct A y0 = { 108 .x _2,109 .y _3104 .x = 2, 105 .y = 3 110 106 }; 111 107 … … 118 114 // use designation to move to member y, leaving x default-initialized (zero) 119 115 struct A y2 = { 120 .y _3,116 .y = 3, 121 117 0 122 118 }; … … 141 137 { 3 }, // z1.a0 142 138 { 4 }, // z1.a1 143 .a0 _{ 5 }, // z1.a0139 .a0 = { 5 }, // z1.a0 144 140 { 6 }, // z1.a1 145 .a0.y _2, // z1.a0.y141 .a0.y = 2, // z1.a0.y 146 142 0, // z1.a0.ptr 147 143 }; … … 214 210 #endif 215 211 // array designation 216 int i[2] = { [1] _3 };212 int i[2] = { [1] = 3 }; 217 213 // allowed to have 'too many' initialized lists - essentially they are ignored. 218 214 int i1 = { 3 }; … … 220 216 // doesn't work yet. 221 217 // designate unnamed object's members 222 // struct D d = { .x _3 };218 // struct D d = { .x = 3 }; 223 219 #if ERROR 224 struct D d1 = { .y _3 };220 struct D d1 = { .y = 3 }; 225 221 #endif 226 222 … … 242 238 // move cursor to e4.b.a0.x and initialize until e3.b.a1.ptr inclusive 243 239 union E e3 = { 244 .b.a0.x _2, 3, 0, 5, 6, 0240 .b.a0.x = 2, 3, 0, 5, 6, 0 245 241 }; 246 242 … … 261 257 // more cases 262 258 263 // int widths[] = { [3 ... 9] _ 1, [10 ... 99] _ 2, [100] _3 };264 // int widths[] = { [3 ~ 9] _ 1, [10 ~ 99] _ 2, [100] _3 };259 // int widths[] = { [3 ... 9] = 1, [10 ... 99] = 2, [100] = 3 }; 260 // int widths[] = { [3 ~ 9] = 1, [10 ~ 99] = 2, [100] = 3 }; 265 261 struct point { int x, y; }; 266 struct point p = { .y _ 5, .x _7 };262 struct point p = { .y = 5, .x = 7 }; 267 263 union foo { int i; double d; }; 268 union foo f = { .d _4 };264 union foo f = { .d = 4 }; 269 265 int v1, v2, v4; 270 int w[6] = { [1] _ v1, v2, [4] _v4 };271 int whitespace[256] = { [' '] _ 1, ['\t'] _ 1, ['\v'] _ 1, ['\f'] _ 1, ['\n'] _ 1, ['\r'] _1 };272 struct point ptarray[10] = { [2].y _ 34, [2].x _ 35, [0].x _36 };266 int w[6] = { [1] = v1, v2, [4] = v4 }; 267 int whitespace[256] = { [' '] = 1, ['\t'] = 1, ['\v'] = 1, ['\f'] = 1, ['\n'] = 1, ['\r'] = 1 }; 268 struct point ptarray[10] = { [2].y = 34, [2].x = 35, [0].x = 36 }; 273 269 } 274 270 -
tests/enum.cfa
r1a7203d rc565d68 38 38 enum { J = +3 + -4 / ~20 * ! 0 }; 39 39 int z[J] = { 1, 2, 3 }; 40 int aa[41] @= { [3] : 3, [1] :6 };40 int aa[41] @= { [3] = 3, [1] = 6 }; 41 41 42 42 //Dummy main -
tests/exceptions/defaults.cfa
r1a7203d rc565d68 18 18 19 19 const struct log_message_vtable log_vt @= { 20 .__cfavir_typeid :&__cfatid_log_message,21 .size :sizeof(struct log_message),22 .copy :copy,23 .^?{} :^?{},24 .msg :msg,20 .__cfavir_typeid = &__cfatid_log_message, 21 .size = sizeof(struct log_message), 22 .copy = copy, 23 .^?{} = ^?{}, 24 .msg = msg, 25 25 }; 26 26
Note: See TracChangeset
for help on using the changeset viewer.