Return-Path: Delivered-To: apmail-commons-commits-archive@minotaur.apache.org Received: (qmail 38286 invoked from network); 3 Feb 2011 22:45:28 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.3) by minotaur.apache.org with SMTP; 3 Feb 2011 22:45:28 -0000 Received: (qmail 78230 invoked by uid 500); 3 Feb 2011 22:45:28 -0000 Delivered-To: apmail-commons-commits-archive@commons.apache.org Received: (qmail 78036 invoked by uid 500); 3 Feb 2011 22:45:27 -0000 Mailing-List: contact commits-help@commons.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@commons.apache.org Delivered-To: mailing list commits@commons.apache.org Received: (qmail 78029 invoked by uid 99); 3 Feb 2011 22:45:27 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Feb 2011 22:45:27 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Feb 2011 22:45:26 +0000 Received: by eris.apache.org (Postfix, from userid 65534) id 6C7B52388A64; Thu, 3 Feb 2011 22:45:06 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1067018 - /commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/function/StepFunctionTest.java Date: Thu, 03 Feb 2011 22:45:06 -0000 To: commits@commons.apache.org From: erans@apache.org X-Mailer: svnmailer-1.0.8 Message-Id: <20110203224506.6C7B52388A64@eris.apache.org> Author: erans Date: Thu Feb 3 22:45:06 2011 New Revision: 1067018 URL: http://svn.apache.org/viewvc?rev=1067018&view=rev Log: Another unit test. Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/function/StepFunctionTest.java Modified: commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/function/StepFunctionTest.java URL: http://svn.apache.org/viewvc/commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/function/StepFunctionTest.java?rev=1067018&r1=1067017&r2=1067018&view=diff ============================================================================== --- commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/function/StepFunctionTest.java (original) +++ commons/proper/math/trunk/src/test/java/org/apache/commons/math/analysis/function/StepFunctionTest.java Thu Feb 3 22:45:06 2011 @@ -78,4 +78,18 @@ public class StepFunctionTest { Assert.assertEquals(51.2, f.value(30), EPS); Assert.assertEquals(51.2, f.value(Double.POSITIVE_INFINITY), EPS); } + + @Test + public void testHeaviside() { + final UnivariateRealFunction h = new StepFunction(new double[] {-1, 0}, + new double[] {0, 1}); + + Assert.assertEquals(0, h.value(Double.NEGATIVE_INFINITY), 0); + Assert.assertEquals(0, h.value(-Double.MAX_VALUE), 0); + Assert.assertEquals(0, h.value(-2), 0); + Assert.assertEquals(0, h.value(-Double.MIN_VALUE), 0); + Assert.assertEquals(1, h.value(0), 0); + Assert.assertEquals(1, h.value(2), 0); + Assert.assertEquals(1, h.value(Double.POSITIVE_INFINITY), 0); + } }