• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/usr/bin/env ruby
2# Copyright (c) 2021-2025 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
15class NumberTypeDescription
16    def initialize(name, min, max, sum)
17        @name, @min, @max, @sum = name, min, max, sum
18    end
19
20    def getName
21        @name
22    end
23
24    def getMin
25        @min
26    end
27
28    def getMax
29        @max
30    end
31
32    def getSum
33        @sum
34    end
35end
36
37@integral_primitives = [
38    NumberTypeDescription.new("byte", -128, 127, -128 + 127),
39    NumberTypeDescription.new("short", -32768, 32767, -32768 + 32767),
40    NumberTypeDescription.new("int", -2147483648, 2147483647, -2147483648 + 2147483647),
41    # double-long precision loss
42    # NumberTypeDescription.new("long", -9223372036854775808, 9223372036854775, 0),
43    NumberTypeDescription.new("long", -9223372036854775, 9223372036854775, -9223372036854775 + 9223372036854775),
44    # char will map to string when pass to dynamic world
45    # NumberTypeDescription.new("char", 0, 65535, 0 + 65535),
46]
47
48@float_primitives = [
49    NumberTypeDescription.new("float", 0.111, 2.71, 0.111 + 2.71),
50    NumberTypeDescription.new("double", 0.01, 3.14, 0.01 + 3.14),
51]
52