]> git.proxmox.com Git - ceph.git/blame - ceph/src/jaegertracing/thrift/lib/delphi/test/typeregistry/TestTypeRegistry.dpr
buildsys: switch source download to quincy
[ceph.git] / ceph / src / jaegertracing / thrift / lib / delphi / test / typeregistry / TestTypeRegistry.dpr
CommitLineData
f67539c2
TL
1(*
2 * Licensed to the Apache Software Foundation (ASF) under one
3 * or more contributor license agreements. See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership. The ASF licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License. You may obtain a copy of the License at
9 *
10 * http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied. See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 *)
19
20program TestTypeRegistry;
21
22{$APPTYPE CONSOLE}
23
24uses
25 Classes, Windows, SysUtils, Generics.Collections, TypInfo,
26 Thrift in '..\..\src\Thrift.pas',
27 Thrift.Transport in '..\..\src\Thrift.Transport.pas',
28 Thrift.Exception in '..\..\src\Thrift.Exception.pas',
29 Thrift.Socket in '..\..\src\Thrift.Socket.pas',
30 Thrift.Protocol in '..\..\src\Thrift.Protocol.pas',
31 Thrift.Protocol.JSON in '..\..\src\Thrift.Protocol.JSON.pas',
32 Thrift.Collections in '..\..\src\Thrift.Collections.pas',
33 Thrift.Server in '..\..\src\Thrift.Server.pas',
34 Thrift.Utils in '..\..\src\Thrift.Utils.pas',
35 Thrift.Serializer in '..\..\src\Thrift.Serializer.pas',
36 Thrift.Stream in '..\..\src\Thrift.Stream.pas',
37 Thrift.WinHTTP in '..\..\src\Thrift.WinHTTP.pas',
38 Thrift.TypeRegistry in '..\..\src\Thrift.TypeRegistry.pas',
39 DebugProtoTest;
40
41type
42 Tester<T : IInterface> = class
43 public
44 class procedure Test;
45 end;
46
47class procedure Tester<T>.Test;
48var instance : T;
49 name : string;
50begin
51 instance := TypeRegistry.Construct<T>;
52 name := GetTypeName(TypeInfo(T));
53 if instance <> nil
54 then Writeln( name, ' = ok')
55 else begin
56 Writeln( name, ' = failed');
57 raise Exception.Create( 'Test with '+name+' failed!');
58 end;
59end;
60
61begin
62 Writeln('Testing ...');
63 Tester<IDoubles>.Test;
64 Tester<IOneOfEach>.Test;
65 Tester<IBonk>.Test;
66 Tester<INesting>.Test;
67 Tester<IHolyMoley>.Test;
68 Tester<IBackwards>.Test;
69 Tester<IEmpty>.Test;
70 Tester<IWrapper>.Test;
71 Tester<IRandomStuff>.Test;
72 Tester<IBase64>.Test;
73 Tester<ICompactProtoTestStruct>.Test;
74 Tester<ISingleMapTestStruct>.Test;
75 Tester<IBlowUp>.Test;
76 Tester<IReverseOrderStruct>.Test;
77 Tester<IStructWithSomeEnum>.Test;
78 Tester<ITestUnion>.Test;
79 Tester<ITestUnionMinusStringField>.Test;
80 Tester<IComparableUnion>.Test;
81 Tester<IStructWithAUnion>.Test;
82 Tester<IPrimitiveThenStruct>.Test;
83 Tester<IStructWithASomemap>.Test;
84 Tester<IBigFieldIdStruct>.Test;
85 Tester<IBreaksRubyCompactProtocol>.Test;
86 Tester<ITupleProtocolTestStruct>.Test;
87 Writeln('Completed.');
88
89
90end.
91