Search in sources :

Example 1 with Frequency

use of javax.measure.quantity.Frequency in project indriya by unitsofmeasurement.

the class TimeQuantitiesTest method inverseTest.

@Test
public void inverseTest() {
    TimeUnitQuantity tenSeconds = TimeUnitQuantity.of(10, TimeUnit.SECONDS);
    Quantity<Frequency> perTenSeconds = tenSeconds.inverse();
    assertEquals(Double.valueOf(0.1d), perTenSeconds.getValue());
    assertEquals(HERTZ.getConverterTo(perTenSeconds.getUnit()), perTenSeconds.getUnit().getConverterTo(HERTZ));
}
Also used : Frequency(javax.measure.quantity.Frequency) TimeUnitQuantity(tech.units.indriya.quantity.time.TimeUnitQuantity) Test(org.junit.jupiter.api.Test)

Example 2 with Frequency

use of javax.measure.quantity.Frequency in project indriya by unitsofmeasurement.

the class TimeQuantitiesTest method inverseTemporalTest.

@Test
public void inverseTemporalTest() {
    TemporalQuantity tenSeconds = TemporalQuantity.of(10, SECONDS);
    Quantity<Frequency> perTenSeconds = tenSeconds.inverse();
    assertEquals(0.1d, perTenSeconds.getValue());
    assertEquals(HERTZ.getConverterTo(perTenSeconds.getUnit()), perTenSeconds.getUnit().getConverterTo(HERTZ));
}
Also used : Frequency(javax.measure.quantity.Frequency) TemporalQuantity(tech.units.indriya.quantity.time.TemporalQuantity) Test(org.junit.jupiter.api.Test)

Aggregations

Frequency (javax.measure.quantity.Frequency)2 Test (org.junit.jupiter.api.Test)2 TemporalQuantity (tech.units.indriya.quantity.time.TemporalQuantity)1 TimeUnitQuantity (tech.units.indriya.quantity.time.TimeUnitQuantity)1