mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-20 00:51:42 +00:00
Cleaned up integer type usage in wpilibc (#92)
Replaced all unsigned types to signed and int32_t with int in wpilibc
This commit is contained in:
committed by
Peter Johnson
parent
ff93050b31
commit
0cd05d1a42
@@ -40,7 +40,7 @@ class AnalogLoopTest : public testing::Test {
|
||||
*/
|
||||
TEST_F(AnalogLoopTest, AnalogInputWorks) {
|
||||
// Set the output voltage and check if the input measures the same voltage
|
||||
for (int i = 0; i < 50; i++) {
|
||||
for (int32_t i = 0; i < 50; i++) {
|
||||
m_output->SetVoltage(i / 10.0f);
|
||||
|
||||
Wait(kDelayTime);
|
||||
@@ -90,7 +90,7 @@ TEST_F(AnalogLoopTest, AnalogTriggerCounterWorks) {
|
||||
Counter counter(trigger);
|
||||
|
||||
// Turn the analog output low and high 50 times
|
||||
for (int i = 0; i < 50; i++) {
|
||||
for (int32_t i = 0; i < 50; i++) {
|
||||
m_output->SetVoltage(1.0);
|
||||
Wait(kDelayTime);
|
||||
m_output->SetVoltage(4.0);
|
||||
@@ -103,15 +103,15 @@ TEST_F(AnalogLoopTest, AnalogTriggerCounterWorks) {
|
||||
}
|
||||
|
||||
static void InterruptHandler(uint32_t interruptAssertedMask, void* param) {
|
||||
*reinterpret_cast<int*>(param) = 12345;
|
||||
*reinterpret_cast<int32_t*>(param) = 12345;
|
||||
}
|
||||
|
||||
TEST_F(AnalogLoopTest, AsynchronusInterruptWorks) {
|
||||
int param = 0;
|
||||
int32_t param = 0;
|
||||
AnalogTrigger trigger(m_input);
|
||||
trigger.SetLimitsVoltage(2.0f, 3.0f);
|
||||
|
||||
// Given an interrupt handler that sets an int to 12345
|
||||
// Given an interrupt handler that sets an int32_t to 12345
|
||||
std::shared_ptr<AnalogTriggerOutput> triggerOutput =
|
||||
trigger.CreateOutput(AnalogTriggerType::kState);
|
||||
triggerOutput->RequestInterrupts(InterruptHandler, ¶m);
|
||||
@@ -123,7 +123,7 @@ TEST_F(AnalogLoopTest, AsynchronusInterruptWorks) {
|
||||
m_output->SetVoltage(5.0);
|
||||
triggerOutput->CancelInterrupts();
|
||||
|
||||
// Then the int should be 12345
|
||||
// Then the int32_t should be 12345
|
||||
Wait(kDelayTime);
|
||||
EXPECT_EQ(12345, param) << "The interrupt did not run.";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user