Fix tests

This commit is contained in:
Manfred Karrer 2018-11-12 00:25:25 -05:00
parent 9f9349c835
commit 16e4b72d4d
No known key found for this signature in database
GPG Key ID: 401250966A6B2C46
2 changed files with 10 additions and 10 deletions

View File

@ -103,9 +103,9 @@ public class OfferBookChartViewModelTest {
model.activate(); model.activate();
assertEquals(7, model.maxPlacesForBuyPrice.intValue()); assertEquals(7, model.maxPlacesForBuyPrice.intValue());
offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.price, 94016475L)))); offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.price, 94016475L))));
assertEquals(7, model.maxPlacesForBuyPrice.intValue()); assertEquals(9, model.maxPlacesForBuyPrice.intValue()); // 9401.6475
offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.price, 101016475L)))); offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.price, 101016475L))));
assertEquals(7, model.maxPlacesForBuyPrice.intValue()); assertEquals(10, model.maxPlacesForBuyPrice.intValue()); //10101.6475
} }
@Test @Test
@ -132,9 +132,9 @@ public class OfferBookChartViewModelTest {
model.activate(); model.activate();
assertEquals(4, model.maxPlacesForBuyVolume.intValue()); //0.01 assertEquals(4, model.maxPlacesForBuyVolume.intValue()); //0.01
offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.amount, 100000000L)))); offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.amount, 100000000L))));
assertEquals(4, model.maxPlacesForBuyVolume.intValue()); //10.00 assertEquals(5, model.maxPlacesForBuyVolume.intValue()); //10.00
offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.amount, 22128600000L)))); offerBookListItems.addAll(make(btcBuyItem.but(with(OfferBookListItemMaker.amount, 22128600000L))));
assertEquals(4, model.maxPlacesForBuyVolume.intValue()); //2212.86 assertEquals(7, model.maxPlacesForBuyVolume.intValue()); //2212.86
} }
@Test @Test
@ -179,11 +179,11 @@ public class OfferBookChartViewModelTest {
final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, service, null, null, new BSFormatter()); final OfferBookChartViewModel model = new OfferBookChartViewModel(offerBook, empty, service, null, null, new BSFormatter());
model.activate(); model.activate();
assertEquals(7, model.maxPlacesForSellPrice.intValue()); assertEquals(7, model.maxPlacesForSellPrice.intValue()); // 10.0000 default price
offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.price, 94016475L)))); offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.price, 94016475L))));
assertEquals(7, model.maxPlacesForSellPrice.intValue()); assertEquals(9, model.maxPlacesForSellPrice.intValue()); // 9401.6475
offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.price, 101016475L)))); offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.price, 101016475L))));
assertEquals(7, model.maxPlacesForSellPrice.intValue()); assertEquals(10, model.maxPlacesForSellPrice.intValue()); // 10101.6475
} }
@Test @Test
@ -210,8 +210,8 @@ public class OfferBookChartViewModelTest {
model.activate(); model.activate();
assertEquals(4, model.maxPlacesForSellVolume.intValue()); //0.01 assertEquals(4, model.maxPlacesForSellVolume.intValue()); //0.01
offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.amount, 100000000L)))); offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.amount, 100000000L))));
assertEquals(4, model.maxPlacesForSellVolume.intValue()); //10.00 assertEquals(5, model.maxPlacesForSellVolume.intValue()); //10.00
offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.amount, 22128600000L)))); offerBookListItems.addAll(make(btcSellItem.but(with(OfferBookListItemMaker.amount, 22128600000L))));
assertEquals(4, model.maxPlacesForSellVolume.intValue()); //2212.86 assertEquals(7, model.maxPlacesForSellVolume.intValue()); //2212.86
} }
} }

View File

@ -114,7 +114,7 @@ public class BSFormatterTest {
@Test @Test
public void testFormatVolume() { public void testFormatVolume() {
assertEquals("0.01", formatter.formatVolume(make(btcUsdOffer), true, 4)); assertEquals("1.00", formatter.formatVolume(make(btcUsdOffer), true, 4));
assertEquals("100.00", formatter.formatVolume(make(usdVolume))); assertEquals("100.00", formatter.formatVolume(make(usdVolume)));
assertEquals("1774.62", formatter.formatVolume(make(usdVolume.but(with(volumeString, "1774.62"))))); assertEquals("1774.62", formatter.formatVolume(make(usdVolume.but(with(volumeString, "1774.62")))));
} }