rename js_toint32 -> js_toint in preparation for adding u32/i64/u64 tests
authorJacob Lifshay <programmerjake@gmail.com>
Wed, 17 May 2023 02:07:42 +0000 (19:07 -0700)
committerJacob Lifshay <programmerjake@gmail.com>
Wed, 17 May 2023 02:07:42 +0000 (19:07 -0700)
src/openpower/test/fmv_fcvt/fmv_fcvt.py

index 6759bb6a871bdc7538eba738158e29b710b4c268..3372deeb61eb086ac3b7ed05fda2cc536bf2e02e 100644 (file)
@@ -9,7 +9,7 @@ import math
 
 
 class FMvFCvtCases(TestAccumulatorBase):
-    def js_toint32(self, inp, expected, test_title="", inp_bits=None):
+    def js_toint(self, inp, expected, test_title="", inp_bits=None):
         inp = float(inp)
         if inp_bits is None:
             inp_bits = struct.unpack("<Q", struct.pack("<d", inp))[0]
@@ -76,95 +76,95 @@ class FMvFCvtCases(TestAccumulatorBase):
         # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
         # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-        self.js_toint32(math.inf, 0, "Inf")
-        self.js_toint32(-math.inf, 0, "-Inf")
-        self.js_toint32(math.nan, 0, "NaN")
-        self.js_toint32(math.nan, 0, "SNaN", inp_bits=0x7ff0_0000_0000_0001)
-        self.js_toint32(0.0, 0, "zero")
-        self.js_toint32(-0.0, 0, "-zero")
-        self.js_toint32(min_value, 0)
-        self.js_toint32(-min_value, 0)
-        self.js_toint32(0.1, 0)
-        self.js_toint32(-0.1, 0)
-        self.js_toint32(1, 1, "one")
-        self.js_toint32(1.1, 1, "onepointone")
-        self.js_toint32(-1, -1, "-one")
-        self.js_toint32(0.6, 0, "truncate positive (0.6)")
-        self.js_toint32(1.6, 1, "truncate positive (1.6)")
-        self.js_toint32(-0.6, 0, "truncate negative (-0.6)")
-        self.js_toint32(-1.6, -1, "truncate negative (-1.6)")
-        self.js_toint32(2147483647, 2147483647)
-        self.js_toint32(2147483648, -2147483648)
-        self.js_toint32(2147483649, -2147483647)
-        self.js_toint32(4294967295, -1)
-        self.js_toint32(4294967296, 0)
-        self.js_toint32(4294967297, 1)
-        self.js_toint32(-2147483647, -2147483647)
-        self.js_toint32(-2147483648, -2147483648)
-        self.js_toint32(-2147483649, 2147483647)
-        self.js_toint32(-4294967295, 1)
-        self.js_toint32(-4294967296, 0)
-        self.js_toint32(-4294967297, -1)
-        self.js_toint32(2147483648.25, -2147483648)
-        self.js_toint32(2147483648.5, -2147483648)
-        self.js_toint32(2147483648.75, -2147483648)
-        self.js_toint32(4294967295.25, -1)
-        self.js_toint32(4294967295.5, -1)
-        self.js_toint32(4294967295.75, -1)
-        self.js_toint32(3000000000.25, -1294967296)
-        self.js_toint32(3000000000.5, -1294967296)
-        self.js_toint32(3000000000.75, -1294967296)
-        self.js_toint32(-2147483648.25, -2147483648)
-        self.js_toint32(-2147483648.5, -2147483648)
-        self.js_toint32(-2147483648.75, -2147483648)
-        self.js_toint32(-4294967295.25, 1)
-        self.js_toint32(-4294967295.5, 1)
-        self.js_toint32(-4294967295.75, 1)
-        self.js_toint32(-3000000000.25, 1294967296)
-        self.js_toint32(-3000000000.5, 1294967296)
-        self.js_toint32(-3000000000.75, 1294967296)
+        self.js_toint(math.inf, 0, "Inf")
+        self.js_toint(-math.inf, 0, "-Inf")
+        self.js_toint(math.nan, 0, "NaN")
+        self.js_toint(math.nan, 0, "SNaN", inp_bits=0x7ff0_0000_0000_0001)
+        self.js_toint(0.0, 0, "zero")
+        self.js_toint(-0.0, 0, "-zero")
+        self.js_toint(min_value, 0)
+        self.js_toint(-min_value, 0)
+        self.js_toint(0.1, 0)
+        self.js_toint(-0.1, 0)
+        self.js_toint(1, 1, "one")
+        self.js_toint(1.1, 1, "onepointone")
+        self.js_toint(-1, -1, "-one")
+        self.js_toint(0.6, 0, "truncate positive (0.6)")
+        self.js_toint(1.6, 1, "truncate positive (1.6)")
+        self.js_toint(-0.6, 0, "truncate negative (-0.6)")
+        self.js_toint(-1.6, -1, "truncate negative (-1.6)")
+        self.js_toint(2147483647, 2147483647)
+        self.js_toint(2147483648, -2147483648)
+        self.js_toint(2147483649, -2147483647)
+        self.js_toint(4294967295, -1)
+        self.js_toint(4294967296, 0)
+        self.js_toint(4294967297, 1)
+        self.js_toint(-2147483647, -2147483647)
+        self.js_toint(-2147483648, -2147483648)
+        self.js_toint(-2147483649, 2147483647)
+        self.js_toint(-4294967295, 1)
+        self.js_toint(-4294967296, 0)
+        self.js_toint(-4294967297, -1)
+        self.js_toint(2147483648.25, -2147483648)
+        self.js_toint(2147483648.5, -2147483648)
+        self.js_toint(2147483648.75, -2147483648)
+        self.js_toint(4294967295.25, -1)
+        self.js_toint(4294967295.5, -1)
+        self.js_toint(4294967295.75, -1)
+        self.js_toint(3000000000.25, -1294967296)
+        self.js_toint(3000000000.5, -1294967296)
+        self.js_toint(3000000000.75, -1294967296)
+        self.js_toint(-2147483648.25, -2147483648)
+        self.js_toint(-2147483648.5, -2147483648)
+        self.js_toint(-2147483648.75, -2147483648)
+        self.js_toint(-4294967295.25, 1)
+        self.js_toint(-4294967295.5, 1)
+        self.js_toint(-4294967295.75, 1)
+        self.js_toint(-3000000000.25, 1294967296)
+        self.js_toint(-3000000000.5, 1294967296)
+        self.js_toint(-3000000000.75, 1294967296)
         base = pow(2, 64)
-        self.js_toint32(base + 0, 0)
-        self.js_toint32(base + 1117, 0)
-        self.js_toint32(base + 2234, 4096)
-        self.js_toint32(base + 3351, 4096)
-        self.js_toint32(base + 4468, 4096)
-        self.js_toint32(base + 5585, 4096)
-        self.js_toint32(base + 6702, 8192)
-        self.js_toint32(base + 7819, 8192)
-        self.js_toint32(base + 8936, 8192)
-        self.js_toint32(base + 10053, 8192)
-        self.js_toint32(base + 11170, 12288)
-        self.js_toint32(base + 12287, 12288)
-        self.js_toint32(base + 13404, 12288)
-        self.js_toint32(base + 14521, 16384)
-        self.js_toint32(base + 15638, 16384)
-        self.js_toint32(base + 16755, 16384)
-        self.js_toint32(base + 17872, 16384)
-        self.js_toint32(base + 18989, 20480)
-        self.js_toint32(base + 20106, 20480)
-        self.js_toint32(base + 21223, 20480)
-        self.js_toint32(base + 22340, 20480)
-        self.js_toint32(base + 23457, 24576)
-        self.js_toint32(base + 24574, 24576)
-        self.js_toint32(base + 25691, 24576)
-        self.js_toint32(base + 26808, 28672)
-        self.js_toint32(base + 27925, 28672)
-        self.js_toint32(base + 29042, 28672)
-        self.js_toint32(base + 30159, 28672)
-        self.js_toint32(base + 31276, 32768)
+        self.js_toint(base + 0, 0)
+        self.js_toint(base + 1117, 0)
+        self.js_toint(base + 2234, 4096)
+        self.js_toint(base + 3351, 4096)
+        self.js_toint(base + 4468, 4096)
+        self.js_toint(base + 5585, 4096)
+        self.js_toint(base + 6702, 8192)
+        self.js_toint(base + 7819, 8192)
+        self.js_toint(base + 8936, 8192)
+        self.js_toint(base + 10053, 8192)
+        self.js_toint(base + 11170, 12288)
+        self.js_toint(base + 12287, 12288)
+        self.js_toint(base + 13404, 12288)
+        self.js_toint(base + 14521, 16384)
+        self.js_toint(base + 15638, 16384)
+        self.js_toint(base + 16755, 16384)
+        self.js_toint(base + 17872, 16384)
+        self.js_toint(base + 18989, 20480)
+        self.js_toint(base + 20106, 20480)
+        self.js_toint(base + 21223, 20480)
+        self.js_toint(base + 22340, 20480)
+        self.js_toint(base + 23457, 24576)
+        self.js_toint(base + 24574, 24576)
+        self.js_toint(base + 25691, 24576)
+        self.js_toint(base + 26808, 28672)
+        self.js_toint(base + 27925, 28672)
+        self.js_toint(base + 29042, 28672)
+        self.js_toint(base + 30159, 28672)
+        self.js_toint(base + 31276, 32768)
         # bignum is (2 ^ 53 - 1) * 2 ^ 31 - highest number with bit 31 set.
         bignum = pow(2, 84) - pow(2, 31)
-        self.js_toint32(bignum, -pow(2, 31))
-        self.js_toint32(-bignum, -pow(2, 31))
-        self.js_toint32(2 * bignum, 0)
-        self.js_toint32(-(2 * bignum), 0)
-        self.js_toint32(bignum - pow(2, 31), 0)
-        self.js_toint32(-(bignum - pow(2, 31)), 0)
+        self.js_toint(bignum, -pow(2, 31))
+        self.js_toint(-bignum, -pow(2, 31))
+        self.js_toint(2 * bignum, 0)
+        self.js_toint(-(2 * bignum), 0)
+        self.js_toint(bignum - pow(2, 31), 0)
+        self.js_toint(-(bignum - pow(2, 31)), 0)
         # max_fraction is largest number below 1.
         max_fraction = (1 - pow(2, -53))
-        self.js_toint32(max_fraction, 0)
-        self.js_toint32(-max_fraction, 0)
+        self.js_toint(max_fraction, 0)
+        self.js_toint(-max_fraction, 0)
 
 
 class SVP64FMvFCvtCases(TestAccumulatorBase):