Clean up unit UDL usage (#6961)

This commit is contained in:
Tyler Veness
2024-08-14 10:44:00 -07:00
committed by GitHub
parent 70fa41c69e
commit 8e0d9ac805
25 changed files with 57 additions and 77 deletions

View File

@@ -9,17 +9,10 @@
using namespace frc;
namespace {
using ProtoType = wpi::Protobuf<frc::DCMotor>;
const DCMotor kExpectedData = DCMotor{units::volt_t{1.91},
units::newton_meter_t{19.1},
units::ampere_t{1.74},
units::ampere_t{2.29},
units::radians_per_second_t{2.2},
2};
} // namespace
inline constexpr DCMotor kExpectedData =
DCMotor{1.91_V, 19.1_Nm, 1.74_A, 2.29_A, 2.2_rad_per_s, 2};
TEST(DCMotorProtoTest, Roundtrip) {
google::protobuf::Arena arena;

View File

@@ -8,16 +8,10 @@
using namespace frc;
namespace {
using StructType = wpi::Struct<frc::DCMotor>;
const DCMotor kExpectedData = DCMotor{units::volt_t{1.91},
units::newton_meter_t{19.1},
units::ampere_t{1.74},
units::ampere_t{2.29},
units::radians_per_second_t{2.2},
2};
} // namespace
inline constexpr DCMotor kExpectedData =
DCMotor{1.91_V, 19.1_Nm, 1.74_A, 2.29_A, 2.2_rad_per_s, 2};
TEST(DCMotorStructTest, Roundtrip) {
uint8_t buffer[StructType::GetSize()];