• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 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/*
17 * @tc.name: internstring
18 * @tc.desc: Test internstring fast check is number or not
19 * @tc.type: FUNC
20 */
21{
22    let REGISTRY = Symbol();
23    function System() {
24      this[REGISTRY] = {};
25    }
26
27    function SetAndPrintLoad(loader, id) {
28      let load = loader[REGISTRY][id];
29      print("id: " + id + " - load: "+ load);
30      if (loader[REGISTRY][id] == undefined) {
31          loader[REGISTRY][id] = id;
32      } else {
33          loader[REGISTRY][id] = undefined;
34      }
35    }
36
37    let keyArray = ["12345678", "1234567891", "9999999999", "135", "0", "abc", "cba",
38                    "12345678", "1234567891", "9999999999", "135", "0", "abc", "cba"];
39
40    let system = new System();
41    for (let T = 0; T < 2; T++) {
42        for (let i = 0; i < keyArray.length; i++) {
43            SetAndPrintLoad(system, keyArray[i]);
44        }
45    }
46}