mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-05-20 15:30:36 -04:00
must provide fixed price unless using market price
This commit is contained in:
parent
9c5fdb5d4a
commit
9aa6bbeff6
9 changed files with 40 additions and 34 deletions
|
@ -27,14 +27,14 @@ public class PriceTest {
|
|||
Price result = Price.parse("USD", "0.1");
|
||||
Assert.assertEquals(
|
||||
"Fiat value should be formatted with two decimals.",
|
||||
"0.10 BTC/USD",
|
||||
"0.10 XMR/USD",
|
||||
result.toFriendlyString()
|
||||
);
|
||||
|
||||
result = Price.parse("EUR", "0.1234");
|
||||
Assert.assertEquals(
|
||||
"Fiat value should be given two decimals",
|
||||
"0.1234 BTC/EUR",
|
||||
"0.1234 XMR/EUR",
|
||||
result.toFriendlyString()
|
||||
);
|
||||
|
||||
|
@ -57,19 +57,19 @@ public class PriceTest {
|
|||
|
||||
Assert.assertEquals(
|
||||
"Comma (',') as decimal separator should be converted to period ('.')",
|
||||
"0.0001 BTC/USD",
|
||||
"0.0001 XMR/USD",
|
||||
Price.parse("USD", "0,0001").toFriendlyString()
|
||||
);
|
||||
|
||||
Assert.assertEquals(
|
||||
"Too many decimals should get rounded up properly.",
|
||||
"10000.2346 LTC/BTC",
|
||||
"10000.2346 LTC/XMR",
|
||||
Price.parse("LTC", "10000,23456789").toFriendlyString()
|
||||
);
|
||||
|
||||
Assert.assertEquals(
|
||||
"Too many decimals should get rounded down properly.",
|
||||
"10000.2345 LTC/BTC",
|
||||
"10000.2345 LTC/XMR",
|
||||
Price.parse("LTC", "10000,23454999").toFriendlyString()
|
||||
);
|
||||
|
||||
|
@ -95,14 +95,14 @@ public class PriceTest {
|
|||
Price result = Price.valueOf("USD", 1);
|
||||
Assert.assertEquals(
|
||||
"Fiat value should have four decimals.",
|
||||
"0.0001 BTC/USD",
|
||||
"0.0001 XMR/USD",
|
||||
result.toFriendlyString()
|
||||
);
|
||||
|
||||
result = Price.valueOf("EUR", 1234);
|
||||
Assert.assertEquals(
|
||||
"Fiat value should be given two decimals",
|
||||
"0.1234 BTC/EUR",
|
||||
"0.1234 XMR/EUR",
|
||||
result.toFriendlyString()
|
||||
);
|
||||
|
||||
|
@ -114,13 +114,13 @@ public class PriceTest {
|
|||
|
||||
Assert.assertEquals(
|
||||
"Too many decimals should get rounded up properly.",
|
||||
"10000.2346 LTC/BTC",
|
||||
"10000.2346 LTC/XMR",
|
||||
Price.valueOf("LTC", 1000023456789L).toFriendlyString()
|
||||
);
|
||||
|
||||
Assert.assertEquals(
|
||||
"Too many decimals should get rounded down properly.",
|
||||
"10000.2345 LTC/BTC",
|
||||
"10000.2345 LTC/XMR",
|
||||
Price.valueOf("LTC", 1000023454999L).toFriendlyString()
|
||||
);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue