OSDN Git Service

add test case for use_network option
[happyabc/happyabc.git] / link / compactTest.ml
1 open Base
2 open OUnit
3 open Swflib.AbcType
4
5 open EmptyAbc
6 open Compact
7
8 let ok ?msg x y =
9   assert_equal ?msg ~printer:Std.dump x (compact y)
10
11 let cp xs = {abc with cpool=xs}
12
13 let _ = begin "uniq.ml" >::: [
14   "id" >:: begin fun () ->
15     ok abc abc
16   end;
17   "cpool" >:: begin fun () ->
18     ok ~msg:"int"    (cp {cpool with int   =[2;1]}) (cp {cpool with int=[1;2;1]});
19     ok ~msg:"uint"   (cp {cpool with uint  =[2;1]}) (cp {cpool with uint=[1;2;1]});
20     ok ~msg:"double" (cp {cpool with double=[2.;1.]}) (cp {cpool with double=[1.;2.;1.]});
21     ok ~msg:"str"    (cp {cpool with string=["bar";"foo"]}) (cp {cpool with string=["foo";"bar";"foo"]});
22     ok ~msg:"ns"
23       (cp {cpool with
24              string=["bar";"foo"];
25              namespace=[Namespace 2]})
26       (cp {cpool with
27              string=["foo";"bar";"foo"];
28              namespace=[Namespace 1; Namespace 3]});
29     ok ~msg:"nss"
30       (cp {cpool with
31              string=["bar";"foo"];
32              namespace=[Namespace 2];
33              namespace_set=[[1]];})
34       (cp {cpool with
35              string=["foo";"bar";"foo"];
36              namespace=[Namespace 1; Namespace 3];
37              namespace_set=[[1];[2]]});
38     ok ~msg:"multiname"
39       (cp {cpool with
40              string=["bar";"foo"];
41              namespace=[Namespace 2];
42              multiname= [QName(1,2)];})
43       (cp {cpool with
44              string=["foo";"bar";"foo"];
45              namespace=[Namespace 1; Namespace 3];
46              multiname= [QName(1,1); QName(2,3)]})
47   end;
48   "multiname" >:: begin fun () ->
49     ok
50       {abc with
51          cpool = {cpool with
52                     string        = ["foo";"bar"];
53                     namespace     = [Namespace 1];
54                     multiname     = [QName(1,1)];
55                  };
56          method_info = [{info with method_name=1}] }
57       {abc with
58          cpool = {cpool with
59                     string        = ["foo";"bar"];
60                     namespace     = [Namespace 1];
61                     multiname     = [QName(1,1); QName(1,1)];
62                  };
63          method_info = [{info with method_name=2}] }
64   end;
65   "zero" >:: begin fun () ->
66     ok
67       {abc with
68          cpool = {cpool with
69                     string        = ["foo";"bar"];
70                     namespace     = [Namespace 1];
71                     multiname     = [QName(1,1)];
72                  };
73          method_info = [{info with method_name=0}] }
74       {abc with
75          cpool = {cpool with
76                     string        = ["foo";"bar"];
77                     namespace     = [Namespace 1];
78                     multiname     = [QName(1,1); QName(1,1)];
79                  };
80          method_info = [{info with method_name=0}] }
81   end;
82 ] end +> run_test_tt_main
83