Scan dynamic libraries for GC roots
[delight/core.git] / phobos2 / unittest.d
blobe08611d844a4b3d8d61601f4444e7ae675f7285c
1 /*
2 * Copyright (C) 1999-2006 by Digital Mars, www.digitalmars.com
3 * Written by Walter Bright
5 * This software is provided 'as-is', without any express or implied
6 * warranty. In no event will the authors be held liable for any damages
7 * arising from the use of this software.
9 * Permission is granted to anyone to use this software for any purpose,
10 * including commercial applications, and to alter it and redistribute it
11 * freely, in both source and binary form, subject to the following
12 * restrictions:
14 * o The origin of this software must not be misrepresented; you must not
15 * claim that you wrote the original software. If you use this software
16 * in a product, an acknowledgment in the product documentation would be
17 * appreciated but is not required.
18 * o Altered source versions must be plainly marked as such, and must not
19 * be misrepresented as being the original software.
20 * o This notice may not be removed or altered from any source
21 * distribution.
24 // This test program pulls in all the library modules in order
25 // to run the unit tests on them.
26 // Then, it prints out the arguments passed to main().
28 public import std.array;
29 public import std.asserterror;
30 public import std.base64;
31 public import std.bind;
32 public import std.bitarray;
33 public import std.boxer;
34 public import std.compiler;
35 public import std.contracts;
36 public import std.conv;
37 public import std.cover;
38 public import std.cpuid;
39 public import std.cstream;
40 public import std.ctype;
41 public import std.date;
42 public import std.dateparse;
43 public import std.demangle;
44 public import std.file;
45 public import std.format;
46 public import std.gc;
47 public import std.getopt;
48 public import std.hiddenfunc;
49 public import std.intrinsic;
50 public import std.loader;
51 public import std.math;
52 public import std.md5;
53 public import std.metastrings;
54 public import std.mmfile;
55 public import std.moduleinit;
56 public import std.openrj;
57 public import std.outbuffer;
58 public import std.outofmemory;
59 public import std.path;
60 public import std.perf;
61 public import std.process;
62 public import std.random;
63 public import std.regexp;
64 public import std.signals;
65 //public import std.slist;
66 public import std.socket;
67 public import std.socketstream;
68 public import std.stdint;
69 public import std.stdio;
70 public import std.stream;
71 public import std.string;
72 public import std.switcherr;
73 public import std.syserror;
74 public import std.system;
75 public import std.thread;
76 public import std.traits;
77 public import std.typetuple;
78 public import std.uni;
79 public import std.uri;
80 public import std.utf;
81 public import std.variant;
82 public import std.zip;
83 public import std.zlib;
85 int main(char[][] args)
87 // Bring in unit test for module by referencing function in it
89 cmp("foo", "bar"); // string
90 fncharmatch('a', 'b'); // path
91 isnan(1.0); // math
92 std.conv.toDouble("1.0"); // std.conv
93 OutBuffer b = new OutBuffer(); // outbuffer
94 std.ctype.tolower('A'); // ctype
95 RegExp r = new RegExp(null, null); // regexp
96 std.random.rand();
97 int a[];
98 a.reverse; // adi
99 a.sort; // qsort
100 std.date.getUTCtime(); // date
101 Exception e = new ReadException(""); // stream
102 din.eof(); // cstream
103 isValidDchar(cast(dchar)0); // utf
104 std.uri.ascii2hex(0); // uri
105 std.zlib.adler32(0,null); // D.zlib
107 ubyte[16] buf;
108 std.md5.sum(buf,"");
110 Box abox;
112 creal c = 3.0 + 4.0i;
113 c = sqrt(c);
114 assert(c.re == 2);
115 assert(c.im == 1);
117 printf("args.length = %d\n", args.length);
118 for (int i = 0; i < args.length; i++)
119 printf("args[%d] = '%s'\n", i, cast(char *)args[i]);
121 int[3] x;
122 x[0] = 3;
123 x[1] = 45;
124 x[2] = -1;
125 x.sort;
126 assert(x[0] == -1);
127 assert(x[1] == 3);
128 assert(x[2] == 45);
130 std.math.tgamma(3);
131 std.math.lgamma(3);
133 std.demangle.demangle("hello");
135 BitArray ba; // std.bitarray
136 ba.length = 3;
137 ba[0] = true;
139 std.uni.isUniAlpha('A');
141 std.file.exists("foo");
143 foreach_reverse (dchar d; "hello"c) { ; }
144 foreach_reverse (k, dchar d; "hello"c) { ; }
146 std.signals.linkin();
148 writefln(std.cpuid.toString());
150 printf("Success!\n");
151 return 0;