annotate tests/mini/arrays8.d @ 1651:cb960b882ca3 tip

bindings were moved to dsource.org/projects/bindings/
author Moritz Warning <moritzwarning@web.de>
date Thu, 20 May 2010 20:05:03 +0200
parents 1bb99290e03a
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 }