Skip to content

Commit 268a398

Browse files
committed
Fixed issue with arc cosine.
1 parent a617d17 commit 268a398

File tree

1 file changed

+13
-20
lines changed

1 file changed

+13
-20
lines changed

Tests/TraderTest.php

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,6 @@ class TraderTest extends PHPUnit_Framework_TestCase
180180
],
181181
];
182182

183-
/**
184-
* This test proves that two NaNs do not equal.
185-
* Some of the tests below may fail if they return NaN.
186-
*/
187-
public function testPHPUnitAssertEqualsNaN(){
188-
$this->assertEquals(NAN, NAN);
189-
}
190-
191183
//<editor-fold defaultstate="collapsed" desc="Constant Member Tests">
192184
public function testConstants_TRADER_MA_TYPE_SMA()
193185
{
@@ -473,18 +465,14 @@ public function testConstants_TRADER_ERR_UNKNOWN_ERROR()
473465
//<editor-fold defaultstate="collapsed" desc="Interface Function Tests">
474466
public function testInterfaceFunctions_acos()
475467
{
476-
$Open = $this->History['Open'];
477-
$High = $this->History['High'];
478-
$Low = $this->History['Low'];
479-
$Close = $this->History['Close'];
480-
$Volume = $this->History['Volume'];
468+
$Close = $this->History['Close'];
469+
$Close = array_map('cos', $Close);
481470

482-
$this->assertEquals(trader_acos($Close), \LupeCode\phpTraderInterface\Trader::acos($Close)); //Only produces NaN, phpUnit calls this unequal
471+
$this->assertEquals(trader_acos($Close), \LupeCode\phpTraderInterface\Trader::acos($Close));
483472
}
484473

485474
public function testInterfaceFunctions_ad()
486475
{
487-
$Open = $this->History['Open'];
488476
$High = $this->History['High'];
489477
$Low = $this->History['Low'];
490478
$Close = $this->History['Close'];
@@ -495,18 +483,14 @@ public function testInterfaceFunctions_ad()
495483

496484
public function testInterfaceFunctions_add()
497485
{
498-
$Open = $this->History['Open'];
499486
$High = $this->History['High'];
500487
$Low = $this->History['Low'];
501-
$Close = $this->History['Close'];
502-
$Volume = $this->History['Volume'];
503488

504489
$this->assertEquals(trader_add($High, $Low), \LupeCode\phpTraderInterface\Trader::add($High, $Low));
505490
}
506491

507492
public function testInterfaceFunctions_adosc()
508493
{
509-
$Open = $this->History['Open'];
510494
$High = $this->History['High'];
511495
$Low = $this->History['Low'];
512496
$Close = $this->History['Close'];
@@ -516,14 +500,23 @@ public function testInterfaceFunctions_adosc()
516500
}
517501

518502
public function testInterfaceFunctions_adx()
503+
{
504+
$High = $this->History['High'];
505+
$Low = $this->History['Low'];
506+
$Close = $this->History['Close'];
507+
508+
$this->assertEquals(trader_adx($High, $Low, $Close), \LupeCode\phpTraderInterface\Trader::adx($High, $Low, $Close));
509+
}
510+
511+
public function testInterfaceFunctions_adxr()
519512
{
520513
$Open = $this->History['Open'];
521514
$High = $this->History['High'];
522515
$Low = $this->History['Low'];
523516
$Close = $this->History['Close'];
524517
$Volume = $this->History['Volume'];
525518

526-
$this->assertEquals(trader_adx($High, $Low, $Close), \LupeCode\phpTraderInterface\Trader::adx($High, $Low, $Close));
519+
$this->assertEquals(trader_adxr($High, $Low, $Close), \LupeCode\phpTraderInterface\Trader::adxr($High, $Low, $Close));
527520
}
528521
//</editor-fold>
529522

0 commit comments

Comments
 (0)