@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_massInG() { m1 = Values.massInKg(1); m2 = Values.massInG(1000); m3 = Values.massInG(500); m4 = Values.massInG(2500); m5 = Values.massInG(1500); m6 = Values.massInG(2000); assertEquals(m4, m3.mul(5)); assertEquals(m3, m4.div(5)); assertEquals(m5, m1.add(m3)); assertEquals(m6, m4.sub(m3)); assertTrue(!m6.isZero()); assertTrue("0,50".equals(m3.toString())); assertEquals(m1, m2); }
@Test public void test_massInLbs() { m1 = Values.massInKg(1); m2 = Values.massInLbs(2.20462262); m3 = Values.massInLbs(1102.31131); m4 = Values.massInLbs(5511.55655); m5 = Values.massInLbs(1104.51593262); m6 = Values.massInLbs(4409.24524); m7 = Values.ZERO_MASS; assertEquals(m4, m3.mul(5)); assertEquals(m3.kg(), m4.div(5).kg(), 0.01); assertEquals(m5.kg(), m1.add(m3).kg(), 4d); assertEquals(m6.kg(), m4.sub(m3).kg(), 0.01); assertTrue(m7.isZero()); assertTrue("500,00".equals(m3.toString())); assertEquals(m1, m2); }
@Test public void test_massInT() { m1 = Values.massInKg(1000); m2 = Values.massInT(1); m3 = Values.massInT(0.5); m4 = Values.massInT(2.5); m5 = Values.massInT(1.5); m6 = Values.massInT(2); m7 = Values.ZERO_MASS; assertEquals(m4, m3.mul(5)); assertEquals(m3, m4.div(5)); assertEquals(m5, m1.add(m3)); assertEquals(m6, m4.sub(m3)); assertTrue(m7.isZero()); assertTrue("2500,00".equals(m4.toString())); assertEquals(m1, m2); }