"cond ? yes : no" to "yes if cond else no"
[delight/core.git] / phobos / unittest.d
blob0e43eee8ab6c30835d5266baf4809c468a516c97
2 /*
3 * Copyright (C) 1999-2006 by Digital Mars, www.digitalmars.com
4 * Written by Walter Bright
6 * This software is provided 'as-is', without any express or implied
7 * warranty. In no event will the authors be held liable for any damages
8 * arising from the use of this software.
10 * Permission is granted to anyone to use this software for any purpose,
11 * including commercial applications, and to alter it and redistribute it
12 * freely, in both source and binary form, subject to the following
13 * restrictions:
15 * o The origin of this software must not be misrepresented; you must not
16 * claim that you wrote the original software. If you use this software
17 * in a product, an acknowledgment in the product documentation would be
18 * appreciated but is not required.
19 * o Altered source versions must be plainly marked as such, and must not
20 * be misrepresented as being the original software.
21 * o This notice may not be removed or altered from any source
22 * distribution.
25 // This test program pulls in all the library modules in order
26 // to run the unit tests on them.
27 // Then, it prints out the arguments passed to main().
29 import std.c.stdio;
30 import std.string;
31 import std.path;
32 import std.math;
33 import std.math2;
34 import std.outbuffer;
35 import std.ctype;
36 import std.regexp;
37 import std.random;
38 import std.date;
39 import std.dateparse;
40 import std.demangle;
41 import std.cstream;
42 import std.stream;
43 import std.utf;
44 import std.uri;
45 import std.zlib;
46 import std.md5;
47 import std.stdio;
48 import std.conv;
49 import std.boxer;
50 import std.bitarray;
51 import std.uni;
52 import std.file;
53 import std.signals;
54 import std.cpuid;
55 import std.socket;
57 int main(char[][] args)
60 // Bring in unit test for module by referencing function in it
62 cmp("foo", "bar"); // string
63 printf("test1\n");
64 fncharmatch('a', 'b'); // path
65 isnan(1.0); // math
66 std.math2.feq(1.0, 2.0); // math2
67 std.conv.toDouble("1.0"); // std.conv
68 printf("test1\n");
69 OutBuffer b = new OutBuffer(); // outbuffer
70 std.ctype.tolower('A'); // ctype
71 RegExp r = new RegExp(null, null); // regexp
72 std.random.rand();
73 printf("test2\n");
74 int a[];
75 a.reverse; // adi
76 a.sort; // qsort
77 std.date.getUTCtime(); // date
78 Exception e = new ReadException(""); // stream
79 din.eof(); // cstream
80 isValidDchar(cast(dchar)0); // utf
81 std.uri.ascii2hex(0); // uri
82 std.zlib.adler32(0,null); // D.zlib
84 ubyte[16] buf;
85 std.md5.sum(buf,"");
87 writefln("hello world!"); // std.format
89 Box abox;
91 creal c = 3.0 + 4.0i;
92 c = sqrt(c);
93 printf("re = %Lg, im = %Lg\n", c.re, c.im);
96 printf("hello world\n");
97 printf("args.length = %d\n", args.length);
98 for (int i = 0; i < args.length; i++)
99 printf("args[%d] = '%s'\n", i, cast(char *)args[i]);
101 int[3] x;
102 x[0] = 3;
103 x[1] = 45;
104 x[2] = -1;
105 x.sort;
107 std.math.tgamma(3);
108 std.math.lgamma(3);
110 std.demangle.demangle("hello");
112 BitArray ba; // std.bitarray
113 ba.length = 3;
114 ba[0] = true;
116 std.uni.isUniAlpha('A');
118 std.file.exists("foo");
120 foreach_reverse (dchar d; "hello"c) { ; }
121 foreach_reverse (k, dchar d; "hello"c) { ; }
123 std.signals.linkin();
125 writefln(std.cpuid.toString());
127 printf("Success!\n");
128 return 0;