diff --git a/tests/BCMathHelperTest.php b/tests/BCMathHelperTest.php new file mode 100644 index 0000000..6903186 --- /dev/null +++ b/tests/BCMathHelperTest.php @@ -0,0 +1,16 @@ +assertEquals('0.5679', BCMathHelper::bcround('0.567891', 4)); + $this->assertEquals('0.5676', BCMathHelper::bcround('0.567591', 4)); + $this->assertEquals('0.5676', BCMathHelper::bcround('0.567559', 4)); + $this->assertEquals('0.5675', BCMathHelper::bcround('0.567544', 4)); + } +} diff --git a/tests/NBPCurrencyConverterTest.php b/tests/NBPCurrencyConverterTest.php index b2aaf4c..e27593b 100644 --- a/tests/NBPCurrencyConverterTest.php +++ b/tests/NBPCurrencyConverterTest.php @@ -26,6 +26,8 @@ public function testConvert() { $converter = new NBPCurrencyConverter($this->guzzleMock(), null, 0); + $this->assertEquals('0.2651', $converter->convert('1.0000', 'PLN', 'USD')['amount']); + $this->assertEquals('3.7726', $converter->convert('1.0000', 'USD', 'PLN')['amount']); $this->assertEquals('123.4567', $converter->convert('123.4567', 'PLN', 'PLN')['amount']); $this->assertEquals('32.7246', $converter->convert('123.4567', 'PLN', 'USD')['amount']); $this->assertEquals('465.7527', $converter->convert('123.4567', 'USD', 'PLN')['amount']); @@ -38,6 +40,10 @@ public function testConvert() $this->assertEquals('284.0662', $converter->convert('123.4567', 'JPY', 'HUF')['amount']); $this->assertEquals('53.6549', $converter->convert('123.4567', 'HUF', 'JPY')['amount']); $this->assertEquals('123.4567', $converter->convert('123.4567', 'JPY', 'JPY')['amount']); + $this->assertEquals('53654981.1634', $converter->convert('123456789.6789', 'HUF', 'JPY')['amount']); + $this->assertEquals('284066429.3850', $converter->convert('123456789.6789', 'JPY', 'HUF')['amount']); + $this->assertEquals('32724590.3830', $converter->convert('123456789.6789', 'PLN', 'USD')['amount']); + $this->assertEquals('465753084.7426', $converter->convert('123456789.6789', 'USD', 'PLN')['amount']); } public function testInvalidFormatOfAmount()