From eed21966d4a242a98866392471ba9621c70c2f63 Mon Sep 17 00:00:00 2001 From: Volker Berlin Date: Mon, 15 Jul 2019 21:18:39 +0200 Subject: [PATCH] tests for round(double) --- .../jwebassembly/runtime/MathAPI.java | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/test/de/inetsoftware/jwebassembly/runtime/MathAPI.java b/test/de/inetsoftware/jwebassembly/runtime/MathAPI.java index 15ac05f..50cb50b 100644 --- a/test/de/inetsoftware/jwebassembly/runtime/MathAPI.java +++ b/test/de/inetsoftware/jwebassembly/runtime/MathAPI.java @@ -65,8 +65,10 @@ public class MathAPI extends AbstractBaseTest { addParam( list, script, "rint8_5" ); addParam( list, script, "atan2_5_5" ); addParam( list, script, "pow3_4" ); - addParam( list, script, "round3_5" ); - addParam( list, script, "round_3_5" ); + addParam( list, script, "roundF3_5" ); + addParam( list, script, "roundF_3_5" ); + addParam( list, script, "roundD3_8" ); + addParam( list, script, "roundD_3_8" ); } rule.setTestParameters( list ); return list; @@ -195,13 +197,25 @@ public class MathAPI extends AbstractBaseTest { } @Export - static int round3_5() { + static int roundF3_5() { return Math.round( 3.5F ); } @Export - static double round_3_5() { + static int roundF_3_5() { return Math.round( -3.5F ); } + + @Export + static int roundD3_8() { + // SpiderMonkey does not support BigInt currently + return (int)Math.round( 3.8 ); + } + + @Export + static int roundD_3_8() { + // SpiderMonkey does not support BigInt currently + return (int)Math.round( -3.8 ); + } } }