mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-19 00:41:43 +00:00
SCRIPT Move java files
This commit is contained in:
committed by
Peter Johnson
parent
7ca1be9bae
commit
c350c5f112
30
wpiunits/src/test/java/org/wpilib/units/CurrentUnitTest.java
Normal file
30
wpiunits/src/test/java/org/wpilib/units/CurrentUnitTest.java
Normal file
@@ -0,0 +1,30 @@
|
||||
// Copyright (c) FIRST and other WPILib contributors.
|
||||
// Open Source Software; you can modify and/or share it under the terms of
|
||||
// the WPILib BSD license file in the root directory of this project.
|
||||
|
||||
package edu.wpi.first.units;
|
||||
|
||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
||||
import static org.junit.jupiter.api.Assertions.assertTrue;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class CurrentUnitTest {
|
||||
@Test
|
||||
void testAmpsTimesVolts() {
|
||||
PowerUnit combined = Units.Amps.mult(Units.Volts, "Watt", "w");
|
||||
|
||||
assertTrue(combined.equivalent(Units.Watts));
|
||||
}
|
||||
|
||||
@Test
|
||||
void testMilliAmpsTimesMilliVolts() {
|
||||
// results in microwatts
|
||||
PowerUnit times = Units.Milliamps.mult(Units.Millivolts, "Microwatt", "uW");
|
||||
PowerUnit millimilli = Units.Milli(Units.Milliwatts);
|
||||
|
||||
assertEquals(1, times.convertFrom(1e-6, Units.Watts));
|
||||
assertEquals(1, millimilli.convertFrom(1e-6, Units.Watts));
|
||||
assertTrue(times.equivalent(millimilli));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user