@Test public void test_forceInN() { f1 = Values.forceInN(500); f2 = Values.forceInN(500); f3 = Values.forceInN(1000); assertEquals(f1, f2); assertEquals(f3, f2.add(f1)); assertEquals(f1, f3.sub(f2)); assertEquals(f3, f2.mul(2)); assertEquals(f1, f3.div(2)); assertEquals(Values.powerInW(2500), f2.mul(Values.speedInMpS(5))); assertEquals(Values.accInMss(5), f1.div(Values.massInKg(100))); assertEquals(Values.massInKg(100), f1.div(Values.accInMss(5))); assertTrue(f1.compareTo(f2) == 0); assertTrue(f1.compareTo(f3) == -1); assertTrue(f3.compareTo(f1) == 1); assertTrue(f1.equals(f2)); assertTrue(!f1.isZero()); assertTrue("500,00".equals(f1.toString())); assertTrue(500.0 == f1.n()); assertTrue(0.5 == f1.kn()); }
@Test public void test_SpeedInKmh() { // Speed speed = Values.speedInKmh(30); System.out.println("hallo test"); Speed spo1, spo2, spo3, spo4, spo5; double mps = 30; spo1 = Values.speedInKmh(mps); spo2 = Values.speedInKmh(40); assertEquals(Values.speedInKmh(mps), Values.speedInKmh(mps)); assertEquals(Values.speedInKmh(mps + mps), spo1.add(spo1)); assertEquals(Values.speedInKmh(mps - mps), spo1.sub(spo1)); assertEquals(Values.speedInKmh(mps * 2), spo1.mul(2d)); assertEquals(Values.speedInKmh(mps / 2), spo1.div(2d)); assertTrue(spo2.compareTo(spo1) == 1); assertTrue(spo2.compareTo(spo2) == 0); assertTrue(spo1.compareTo(spo2) == -1); assertTrue(!spo1.isZero()); assertEquals(Values.speedInMpS(30), Values.speedInKmh(108)); }
@Test public void test_powerInW() { p1 = Values.powerInW(500); p2 = Values.powerInW(500); p3 = Values.powerInW(1000); assertEquals(p1, p2); assertEquals(p3, p2.add(p1)); assertEquals(p1, p3.sub(p2)); assertEquals(p3, p2.mul(2)); assertEquals(p1, p3.div(2)); assertEquals(Values.forceInN(50), p1.div(Values.speedInMpS(10))); assertTrue(p1.compareTo(p2) == 0); assertTrue(p1.compareTo(p3) == -1); assertTrue(p3.compareTo(p1) == 1); assertTrue(p1.equals(p2)); assertTrue(!p1.isZero()); assertTrue("500,00".equals(p1.toString())); assertTrue(500.0 == p1.w()); assertTrue(0.5 == p1.kw()); }