From 42e1cb7ee0287e51dd50ba96640c38e76af3ad0f Mon Sep 17 00:00:00 2001 From: Uwe Schindler Date: Fri, 13 Sep 2013 09:04:46 +0000 Subject: [PATCH] LUCENE-5207: Add missing test for atan2 including funny values (+/-0). The original patch had a bug with this method, because the arity was wrong. git-svn-id: https://svn.apache.org/repos/asf/lucene/dev/branches/lucene5207@1522822 13f79535-47bb-0310-9956-ffa450edef68 --- .../lucene/expressions/js/TestJavascriptFunction.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lucene/expressions/src/test/org/apache/lucene/expressions/js/TestJavascriptFunction.java b/lucene/expressions/src/test/org/apache/lucene/expressions/js/TestJavascriptFunction.java index aa19fc248c7..b867808cacc 100644 --- a/lucene/expressions/src/test/org/apache/lucene/expressions/js/TestJavascriptFunction.java +++ b/lucene/expressions/src/test/org/apache/lucene/expressions/js/TestJavascriptFunction.java @@ -86,6 +86,17 @@ public class TestJavascriptFunction extends LuceneTestCase { assertEvaluatesTo("atan(1.732050808)", Math.PI/3); } + public void testAtan2Method() throws Exception { + assertEvaluatesTo("atan2(+0,+0)", +0.0); + assertEvaluatesTo("atan2(+0,-0)", +Math.PI); + assertEvaluatesTo("atan2(-0,+0)", -0.0); + assertEvaluatesTo("atan2(-0,-0)", -Math.PI); + assertEvaluatesTo("atan2(2,2)", Math.PI/4); + assertEvaluatesTo("atan2(-2,2)", -Math.PI/4); + assertEvaluatesTo("atan2(2,-2)", Math.PI*3/4); + assertEvaluatesTo("atan2(-2,-2)", -Math.PI*3/4); + } + public void testAtanhMethod() throws Exception { assertEvaluatesTo("atanh(-1)", Double.NEGATIVE_INFINITY); assertEvaluatesTo("atanh(-0.5)", -0.5493061443340549);