| 1 |
// PERMUTE_ARGS: -fPIC |
| 2 |
|
| 3 |
/* Test associative arrays */ |
| 4 |
|
| 5 |
extern(C) int printf(const char*, ...); |
| 6 |
extern(C) int memcmp(const void *s1, const void *s2, size_t n); |
| 7 |
|
| 8 |
import core.memory; // for GC.collect |
| 9 |
|
| 10 |
/************************************************/ |
| 11 |
|
| 12 |
int[char[]] nametable; |
| 13 |
|
| 14 |
void insert(string name, int value) |
| 15 |
{ |
| 16 |
nametable[name] = value; |
| 17 |
} |
| 18 |
|
| 19 |
int retrieve(string name) |
| 20 |
{ |
| 21 |
return nametable[name]; |
| 22 |
} |
| 23 |
|
| 24 |
void test1() |
| 25 |
{ int v; |
| 26 |
|
| 27 |
printf("test1.a\n"); |
| 28 |
insert("hello", 1); |
| 29 |
printf("test1.b\n"); |
| 30 |
insert("world", 2); |
| 31 |
printf("test1.c\n"); |
| 32 |
v = retrieve("hello"); |
| 33 |
assert(v == 1); |
| 34 |
v = retrieve("world"); |
| 35 |
assert(v == 2); |
| 36 |
v = retrieve("world"); |
| 37 |
assert(v == 2); |
| 38 |
|
| 39 |
nametable.rehash; |
| 40 |
v = retrieve("world"); |
| 41 |
assert(v == 2); |
| 42 |
} |
| 43 |
|
| 44 |
/************************************************/ |
| 45 |
|
| 46 |
|
| 47 |
void test2() |
| 48 |
{ |
| 49 |
int[string] aa; |
| 50 |
string[] keys; |
| 51 |
int[] values; |
| 52 |
|
| 53 |
printf("test2()\n"); |
| 54 |
|
| 55 |
/*************/ |
| 56 |
|
| 57 |
assert(aa == null); |
| 58 |
assert(aa.length == 0); |
| 59 |
|
| 60 |
keys = aa.keys; |
| 61 |
assert(keys.length == 0); |
| 62 |
|
| 63 |
values = aa.values; |
| 64 |
assert(values.length == 0); |
| 65 |
|
| 66 |
aa.rehash; |
| 67 |
assert(aa.length == 0); |
| 68 |
|
| 69 |
/*************/ |
| 70 |
|
| 71 |
aa["hello"] = 3; |
| 72 |
assert(aa["hello"] == 3); |
| 73 |
aa["hello"]++; |
| 74 |
assert(aa["hello"] == 4); |
| 75 |
|
| 76 |
assert(aa.length == 1); |
| 77 |
|
| 78 |
keys = aa.keys; |
| 79 |
assert(keys.length == 1); |
| 80 |
assert(memcmp(keys[0].ptr, cast(char*)"hello", 5) == 0); |
| 81 |
|
| 82 |
values = aa.values; |
| 83 |
assert(values.length == 1); |
| 84 |
assert(values[0] == 4); |
| 85 |
|
| 86 |
aa.rehash; |
| 87 |
assert(aa.length == 1); |
| 88 |
assert(aa["hello"] == 4); |
| 89 |
} |
| 90 |
|
| 91 |
/************************************************/ |
| 92 |
|
| 93 |
void test4() |
| 94 |
{ |
| 95 |
int[const(ubyte)[]] b; |
| 96 |
const(ubyte)[] x; |
| 97 |
b[x] = 3; |
| 98 |
assert(b[x] == 3); |
| 99 |
} |
| 100 |
|
| 101 |
/************************************************/ |
| 102 |
|
| 103 |
void test5() |
| 104 |
{ |
| 105 |
int[immutable(short)[]] b; |
| 106 |
immutable(short)[] x; |
| 107 |
b[x] = 3; |
| 108 |
assert(b[x] == 3); |
| 109 |
} |
| 110 |
|
| 111 |
/************************************************/ |
| 112 |
|
| 113 |
void test6() |
| 114 |
{ |
| 115 |
int[const(int)[]] b; |
| 116 |
const(int)[] x; |
| 117 |
b[x] = 3; |
| 118 |
assert(b[x] == 3); |
| 119 |
} |
| 120 |
|
| 121 |
/************************************************/ |
| 122 |
|
| 123 |
void test7() |
| 124 |
{ |
| 125 |
int[immutable(uint)[]] b; |
| 126 |
immutable(uint)[] x; |
| 127 |
b[x] = 3; |
| 128 |
assert(b[x] == 3); |
| 129 |
} |
| 130 |
|
| 131 |
/************************************************/ |
| 132 |
|
| 133 |
void test8() |
| 134 |
{ |
| 135 |
int[immutable(long)[]] b; |
| 136 |
immutable(long)[] x; |
| 137 |
b[x] = 3; |
| 138 |
assert(b[x] == 3); |
| 139 |
} |
| 140 |
|
| 141 |
/************************************************/ |
| 142 |
|
| 143 |
void test9() |
| 144 |
{ |
| 145 |
int[immutable(ulong)[]] b; |
| 146 |
immutable(ulong)[] x; |
| 147 |
b[x] = 3; |
| 148 |
assert(b[x] == 3); |
| 149 |
} |
| 150 |
|
| 151 |
/************************************************/ |
| 152 |
|
| 153 |
class A10 {} |
| 154 |
|
| 155 |
int[immutable(A10)[]] foo10; |
| 156 |
|
| 157 |
void test10() |
| 158 |
{ |
| 159 |
auto key = new immutable(A10)[2]; |
| 160 |
|
| 161 |
cast()(key[0]) = new A10(); |
| 162 |
foo10[key] = 0; |
| 163 |
assert(key in foo10); |
| 164 |
assert(!(key !in foo10)); |
| 165 |
} |
| 166 |
|
| 167 |
|
| 168 |
/************************************************/ |
| 169 |
|
| 170 |
struct Value |
| 171 |
{ |
| 172 |
uint x,y,z,t; |
| 173 |
} |
| 174 |
|
| 175 |
struct Key |
| 176 |
{ |
| 177 |
int a,b,c,d; |
| 178 |
|
| 179 |
static int hash, cmp, equals; |
| 180 |
|
| 181 |
size_t toHash() const |
| 182 |
{ |
| 183 |
hash = 1; |
| 184 |
return a + b + c + d; |
| 185 |
} |
| 186 |
|
| 187 |
int opCmp(ref const Key s) const |
| 188 |
{ |
| 189 |
cmp = 1; |
| 190 |
int x; |
| 191 |
|
| 192 |
x = a - s.a; |
| 193 |
if (x == 0) |
| 194 |
{ x = b - s.b; |
| 195 |
if (x == 0) |
| 196 |
{ x = c - s.c; |
| 197 |
if (x == 0) |
| 198 |
x = d - s.d; |
| 199 |
} |
| 200 |
} |
| 201 |
return x; |
| 202 |
} |
| 203 |
|
| 204 |
bool opEquals(ref const Key s) const |
| 205 |
{ |
| 206 |
printf("opEquals()\n"); |
| 207 |
equals = 1; |
| 208 |
return (a == s.a && b == s.b && c == s.c && d == s.d); |
| 209 |
} |
| 210 |
} |
| 211 |
|
| 212 |
void test11() |
| 213 |
{ |
| 214 |
Value[Key] table; |
| 215 |
|
| 216 |
Value* p; |
| 217 |
Value v; |
| 218 |
Value r; |
| 219 |
Key k; |
| 220 |
|
| 221 |
v.x = 7; |
| 222 |
v.y = 8; |
| 223 |
v.z = 9; |
| 224 |
v.t = 10; |
| 225 |
|
| 226 |
k.a = 1; |
| 227 |
k.b = 2; |
| 228 |
k.c = 3; |
| 229 |
k.d = 4; |
| 230 |
|
| 231 |
p = k in table; |
| 232 |
assert(!p); |
| 233 |
|
| 234 |
table[k] = v; |
| 235 |
p = k in table; |
| 236 |
assert(p); |
| 237 |
|
| 238 |
table.rehash; |
| 239 |
p = k in table; |
| 240 |
assert(p); |
| 241 |
|
| 242 |
r = table[k]; |
| 243 |
assert(v == r); |
| 244 |
|
| 245 |
table.remove(k); |
| 246 |
assert(!(k in table)); |
| 247 |
|
| 248 |
printf("Key.hash = %d\n", Key.hash); |
| 249 |
assert(Key.hash == 1); |
| 250 |
printf("Key.cmp = %d\n", Key.cmp); |
| 251 |
printf("Key.equals = %d\n", Key.equals); |
| 252 |
assert(Key.cmp == 1 && !Key.equals || !Key.cmp && Key.equals == 1); |
| 253 |
} |
| 254 |
|
| 255 |
|
| 256 |
/************************************************/ |
| 257 |
|
| 258 |
struct S12 |
| 259 |
{ |
| 260 |
byte number; |
| 261 |
char[] description; |
| 262 |
char[] font_face; |
| 263 |
byte font_size; |
| 264 |
ushort flags; |
| 265 |
int colour_back; |
| 266 |
int colour_fore; |
| 267 |
byte charset; |
| 268 |
} |
| 269 |
|
| 270 |
void test12() |
| 271 |
{ |
| 272 |
S12[] x; |
| 273 |
printf("size %zd\n",S12.sizeof); |
| 274 |
printf("align %zd\n",S12.alignof); |
| 275 |
printf("offset %zd\n",S12.description.offsetof); |
| 276 |
|
| 277 |
for (int i=0;i<3;i++) { |
| 278 |
S12 s; |
| 279 |
s.font_face="font face".dup; |
| 280 |
x ~= s; |
| 281 |
} |
| 282 |
|
| 283 |
/* works fine |
| 284 |
S12 s; |
| 285 |
s.font_face="font face".dup; |
| 286 |
x ~= s; |
| 287 |
s.font_face="font face".dup; |
| 288 |
x ~= s; |
| 289 |
s.font_face="font face".dup; |
| 290 |
x ~= s; |
| 291 |
s.font_face="font face".dup; |
| 292 |
x ~= s; |
| 293 |
*/ |
| 294 |
GC.collect(); |
| 295 |
printf("%.*s\n", cast(int)x[0].font_face.length, x[0].font_face.ptr); |
| 296 |
printf("%.*s\n", cast(int)x[1].font_face.length, x[1].font_face.ptr); |
| 297 |
} |
| 298 |
|
| 299 |
|
| 300 |
/************************************************/ |
| 301 |
|
| 302 |
void test13() |
| 303 |
{ |
| 304 |
int[string] array; |
| 305 |
array["eins"]=1; |
| 306 |
array["zwei"]=2; |
| 307 |
array["drei"]=3; |
| 308 |
|
| 309 |
assert(array.length==3); |
| 310 |
|
| 311 |
int[string] rehashed=array.rehash; |
| 312 |
assert(rehashed is array); |
| 313 |
|
| 314 |
string[] key = array.keys; |
| 315 |
assert(key.length==3); |
| 316 |
|
| 317 |
bool[3] have; |
| 318 |
|
| 319 |
assert(!have[0]); |
| 320 |
assert(!have[1]); |
| 321 |
assert(!have[2]); |
| 322 |
|
| 323 |
foreach(string value; key){ |
| 324 |
switch(value){ |
| 325 |
case "eins":{ |
| 326 |
have[0]=true; |
| 327 |
break; |
| 328 |
}case "zwei":{ |
| 329 |
have[1]=true; |
| 330 |
break; |
| 331 |
}case "drei":{ |
| 332 |
have[2]=true; |
| 333 |
break; |
| 334 |
}default:{ |
| 335 |
assert(0); |
| 336 |
} |
| 337 |
} |
| 338 |
} |
| 339 |
|
| 340 |
assert(have[0]); |
| 341 |
assert(have[1]); |
| 342 |
assert(have[2]); |
| 343 |
} |
| 344 |
|
| 345 |
/************************************************/ |
| 346 |
|
| 347 |
void test14() |
| 348 |
{ |
| 349 |
int[char[]] aa; |
| 350 |
|
| 351 |
aa["hello"] = 3; |
| 352 |
assert(aa["hello"] == 3); |
| 353 |
assert("hello" in aa); |
| 354 |
//delete aa["hello"]; |
| 355 |
aa.remove("hello"); |
| 356 |
assert(!("hello" in aa)); |
| 357 |
} |
| 358 |
|
| 359 |
/************************************************/ |
| 360 |
|
| 361 |
class SomeClass |
| 362 |
{ |
| 363 |
this(char value) |
| 364 |
{ |
| 365 |
printf("class created\n"); |
| 366 |
_value = value; |
| 367 |
} |
| 368 |
|
| 369 |
~this() |
| 370 |
{ |
| 371 |
printf("class killed (%d)\n", _value); |
| 372 |
} |
| 373 |
|
| 374 |
char value() |
| 375 |
{ |
| 376 |
return _value; |
| 377 |
} |
| 378 |
|
| 379 |
private |
| 380 |
{ |
| 381 |
char _value; |
| 382 |
} |
| 383 |
} |
| 384 |
|
| 385 |
char[] allChars = [ 'a', 'b', 'c', 'e', 'z', 'q', 'x' ]; |
| 386 |
|
| 387 |
SomeClass[char] _chars; |
| 388 |
|
| 389 |
void _realLoad() |
| 390 |
{ |
| 391 |
printf("Loading...\n"); |
| 392 |
foreach(char ch; allChars) |
| 393 |
{ |
| 394 |
_chars[ch] = new SomeClass(ch); |
| 395 |
} |
| 396 |
} |
| 397 |
|
| 398 |
|
| 399 |
|
| 400 |
void test15() |
| 401 |
{ |
| 402 |
_realLoad(); |
| 403 |
int j; |
| 404 |
|
| 405 |
for (int i = 0; i < 10000; i++) |
| 406 |
{ |
| 407 |
foreach(char ch; allChars) |
| 408 |
{ |
| 409 |
SomeClass obj = _chars[ch]; |
| 410 |
j += obj.value; |
| 411 |
} |
| 412 |
GC.collect(); |
| 413 |
} |
| 414 |
printf("j = %d\n", j); |
| 415 |
assert(j == 7500000); |
| 416 |
} |
| 417 |
|
| 418 |
|
| 419 |
/************************************************/ |
| 420 |
|
| 421 |
void test16() |
| 422 |
{ |
| 423 |
int[int] aa; |
| 424 |
|
| 425 |
for (int i = 0; i < 50000; i++) |
| 426 |
{ |
| 427 |
aa[i] = i; |
| 428 |
} |
| 429 |
|
| 430 |
int[] keys = aa.keys; |
| 431 |
assert(keys.length == aa.length); |
| 432 |
|
| 433 |
int j; |
| 434 |
foreach (k; keys) |
| 435 |
{ |
| 436 |
assert(k in aa); |
| 437 |
j += aa[k]; |
| 438 |
} |
| 439 |
assert(j == 1249975000); |
| 440 |
|
| 441 |
int m; |
| 442 |
foreach (k, v; aa) |
| 443 |
{ |
| 444 |
assert(k in aa); |
| 445 |
assert(aa[k] == v); |
| 446 |
m += v; |
| 447 |
} |
| 448 |
assert(j == m); |
| 449 |
|
| 450 |
m = 0; |
| 451 |
foreach (v; aa) |
| 452 |
{ |
| 453 |
m += v; |
| 454 |
} |
| 455 |
assert(j == m); |
| 456 |
|
| 457 |
int[] values = aa.values; |
| 458 |
assert(values.length == aa.length); |
| 459 |
|
| 460 |
foreach(k; keys) |
| 461 |
{ |
| 462 |
aa.remove(k); |
| 463 |
} |
| 464 |
assert(aa.length == 0); |
| 465 |
|
| 466 |
for (int i = 0; i < 1000; i++) |
| 467 |
{ |
| 468 |
aa[i] = i; |
| 469 |
} |
| 470 |
foreach(k; aa) |
| 471 |
{ |
| 472 |
if (k < 1000) |
| 473 |
break; |
| 474 |
} |
| 475 |
foreach(k, v; aa) |
| 476 |
{ |
| 477 |
if (k < 1000) |
| 478 |
break; |
| 479 |
} |
| 480 |
} |
| 481 |
|
| 482 |
/************************************************/ |
| 483 |
|
| 484 |
void dummy17() |
| 485 |
{ |
| 486 |
} |
| 487 |
|
| 488 |
int[string] bb17; |
| 489 |
|
| 490 |
int foo17() |
| 491 |
{ |
| 492 |
foreach(string s, int i; bb17) |
| 493 |
{ |
| 494 |
dummy17(); |
| 495 |
} |
| 496 |
|
| 497 |
bb17["a"] = 1; |
| 498 |
|
| 499 |
foreach(int b; bb17) |
| 500 |
{ |
| 501 |
try{ |
| 502 |
throw new Error("foo"); |
| 503 |
}catch(Error e){ |
| 504 |
assert(e); |
| 505 |
return 0; |
| 506 |
}catch(Throwable){ |
| 507 |
assert(0); |
| 508 |
} |
| 509 |
assert(0); |
| 510 |
} |
| 511 |
|
| 512 |
assert(0); |
| 513 |
} |
| 514 |
|
| 515 |
void test17() |
| 516 |
{ |
| 517 |
int i = foo17(); |
| 518 |
printf("foo17 = %d\n", i); |
| 519 |
assert(i == 0); |
| 520 |
} |
| 521 |
|
| 522 |
/************************************************/ |
| 523 |
|
| 524 |
void test18() |
| 525 |
{ |
| 526 |
int[uint] aa; |
| 527 |
|
| 528 |
aa[1236448822] = 0; |
| 529 |
aa[2716102924] = 1; |
| 530 |
aa[ 315901071] = 2; |
| 531 |
|
| 532 |
aa.remove(1236448822); |
| 533 |
printf("%d\n", aa[2716102924]); |
| 534 |
assert(aa[2716102924] == 1); |
| 535 |
} |
| 536 |
|
| 537 |
|
| 538 |
/************************************************/ |
| 539 |
|
| 540 |
void test19() |
| 541 |
{ |
| 542 |
immutable(char[5])[int] aa = ([3:"hello", 4:"betty"]); |
| 543 |
|
| 544 |
assert(aa[3] == "hello"); |
| 545 |
assert(aa[4] == "betty"); |
| 546 |
|
| 547 |
auto keys = aa.keys; |
| 548 |
printf("%d\n", keys[0]); |
| 549 |
printf("%d\n", keys[1]); |
| 550 |
|
| 551 |
auto vs = aa.values; |
| 552 |
printf("%.*s\n", cast(int)vs[0].length, vs[0].ptr); |
| 553 |
printf("%.*s\n", cast(int)vs[1].length, vs[1].ptr); |
| 554 |
|
| 555 |
string aavalue_typeid = typeid(typeof(aa.values)).toString(); |
| 556 |
printf("%.*s\n", cast(int)aavalue_typeid.length, aavalue_typeid.ptr); |
| 557 |
|
| 558 |
printf("%.*s\n", cast(int)aa[3].length, aa[3].ptr); |
| 559 |
printf("%.*s\n", cast(int)aa[4].length, aa[4].ptr); |
| 560 |
} |
| 561 |
|
| 562 |
/************************************************/ |
| 563 |
|
| 564 |
void test20() |
| 565 |
{ |
| 566 |
string[int] aa = ([3:"hello", 4:"betty"]); |
| 567 |
|
| 568 |
assert(aa[3] == "hello"); |
| 569 |
assert(aa[4] == "betty"); |
| 570 |
|
| 571 |
auto keys = aa.keys; |
| 572 |
printf("%d\n", keys[0]); |
| 573 |
printf("%d\n", keys[1]); |
| 574 |
|
| 575 |
auto values = aa.values; |
| 576 |
printf("%.*s\n", cast(int)values[0].length, values[0].ptr); |
| 577 |
printf("%.*s\n", cast(int)values[1].length, values[1].ptr); |
| 578 |
|
| 579 |
string aavalue_typeid = typeid(typeof(aa.values)).toString(); |
| 580 |
printf("%.*s\n", cast(int)aavalue_typeid.length, aavalue_typeid.ptr); |
| 581 |
|
| 582 |
printf("%.*s\n", cast(int)aa[3].length, aa[3].ptr); |
| 583 |
printf("%.*s\n", cast(int)aa[4].length, aa[4].ptr); |
| 584 |
} |
| 585 |
|
| 586 |
/************************************************/ |
| 587 |
|
| 588 |
void test21() |
| 589 |
{ |
| 590 |
ushort[20] key = 23; |
| 591 |
int[ushort[20]] aa; |
| 592 |
aa[key] = 42; |
| 593 |
auto x = aa[key]; |
| 594 |
assert(x == 42); |
| 595 |
printf("foo\n"); |
| 596 |
} |
| 597 |
|
| 598 |
/************************************************/ |
| 599 |
|
| 600 |
void test22() |
| 601 |
{ |
| 602 |
int[string] stopWords = [ "abc"[]:1 ]; |
| 603 |
assert("abc"[] in stopWords); |
| 604 |
} |
| 605 |
|
| 606 |
/************************************************/ |
| 607 |
|
| 608 |
void test23() |
| 609 |
{ |
| 610 |
uint[char[]][] fractal; |
| 611 |
fractal.length = 10; |
| 612 |
} |
| 613 |
|
| 614 |
/************************************************/ |
| 615 |
|
| 616 |
void test24() |
| 617 |
{ |
| 618 |
int[string] x; |
| 619 |
char[] y; |
| 620 |
if (y in x) |
| 621 |
{ |
| 622 |
int z = x[y]; |
| 623 |
} |
| 624 |
} |
| 625 |
|
| 626 |
/************************************************/ |
| 627 |
|
| 628 |
void test25() |
| 629 |
{ |
| 630 |
string[string] aa; |
| 631 |
foreach (k,v; aa) |
| 632 |
{ |
| 633 |
} |
| 634 |
} |
| 635 |
|
| 636 |
/************************************************/ |
| 637 |
|
| 638 |
class Tag |
| 639 |
{ |
| 640 |
string[string] attr; |
| 641 |
} |
| 642 |
|
| 643 |
void foo26(const(Tag) tag_) |
| 644 |
{ |
| 645 |
foreach(k,v;tag_.attr) { } |
| 646 |
} |
| 647 |
|
| 648 |
void test26() |
| 649 |
{ |
| 650 |
} |
| 651 |
|
| 652 |
/************************************************/ |
| 653 |
|
| 654 |
void test27() |
| 655 |
{ |
| 656 |
int[int] s; |
| 657 |
s = s.init; |
| 658 |
} |
| 659 |
|
| 660 |
/************************************************/ |
| 661 |
|
| 662 |
void test28() |
| 663 |
{ |
| 664 |
auto a1 = [ 1:10.0, 2:20, 3:15 ]; |
| 665 |
auto a2 = [ 1:10.0, 2:20, 3:15 ]; |
| 666 |
assert(a1 !is a2); |
| 667 |
assert(a1 == a2); |
| 668 |
a2[7] = 23; |
| 669 |
assert(a1 != a2); |
| 670 |
a2.remove(7); |
| 671 |
assert(a1 == a2); |
| 672 |
a1.rehash; |
| 673 |
assert(a1 == a2); |
| 674 |
a2[2] = 18; |
| 675 |
assert(a1 != a2); |
| 676 |
} |
| 677 |
|
| 678 |
/************************************************/ |
| 679 |
|
| 680 |
void test29() |
| 681 |
{ |
| 682 |
auto gammaFunc = [-1.5:2.363, -0.5:-3.545, 0.5:1.772]; |
| 683 |
|
| 684 |
// write all keys |
| 685 |
foreach (k; gammaFunc.byKey()) { |
| 686 |
printf("%f\n", k); |
| 687 |
} |
| 688 |
|
| 689 |
// write all values |
| 690 |
foreach (v; gammaFunc.byValue()) { |
| 691 |
printf("%f\n", v); |
| 692 |
} |
| 693 |
} |
| 694 |
|
| 695 |
/************************************************/ |
| 696 |
|
| 697 |
string toString(int value) |
| 698 |
{ |
| 699 |
char[] result = new char[12]; |
| 700 |
|
| 701 |
uint ndigits = 0; |
| 702 |
do |
| 703 |
{ |
| 704 |
const c = cast(char) ((value % 10) + '0'); |
| 705 |
value /= 10; |
| 706 |
ndigits++; |
| 707 |
result[$ - ndigits] = c; |
| 708 |
} |
| 709 |
while (value); |
| 710 |
return cast(string) result[$ - ndigits .. $]; |
| 711 |
} |
| 712 |
|
| 713 |
void test30() |
| 714 |
{ |
| 715 |
int[string] aa; |
| 716 |
for(int i = 0; i < 100000; i++) |
| 717 |
{ |
| 718 |
string s = toString(i); |
| 719 |
aa[s] = i; |
| 720 |
} |
| 721 |
} |
| 722 |
|
| 723 |
/************************************************/ |
| 724 |
|
| 725 |
void test31() |
| 726 |
{ |
| 727 |
int[int] test; |
| 728 |
test[0] = 0; |
| 729 |
test[1] = 1; |
| 730 |
test[2] = 2; |
| 731 |
|
| 732 |
bool flag = false; |
| 733 |
foreach( k, v; test){ |
| 734 |
//printf("loop: %d %d\n", k, v); |
| 735 |
assert(!flag); |
| 736 |
flag = true; |
| 737 |
break; |
| 738 |
} |
| 739 |
} |
| 740 |
|
| 741 |
/************************************************/ |
| 742 |
|
| 743 |
void test32() |
| 744 |
{ |
| 745 |
uint[ushort] aa; |
| 746 |
aa[1] = 1; |
| 747 |
aa[2] = 2; |
| 748 |
aa[3] = 3; |
| 749 |
aa[4] = 4; |
| 750 |
aa[5] = 5; |
| 751 |
foreach(v; aa) |
| 752 |
{ |
| 753 |
printf("%x\n", v); |
| 754 |
assert(v >= 1 && v <= 5); |
| 755 |
} |
| 756 |
} |
| 757 |
|
| 758 |
/************************************************/ |
| 759 |
|
| 760 |
template ICE3996(T : V[K], K, V) {} |
| 761 |
|
| 762 |
struct Bug3996 {} |
| 763 |
|
| 764 |
static assert(!is( ICE3996!(Bug3996) )); |
| 765 |
|
| 766 |
/************************************************/ |
| 767 |
|
| 768 |
void bug4826c(T)(int[int] value, T x) {} |
| 769 |
|
| 770 |
void test4826c() |
| 771 |
{ |
| 772 |
AssociativeArray!(int, int) z; |
| 773 |
bug4826c(z,1); |
| 774 |
} |
| 775 |
|
| 776 |
/************************************************/ |
| 777 |
// https://issues.dlang.org/show_bug.cgi?id=5131 |
| 778 |
|
| 779 |
struct ICE5131 |
| 780 |
{ |
| 781 |
this(int n) {} |
| 782 |
ICE5131 opAssign(int x) { return this; } |
| 783 |
} |
| 784 |
|
| 785 |
void test5131() |
| 786 |
{ |
| 787 |
ICE5131[string] a; |
| 788 |
a["ICE?"] = 1; // call ctor |
| 789 |
a["ICE?"] = 1; // call opAssign |
| 790 |
} |
| 791 |
|
| 792 |
/************************************************/ |
| 793 |
// https://issues.dlang.org/show_bug.cgi?id=6178 |
| 794 |
|
| 795 |
bool test6178a() |
| 796 |
{ |
| 797 |
// AA value setting through identity opAssign |
| 798 |
|
| 799 |
int assign = 0; |
| 800 |
struct S |
| 801 |
{ |
| 802 |
int value = 10; |
| 803 |
|
| 804 |
void opAssign(S rhs) |
| 805 |
{ |
| 806 |
++assign; |
| 807 |
assert(value == 10); |
| 808 |
} |
| 809 |
} |
| 810 |
|
| 811 |
int count = 0; |
| 812 |
int makeKey() { return ++count; } |
| 813 |
|
| 814 |
S[int] aa; |
| 815 |
assert(aa.length == 0); |
| 816 |
|
| 817 |
aa[makeKey()] = S(); |
| 818 |
assert(assign == 0); |
| 819 |
assert(aa.length == 1 && 1 in aa); |
| 820 |
|
| 821 |
aa[1] = S(); |
| 822 |
assert(assign == 1); |
| 823 |
assert(aa.length == 1 && 1 in aa); |
| 824 |
|
| 825 |
return true; |
| 826 |
} |
| 827 |
|
| 828 |
bool test6178b() |
| 829 |
{ |
| 830 |
// AA value setting through implicit ctor call + non-identity opAssign |
| 831 |
|
| 832 |
int ctor = 0; |
| 833 |
int assign = 0; |
| 834 |
struct S |
| 835 |
{ |
| 836 |
int value = 10; |
| 837 |
|
| 838 |
@disable this(); |
| 839 |
|
| 840 |
this(int n) |
| 841 |
{ |
| 842 |
++ctor; |
| 843 |
assert(value == 10); |
| 844 |
value = 20; |
| 845 |
} |
| 846 |
void opAssign(int rhs) |
| 847 |
{ |
| 848 |
++assign; |
| 849 |
assert(value == 20); |
| 850 |
assert(rhs == 30); |
| 851 |
value = rhs; |
| 852 |
} |
| 853 |
} |
| 854 |
|
| 855 |
int count = 0; |
| 856 |
int makeKey() { return ++count; } |
| 857 |
|
| 858 |
S[int] aa; |
| 859 |
assert(aa.length == 0); |
| 860 |
|
| 861 |
aa[makeKey()] = 20; |
| 862 |
assert(assign == 0 && ctor == 1 && count == 1); |
| 863 |
assert(aa.length == 1 && (1 in aa)); |
| 864 |
|
| 865 |
aa[1] = 30; |
| 866 |
assert(assign == 1 && ctor == 1); |
| 867 |
assert(aa.length == 1 && 1 in aa); |
| 868 |
|
| 869 |
return true; |
| 870 |
} |
| 871 |
|
| 872 |
bool test6178c() |
| 873 |
{ |
| 874 |
// AA value setting through non-identity opAssign |
| 875 |
|
| 876 |
struct S |
| 877 |
{ |
| 878 |
//this(int) {} |
| 879 |
// not possible to perform implicit ctor call |
| 880 |
void opAssign(int) {} |
| 881 |
} |
| 882 |
|
| 883 |
S[int] aa; |
| 884 |
assert(aa.length == 0); |
| 885 |
|
| 886 |
if (!__ctfe) |
| 887 |
{ |
| 888 |
// currently CTFE does not support throwing RangeError |
| 889 |
import core.exception : RangeError; |
| 890 |
try { aa[1] = 1; assert(0); } catch (RangeError) {} |
| 891 |
|
| 892 |
// The above line is exactly same as: |
| 893 |
try { aa[1].opAssign(1); assert(0); } catch (RangeError) {} |
| 894 |
} |
| 895 |
assert(aa.length == 0); |
| 896 |
|
| 897 |
aa[1] = S(); |
| 898 |
aa[1] = 1; |
| 899 |
assert(aa.length == 1); |
| 900 |
|
| 901 |
return true; |
| 902 |
} |
| 903 |
|
| 904 |
bool test6178d() |
| 905 |
{ |
| 906 |
// AA value setting through implicit ctor call + alias this |
| 907 |
|
| 908 |
int ctor; |
| 909 |
struct S |
| 910 |
{ |
| 911 |
this(int n) { ++ctor; value = n; } |
| 912 |
|
| 913 |
int value; |
| 914 |
alias value this; |
| 915 |
} |
| 916 |
|
| 917 |
S[int] aa; |
| 918 |
assert(ctor == 0); |
| 919 |
assert(aa.length == 0); |
| 920 |
|
| 921 |
aa[1] = 0; // implicit ctor call + blit assign |
| 922 |
assert(aa[1].value == 0 && ctor == 1); |
| 923 |
assert(aa.length == 1); |
| 924 |
|
| 925 |
aa[1] = 1; // set through alias this |
| 926 |
assert(aa[1].value == 1 && ctor == 1); |
| 927 |
assert(aa.length == 1); |
| 928 |
|
| 929 |
return true; |
| 930 |
} |
| 931 |
|
| 932 |
bool test6178e() |
| 933 |
{ |
| 934 |
// AA value setting through alias this |
| 935 |
|
| 936 |
struct S |
| 937 |
{ |
| 938 |
int value; |
| 939 |
alias value this; |
| 940 |
} |
| 941 |
|
| 942 |
S[int] aa; |
| 943 |
assert(aa.length == 0); |
| 944 |
|
| 945 |
if (!__ctfe) |
| 946 |
{ |
| 947 |
// currently CTFE does not support throwing RangeError |
| 948 |
import core.exception : RangeError; |
| 949 |
try { aa[1] = 1; assert(0); } catch (RangeError) {} |
| 950 |
|
| 951 |
// The above line is exactly same as: |
| 952 |
try { aa[1].value = 1; assert(0); } catch (RangeError) {} |
| 953 |
} |
| 954 |
assert(aa.length == 0); |
| 955 |
|
| 956 |
aa[1] = S(0); // construct + blit assign |
| 957 |
assert(aa[1].value == 0 && aa.length == 1); |
| 958 |
|
| 959 |
aa[1] = 1; // set through alias this |
| 960 |
assert(aa[1].value == 1 && aa.length == 1); |
| 961 |
|
| 962 |
return true; |
| 963 |
} |
| 964 |
|
| 965 |
void test6178() |
| 966 |
{ |
| 967 |
static assert(test6178a()); // ctfe check |
| 968 |
test6178a(); // runtime test |
| 969 |
|
| 970 |
static assert(test6178b()); |
| 971 |
test6178b(); |
| 972 |
|
| 973 |
static assert(test6178c()); |
| 974 |
test6178c(); |
| 975 |
|
| 976 |
static assert(test6178d()); |
| 977 |
test6178d(); |
| 978 |
|
| 979 |
static assert(test6178e()); |
| 980 |
test6178e(); |
| 981 |
} |
| 982 |
|
| 983 |
void test6178x() |
| 984 |
{ |
| 985 |
return; // depends on AA implementation |
| 986 |
static int ctor, cpctor, dtor; |
| 987 |
|
| 988 |
static struct S |
| 989 |
{ |
| 990 |
this(int) { ++ctor; printf("ctor\n"); } |
| 991 |
this(this) { ++cpctor; printf("cpctor\n"); } |
| 992 |
~this() { ++dtor; printf("dtor\n"); } |
| 993 |
} |
| 994 |
static struct X |
| 995 |
{ |
| 996 |
this(int) {} |
| 997 |
void opAssign(int) {} |
| 998 |
} |
| 999 |
|
| 1000 |
X[S] aa1; |
| 1001 |
S[int] aa2; |
| 1002 |
|
| 1003 |
{ |
| 1004 |
auto value = S(1); |
| 1005 |
assert(ctor==1 && cpctor==0 && dtor==0); |
| 1006 |
|
| 1007 |
ref getRef(ref S s = value) { return s; } |
| 1008 |
auto getVal() { return value; } |
| 1009 |
|
| 1010 |
aa1[value] = 10; |
| 1011 |
assert(ctor==1 && cpctor==1 && dtor==0); //call copy ctor when we putting 'value' to aa1 |
| 1012 |
|
| 1013 |
aa1[getRef()] = 20; |
| 1014 |
assert(ctor==1 && cpctor==1 && dtor==0); //copy ctor wasn't called because we didn't create a new entry in aa, using an existing key |
| 1015 |
|
| 1016 |
aa1[getVal()] = 20; |
| 1017 |
assert(ctor==1 && cpctor==2 && dtor==1); //call copy ctor and dtor, because we pass key by value |
| 1018 |
|
| 1019 |
aa2[1] = value; |
| 1020 |
assert(ctor==1 && cpctor==3 && dtor==1); //call copy ctor when we putting `value` to aa2[1] |
| 1021 |
|
| 1022 |
aa2[2] = getRef(); |
| 1023 |
assert(ctor==1 && cpctor==4 && dtor==1); //call copy ctor when we putting `value` to aa2[2] |
| 1024 |
} |
| 1025 |
assert(ctor==1 && cpctor==4 && dtor==2); //We've got 3 "S" instances that aren't destroyed yet: the key in aa1, aa2[1], aa2[2]. |
| 1026 |
assert(ctor + cpctor - aa2.length - aa1.length == dtor); |
| 1027 |
} |
| 1028 |
|
| 1029 |
/************************************************/ |
| 1030 |
// https://issues.dlang.org/show_bug.cgi?id=10595 |
| 1031 |
|
| 1032 |
struct S10595 |
| 1033 |
{ |
| 1034 |
bool b = true; |
| 1035 |
|
| 1036 |
bool test() |
| 1037 |
{ |
| 1038 |
if (!b) // note: must be a check, not 'return b;' |
| 1039 |
return false; |
| 1040 |
|
| 1041 |
return true; |
| 1042 |
} |
| 1043 |
} |
| 1044 |
|
| 1045 |
struct Wrap10595 |
| 1046 |
{ |
| 1047 |
int i; |
| 1048 |
alias i this; |
| 1049 |
S10595 s; |
| 1050 |
} |
| 1051 |
|
| 1052 |
void test10595() |
| 1053 |
{ |
| 1054 |
{ |
| 1055 |
Wrap10595[int] wrap; |
| 1056 |
|
| 1057 |
wrap[0] = Wrap10595(); |
| 1058 |
wrap[0].i = 0; |
| 1059 |
|
| 1060 |
assert(wrap[0].s.test()); // ok |
| 1061 |
} |
| 1062 |
|
| 1063 |
{ |
| 1064 |
Wrap10595[int] wrap; |
| 1065 |
|
| 1066 |
wrap[0] = Wrap10595(); |
| 1067 |
|
| 1068 |
assert(wrap[0].s.test()); // failure |
| 1069 |
} |
| 1070 |
} |
| 1071 |
|
| 1072 |
/************************************************/ |
| 1073 |
// https://issues.dlang.org/show_bug.cgi?id=10970 |
| 1074 |
|
| 1075 |
struct RefCounted10970(T) //if (!is(T == class)) |
| 1076 |
{ |
| 1077 |
struct RefCountedStore |
| 1078 |
{ |
| 1079 |
} |
| 1080 |
RefCountedStore _refCounted; |
| 1081 |
|
| 1082 |
this(this) {} |
| 1083 |
|
| 1084 |
~this() {} |
| 1085 |
} |
| 1086 |
|
| 1087 |
struct Array10970(T) if (!is(T : const(bool))) |
| 1088 |
{ |
| 1089 |
struct Payload |
| 1090 |
{ |
| 1091 |
} |
| 1092 |
RefCounted10970!Payload _data; |
| 1093 |
} |
| 1094 |
|
| 1095 |
class C10970 |
| 1096 |
{ |
| 1097 |
this(string name) |
| 1098 |
{ |
| 1099 |
m[name] = Arr(); |
| 1100 |
} |
| 1101 |
|
| 1102 |
alias Array10970!C10970 Arr; |
| 1103 |
Arr[string] m; |
| 1104 |
} |
| 1105 |
|
| 1106 |
void test10970() |
| 1107 |
{ |
| 1108 |
C10970 c = new C10970("test"); |
| 1109 |
} |
| 1110 |
|
| 1111 |
/************************************************/ |
| 1112 |
// https://issues.dlang.org/show_bug.cgi?id=6433 |
| 1113 |
|
| 1114 |
void test6433() |
| 1115 |
{ |
| 1116 |
int[int] aa; |
| 1117 |
static assert(aa.sizeof != 0); |
| 1118 |
static assert(aa.alignof != 0); |
| 1119 |
static assert(is(typeof(aa.init) == int[int])); |
| 1120 |
static assert(typeof(aa).mangleof == "Hii"); |
| 1121 |
static assert(typeof(aa).stringof == "int[int]"); |
| 1122 |
static struct AA { int[int] aa; } |
| 1123 |
static assert(AA.aa.offsetof == 0); |
| 1124 |
|
| 1125 |
aa = aa.init; |
| 1126 |
aa[0] = 1; |
| 1127 |
assert(aa.length == 1 && aa[0] == 1); |
| 1128 |
} |
| 1129 |
|
| 1130 |
/************************************************/ |
| 1131 |
// https://issues.dlang.org/show_bug.cgi?id=6612 |
| 1132 |
|
| 1133 |
void test6612() |
| 1134 |
{ |
| 1135 |
auto aa1 = [1: 2]; // OK |
| 1136 |
auto aa2 = [4: 5]; // OK |
| 1137 |
int[int[int]] aa3 = [aa1:3, aa2:6]; // OK |
| 1138 |
int[int[int]] aa4 = [[1:2]:3, [4:5]:6]; // error |
| 1139 |
int[int[string]] aa5 = [["a":1]:2, ["b":3]:4]; |
| 1140 |
} |
| 1141 |
|
| 1142 |
/************************************************/ |
| 1143 |
// https://issues.dlang.org/show_bug.cgi?id=7365 |
| 1144 |
|
| 1145 |
struct TickDuration |
| 1146 |
{ |
| 1147 |
bool opEquals(ref const TickDuration rhs) const |
| 1148 |
{ |
| 1149 |
return true; |
| 1150 |
} |
| 1151 |
} |
| 1152 |
|
| 1153 |
void test7365() |
| 1154 |
{ |
| 1155 |
TickDuration[Object] aa; |
| 1156 |
aa.keys; |
| 1157 |
} |
| 1158 |
|
| 1159 |
/************************************************/ |
| 1160 |
|
| 1161 |
enum aa5520 = [5 : "hello"]; |
| 1162 |
|
| 1163 |
void test5520() |
| 1164 |
{ |
| 1165 |
auto a = aa5520.values; |
| 1166 |
} |
| 1167 |
|
| 1168 |
/************************************************/ |
| 1169 |
|
| 1170 |
enum size_t N6655 = 1; |
| 1171 |
int[bar6655.length] foo6655; |
| 1172 |
int[N6655] bar6655; |
| 1173 |
|
| 1174 |
/************************************************/ |
| 1175 |
|
| 1176 |
struct ChunkLoc {} |
| 1177 |
|
| 1178 |
ChunkLoc Get() |
| 1179 |
{ |
| 1180 |
return ChunkLoc(); |
| 1181 |
} |
| 1182 |
|
| 1183 |
void test6799() |
| 1184 |
{ |
| 1185 |
int[ChunkLoc] aa; |
| 1186 |
aa.remove(Get()); |
| 1187 |
} |
| 1188 |
|
| 1189 |
/************************************************/ |
| 1190 |
// https://issues.dlang.org/show_bug.cgi?id=11359 |
| 1191 |
|
| 1192 |
void test11359() |
| 1193 |
{ |
| 1194 |
class Bar {} |
| 1195 |
static Bar[string] aa; |
| 1196 |
static ref fun() { return aa; } |
| 1197 |
|
| 1198 |
string key = "test"; |
| 1199 |
|
| 1200 |
fun[key] = new Bar; |
| 1201 |
assert(aa.length == 1); |
| 1202 |
Bar bar = fun[key]; |
| 1203 |
} |
| 1204 |
|
| 1205 |
/************************************************/ |
| 1206 |
// https://issues.dlang.org/show_bug.cgi?id=11730 |
| 1207 |
|
| 1208 |
struct SysTime11730 |
| 1209 |
{ |
| 1210 |
ref SysTime11730 opAssign(SysTime11730 rhs) |
| 1211 |
{ |
| 1212 |
assert(0); |
| 1213 |
} |
| 1214 |
} |
| 1215 |
|
| 1216 |
struct Nullable11730(T) |
| 1217 |
{ |
| 1218 |
T _value; |
| 1219 |
|
| 1220 |
void opAssign()(T value) |
| 1221 |
{ |
| 1222 |
assert(0); |
| 1223 |
} |
| 1224 |
|
| 1225 |
@property ref inout(T) get() inout |
| 1226 |
{ |
| 1227 |
assert(0); |
| 1228 |
} |
| 1229 |
alias get this; |
| 1230 |
} |
| 1231 |
|
| 1232 |
void test11730() |
| 1233 |
{ |
| 1234 |
Nullable11730!SysTime11730[string] map; |
| 1235 |
map["foo"] = Nullable11730!SysTime11730(); |
| 1236 |
} |
| 1237 |
|
| 1238 |
/************************************************/ |
| 1239 |
// https://issues.dlang.org/show_bug.cgi?id=14089 |
| 1240 |
|
| 1241 |
struct S14089 |
| 1242 |
{ |
| 1243 |
int num; |
| 1244 |
S14089 opAssign(S14089 val) { return this; } |
| 1245 |
} |
| 1246 |
|
| 1247 |
void test14089() |
| 1248 |
{ |
| 1249 |
S14089[int] aa; |
| 1250 |
S14089 b = aa[1] = S14089(0); |
| 1251 |
assert(aa[1].num == 0); |
| 1252 |
assert(b.num == 0); |
| 1253 |
} |
| 1254 |
|
| 1255 |
/************************************************/ |
| 1256 |
// https://issues.dlang.org/show_bug.cgi?id=14144 |
| 1257 |
|
| 1258 |
struct JSON14144 |
| 1259 |
{ |
| 1260 |
union |
| 1261 |
{ |
| 1262 |
double _floating; |
| 1263 |
} |
| 1264 |
|
| 1265 |
this(typeof(null)) |
| 1266 |
{ |
| 1267 |
} |
| 1268 |
|
| 1269 |
@trusted pure nothrow typeof(null) opAssign(typeof(null) nothing) |
| 1270 |
{ |
| 1271 |
return null; |
| 1272 |
} |
| 1273 |
} |
| 1274 |
|
| 1275 |
void test14144() |
| 1276 |
{ |
| 1277 |
JSON14144[string] x; |
| 1278 |
x["wat"] = null; |
| 1279 |
assert(x.length == 1); |
| 1280 |
assert("wat" in x); |
| 1281 |
} |
| 1282 |
|
| 1283 |
/************************************************/ |
| 1284 |
// https://issues.dlang.org/show_bug.cgi?id=14321 |
| 1285 |
|
| 1286 |
void test14321() |
| 1287 |
{ |
| 1288 |
struct Foo |
| 1289 |
{ |
| 1290 |
static char[8] buf; |
| 1291 |
static char[] op; |
| 1292 |
|
| 1293 |
this(int id) { buf[op.length] = 'c'; op = buf[0..op.length + 1]; } |
| 1294 |
this(this) { buf[op.length] = 'p'; op = buf[0..op.length + 1]; } |
| 1295 |
~this() { buf[op.length] = 'd'; op = buf[0..op.length + 1]; } |
| 1296 |
} |
| 1297 |
Foo[string] foos; |
| 1298 |
assert(Foo.op == ""); |
| 1299 |
foos["test"] = Foo(42); // initialization |
| 1300 |
assert(Foo.op == "c"); |
| 1301 |
foos["test"] = Foo(42); // assignment |
| 1302 |
assert(Foo.op == "ccd"); |
| 1303 |
|
| 1304 |
struct Bar |
| 1305 |
{ |
| 1306 |
static char[8] buf; |
| 1307 |
static char[] op; |
| 1308 |
|
| 1309 |
int id; |
| 1310 |
//this(int id) { op ~= "c"; } |
| 1311 |
this(this) { buf[op.length] = 'p'; op = buf[0..op.length + 1]; } |
| 1312 |
~this() { buf[op.length] = 'd'; op = buf[0..op.length + 1]; } |
| 1313 |
} |
| 1314 |
Bar[string] bars; |
| 1315 |
assert(Bar.op == ""); |
| 1316 |
bars["test"] = Bar(42); // initialization |
| 1317 |
assert(Bar.op == ""); |
| 1318 |
bars["test"] = Bar(42); // assignment |
| 1319 |
assert(Bar.op == "d"); |
| 1320 |
} |
| 1321 |
|
| 1322 |
/************************************************/ |
| 1323 |
// https://issues.dlang.org/show_bug.cgi?id=19112 |
| 1324 |
|
| 1325 |
void test19112() |
| 1326 |
{ |
| 1327 |
int[int[1]] aa; |
| 1328 |
aa[[2]] = 1; |
| 1329 |
assert([2] in aa); |
| 1330 |
|
| 1331 |
int[int[]] aa2 = [[1, 2, 3]: 4]; |
| 1332 |
int[3] k = [1, 2, 3]; |
| 1333 |
assert(*(k in aa2) == 4); |
| 1334 |
} |
| 1335 |
|
| 1336 |
/************************************************/ |
| 1337 |
|
| 1338 |
int main() |
| 1339 |
{ |
| 1340 |
printf("before test 1\n"); test1(); |
| 1341 |
printf("before test 2\n"); test2(); |
| 1342 |
printf("before test 4\n"); test4(); |
| 1343 |
printf("before test 5\n"); test5(); |
| 1344 |
printf("before test 6\n"); test6(); |
| 1345 |
printf("before test 7\n"); test7(); |
| 1346 |
printf("before test 8\n"); test8(); |
| 1347 |
printf("before test 9\n"); test9(); |
| 1348 |
printf("before test 10\n"); test10(); |
| 1349 |
printf("before test 11\n"); test11(); |
| 1350 |
printf("before test 12\n"); test12(); |
| 1351 |
printf("before test 13\n"); test13(); |
| 1352 |
printf("before test 14\n"); test14(); |
| 1353 |
printf("before test 15\n"); test15(); |
| 1354 |
printf("before test 16\n"); test16(); |
| 1355 |
printf("before test 17\n"); test17(); |
| 1356 |
printf("before test 18\n"); test18(); |
| 1357 |
printf("before test 19\n"); test19(); |
| 1358 |
printf("before test 20\n"); test20(); |
| 1359 |
printf("before test 21\n"); test21(); |
| 1360 |
printf("before test 22\n"); test22(); |
| 1361 |
printf("before test 23\n"); test23(); |
| 1362 |
printf("before test 24\n"); test24(); |
| 1363 |
printf("before test 25\n"); test25(); |
| 1364 |
printf("before test 26\n"); test26(); |
| 1365 |
printf("before test 27\n"); test27(); |
| 1366 |
printf("before test 28\n"); test28(); |
| 1367 |
printf("before test 29\n"); test29(); |
| 1368 |
printf("before test 30\n"); test30(); |
| 1369 |
printf("before test 31\n"); test31(); |
| 1370 |
printf("before test 32\n"); test32(); |
| 1371 |
|
| 1372 |
test4826c(); |
| 1373 |
test5131(); |
| 1374 |
test6178(); |
| 1375 |
test6178x(); |
| 1376 |
test10595(); |
| 1377 |
test10970(); |
| 1378 |
test6433(); |
| 1379 |
test6612(); |
| 1380 |
test7365(); |
| 1381 |
test5520(); |
| 1382 |
test6799(); |
| 1383 |
test11359(); |
| 1384 |
test11730(); |
| 1385 |
test14089(); |
| 1386 |
test14321(); |
| 1387 |
test19112(); |
| 1388 |
|
| 1389 |
printf("Success\n"); |
| 1390 |
return 0; |
| 1391 |
} |