annotate 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
rev   line source
lindquist@58 1 module arrays8;
lindquist@58 2
lindquist@175 3 extern(C) int printf(char*, ...);
lindquist@175 4
lindquist@58 5 void main()
lindquist@58 6 {
lindquist@58 7 char[] a = "hello ";
lindquist@58 8 printf(" \"%s\".length = %u\n", a.ptr, a.length);
lindquist@58 9 char[] b = "world";
lindquist@58 10 printf(" \"%s\".length = %u\n", b.ptr, b.length);
lindquist@58 11 char[] c = a ~ b;
lindquist@58 12 printf("After 'a ~ b':\n");
lindquist@58 13 printf(" \"%.*s\".length = %u\n", a.length, a.ptr, a.length);
lindquist@58 14 printf(" \"%.*s\".length = %u\n", b.length, b.ptr, b.length);
lindquist@58 15 printf(" \"%.*s\".length = %u\n", c.length, c.ptr, c.length);
lindquist@58 16 assert(c.length == a.length + b.length);
lindquist@58 17 assert(c !is a);
lindquist@58 18 assert(c !is b);
lindquist@58 19 }