• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (C) 2022 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16// @ts-ignore
17import {Smaps, SmapsTreeObj} from "../../../dist/trace/bean/SmapsStruct.js";
18
19describe('SmapsStruct Test', () => {
20    it('SmapsStructTest01', function () {
21        let sMaps = new Smaps()
22        sMaps = {
23            tsNS: -1,
24            start_addr: "start_addr",
25            end_addr: "end_addr",
26            permission: "permission",
27            path: "path",
28            size: 0,
29            rss: 0,
30            pss: 0,
31            reside: 0,
32            dirty: 0,
33            swapper: 0,
34            address: "address",
35            type: "type",
36            dirtyStr: "dirtyStr",
37            swapperStr: "swapperStr",
38            rssStr: "rssStr",
39            pssStr: "pssStr",
40            sizeStr: "sizeStr",
41            resideStr: "resideStr"
42        }
43        expect(sMaps).not.toBeUndefined();
44        expect(sMaps).toMatchInlineSnapshot({
45  tsNS: expect.any(Number),
46  start_addr: expect.any(String),
47  end_addr: expect.any(String),
48  permission: expect.any(String),
49  path: expect.any(String),
50  size: expect.any(Number),
51  rss: expect.any(Number),
52  pss: expect.any(Number),
53  reside: expect.any(Number),
54  dirty: expect.any(Number),
55  swapper: expect.any(Number),
56  address: expect.any(String),
57  type: expect.any(String),
58  dirtyStr: expect.any(String),
59  swapperStr: expect.any(String),
60  rssStr: expect.any(String),
61  pssStr: expect.any(String),
62  sizeStr: expect.any(String),
63  resideStr: expect.any(String) }, `
64Object {
65  "address": Any<String>,
66  "dirty": Any<Number>,
67  "dirtyStr": Any<String>,
68  "end_addr": Any<String>,
69  "path": Any<String>,
70  "permission": Any<String>,
71  "pss": Any<Number>,
72  "pssStr": Any<String>,
73  "reside": Any<Number>,
74  "resideStr": Any<String>,
75  "rss": Any<Number>,
76  "rssStr": Any<String>,
77  "size": Any<Number>,
78  "sizeStr": Any<String>,
79  "start_addr": Any<String>,
80  "swapper": Any<Number>,
81  "swapperStr": Any<String>,
82  "tsNS": Any<Number>,
83  "type": Any<String>,
84}
85`)
86    });
87
88    it('SmapsStructTest02', function () {
89        let sMapsTreeObj = new SmapsTreeObj()
90        sMapsTreeObj = {
91            id: "id",
92            pid: "pid",
93            rsspro: 0,
94            rssproStr: "rssproStr",
95            type: "type",
96            reg: 0,
97            regStr: "regStr",
98            path: "path",
99            rss: 0,
100            rssStr: "rssStr",
101            dirty: 0,
102            dirtyStr: "dirtyStr",
103            swapper: 0,
104            swapperStr: "swapperStr",
105            pss: 0,
106            pssStr: "pssStr",
107            size: 0,
108            sizeStr: "sizeStr",
109            respro: 0,
110            resproStr: "resproStr",
111            children: []
112        }
113        expect(sMapsTreeObj).not.toBeUndefined();
114        expect(sMapsTreeObj).toMatchInlineSnapshot({
115  id: expect.any(String),
116  pid: expect.any(String),
117  rsspro: expect.any(Number),
118  rssproStr: expect.any(String),
119  type: expect.any(String),
120  reg: expect.any(Number),
121  regStr: expect.any(String),
122  path: expect.any(String),
123  rss: expect.any(Number),
124  rssStr: expect.any(String),
125  dirty: expect.any(Number),
126  dirtyStr: expect.any(String),
127  swapper: expect.any(Number),
128  swapperStr: expect.any(String),
129  pss: expect.any(Number),
130  pssStr: expect.any(String),
131  size: expect.any(Number),
132  sizeStr: expect.any(String),
133  respro: expect.any(Number),
134  resproStr: expect.any(String),
135  children: expect.any(Array) }, `
136Object {
137  "children": Any<Array>,
138  "dirty": Any<Number>,
139  "dirtyStr": Any<String>,
140  "id": Any<String>,
141  "path": Any<String>,
142  "pid": Any<String>,
143  "pss": Any<Number>,
144  "pssStr": Any<String>,
145  "reg": Any<Number>,
146  "regStr": Any<String>,
147  "respro": Any<Number>,
148  "resproStr": Any<String>,
149  "rss": Any<Number>,
150  "rssStr": Any<String>,
151  "rsspro": Any<Number>,
152  "rssproStr": Any<String>,
153  "size": Any<Number>,
154  "sizeStr": Any<String>,
155  "swapper": Any<Number>,
156  "swapperStr": Any<String>,
157  "type": Any<String>,
158}
159`)
160    });
161})