Mercurial > projects > ldc
comparison tests/mini/arrays8.d @ 341:1bb99290e03a trunk
[svn r362] Started merging the old 'test' dir as well as the newer 'tangotests' dir into 'tests/mini' and 'tests/minicomplex'.
author | lindquist |
---|---|
date | Sun, 13 Jul 2008 02:51:19 +0200 |
parents | test/arrays8.d@c44e6a711885 |
children |
comparison
equal
deleted
inserted
replaced
340:351c0077d0b3 | 341:1bb99290e03a |
---|---|
1 module arrays8; | |
2 | |
3 extern(C) int printf(char*, ...); | |
4 | |
5 void main() | |
6 { | |
7 char[] a = "hello "; | |
8 printf(" \"%s\".length = %u\n", a.ptr, a.length); | |
9 char[] b = "world"; | |
10 printf(" \"%s\".length = %u\n", b.ptr, b.length); | |
11 char[] c = a ~ b; | |
12 printf("After 'a ~ b':\n"); | |
13 printf(" \"%.*s\".length = %u\n", a.length, a.ptr, a.length); | |
14 printf(" \"%.*s\".length = %u\n", b.length, b.ptr, b.length); | |
15 printf(" \"%.*s\".length = %u\n", c.length, c.ptr, c.length); | |
16 assert(c.length == a.length + b.length); | |
17 assert(c !is a); | |
18 assert(c !is b); | |
19 } |