|
1 /* $Id$ */ |
|
2 |
|
3 static int TestBlob1(bool silent) |
|
4 { |
|
5 typedef CBlobT<int64> Blob; |
|
6 int res = 0; |
|
7 { |
|
8 Blob a; |
|
9 Blob b; |
|
10 CHECK_INT(0, a.IsEmpty(), true); |
|
11 CHECK_INT(1, a.Size(), 0); |
|
12 |
|
13 const int nItems = 10; |
|
14 |
|
15 { |
|
16 for (int i = 1; i <= nItems; i++) { |
|
17 a.Append(i); |
|
18 CHECK_INT(2, a.IsEmpty(), false); |
|
19 CHECK_INT(3, a.Size(), i); |
|
20 } |
|
21 } |
|
22 |
|
23 { |
|
24 for (int i = 1; i <= nItems; i++) { |
|
25 CHECK_INT(4, *a.Data(i - 1), i); |
|
26 } |
|
27 } |
|
28 } |
|
29 return res; |
|
30 } |
|
31 |
|
32 static int TestBlob2(bool silent) |
|
33 { |
|
34 typedef CBlobT<CFsaItem> Blob; |
|
35 int res = 0; |
|
36 { |
|
37 Blob a; |
|
38 Blob b; |
|
39 CHECK_INT(0, a.IsEmpty(), true); |
|
40 CHECK_INT(1, a.Size(), 0); |
|
41 |
|
42 const int nItems = 10; |
|
43 |
|
44 { |
|
45 for (int i = 1; i <= nItems; i++) { |
|
46 a.Append(CFsaItem(i)); |
|
47 CHECK_INT(2, a.IsEmpty(), false); |
|
48 CHECK_INT(3, a.Size(), i); |
|
49 } |
|
50 } |
|
51 { |
|
52 for (int i = 1; i <= nItems; i++) { |
|
53 CHECK_INT(4, a.Data(i - 1)->i, i); |
|
54 } |
|
55 } |
|
56 CHECK_INT(15, CFsaItem::NumInstances(), nItems); |
|
57 } |
|
58 CHECK_INT(16, CFsaItem::NumInstances(), 0); |
|
59 |
|
60 return res; |
|
61 } |