diff --git a/wpilibcIntegrationTests/src/PCMTest.cpp b/wpilibcIntegrationTests/src/PCMTest.cpp index cbebddea08..eb7b9ec67d 100644 --- a/wpilibcIntegrationTests/src/PCMTest.cpp +++ b/wpilibcIntegrationTests/src/PCMTest.cpp @@ -84,7 +84,7 @@ TEST_F(PCMTest, DISABLED_PressureSwitch) { /** * Test if the correct solenoids turn on and off when they should */ -TEST_F(PCMTest, DISABLED_Solenoid) { +TEST_F(PCMTest, Solenoid) { Reset(); Solenoid solenoid1(TestBench::kSolenoidChannel1); Solenoid solenoid2(TestBench::kSolenoidChannel2); @@ -95,6 +95,8 @@ TEST_F(PCMTest, DISABLED_Solenoid) { Wait(kSolenoidDelayTime); EXPECT_TRUE(m_fakeSolenoid1->Get()) << "Solenoid #1 did not turn off"; EXPECT_TRUE(m_fakeSolenoid2->Get()) << "Solenoid #2 did not turn off"; + EXPECT_FALSE(solenoid1.Get()) << "Solenoid #1 did not read off"; + EXPECT_FALSE(solenoid2.Get()) << "Solenoid #2 did not read off"; // Turn one solenoid on and one off solenoid1.Set(true); @@ -102,6 +104,8 @@ TEST_F(PCMTest, DISABLED_Solenoid) { Wait(kSolenoidDelayTime); EXPECT_FALSE(m_fakeSolenoid1->Get()) << "Solenoid #1 did not turn on"; EXPECT_TRUE(m_fakeSolenoid2->Get()) << "Solenoid #2 did not turn off"; + EXPECT_TRUE(solenoid1.Get()) << "Solenoid #1 did not read on"; + EXPECT_FALSE(solenoid2.Get()) << "Solenoid #2 did not read off"; // Turn one solenoid on and one off solenoid1.Set(false); @@ -109,6 +113,8 @@ TEST_F(PCMTest, DISABLED_Solenoid) { Wait(kSolenoidDelayTime); EXPECT_TRUE(m_fakeSolenoid1->Get()) << "Solenoid #1 did not turn off"; EXPECT_FALSE(m_fakeSolenoid2->Get()) << "Solenoid #2 did not turn on"; + EXPECT_FALSE(solenoid1.Get()) << "Solenoid #1 did not read off"; + EXPECT_TRUE(solenoid2.Get()) << "Solenoid #2 did not read on"; // Turn both on solenoid1.Set(true); @@ -116,13 +122,15 @@ TEST_F(PCMTest, DISABLED_Solenoid) { Wait(kSolenoidDelayTime); EXPECT_FALSE(m_fakeSolenoid1->Get()) << "Solenoid #1 did not turn on"; EXPECT_FALSE(m_fakeSolenoid2->Get()) << "Solenoid #2 did not turn on"; + EXPECT_TRUE(solenoid1.Get()) << "Solenoid #1 did not read on"; + EXPECT_TRUE(solenoid2.Get()) << "Solenoid #2 did not read on"; } /** * Test if the correct solenoids turn on and off when they should when used * with the DoubleSolenoid class. */ -TEST_F(PCMTest, DISABLED_DoubleSolenoid) { +TEST_F(PCMTest, DoubleSolenoid) { DoubleSolenoid solenoid(TestBench::kSolenoidChannel1, TestBench::kSolenoidChannel2); @@ -130,14 +138,17 @@ TEST_F(PCMTest, DISABLED_DoubleSolenoid) { Wait(kSolenoidDelayTime); EXPECT_TRUE(m_fakeSolenoid1->Get()) << "Solenoid #1 did not turn off"; EXPECT_TRUE(m_fakeSolenoid2->Get()) << "Solenoid #2 did not turn off"; + EXPECT_TRUE(solenoid.Get() == DoubleSolenoid::kOff) << "Solenoid does not read off"; solenoid.Set(DoubleSolenoid::kForward); Wait(kSolenoidDelayTime); EXPECT_FALSE(m_fakeSolenoid1->Get()) << "Solenoid #1 did not turn on"; EXPECT_TRUE(m_fakeSolenoid2->Get()) << "Solenoid #2 did not turn off"; + EXPECT_TRUE(solenoid.Get() == DoubleSolenoid::kForward) << "Solenoid does not read forward"; solenoid.Set(DoubleSolenoid::kReverse); Wait(kSolenoidDelayTime); EXPECT_TRUE(m_fakeSolenoid1->Get()) << "Solenoid #1 did not turn off"; EXPECT_FALSE(m_fakeSolenoid2->Get()) << "Solenoid #2 did not turn on"; + EXPECT_TRUE(solenoid.Get() == DoubleSolenoid::kReverse) << "Solenoid does not read reverse"; } diff --git a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PCMTest.java b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PCMTest.java index e5ecabb065..ea631bf161 100644 --- a/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PCMTest.java +++ b/wpilibjIntegrationTests/src/main/java/edu/wpi/first/wpilibj/PCMTest.java @@ -99,7 +99,7 @@ public class PCMTest extends AbstractComsSetup { assertEquals("Compressor did not turn on when the pressure switch turned on.", kCompressorOnVoltage, fakeCompressor.getVoltage(), range); - // Turn on the compressor + // Turn off the compressor fakePressureSwitch.set(false); Timer.delay(kCompressorDelayTime); assertEquals("Compressor did not turn off when the pressure switch turned off.", @@ -119,8 +119,10 @@ public class PCMTest extends AbstractComsSetup { solenoid1.set(false); solenoid2.set(false); Timer.delay(kSolenoidDelayTime); - assertTrue("Solenoid #1 did not turn on", fakeSolenoid1.get()); + assertTrue("Solenoid #1 did not turn off", fakeSolenoid1.get()); assertTrue("Solenoid #2 did not turn off", fakeSolenoid2.get()); + assertFalse("Solenoid #1 did not report off", solenoid1.get()); + assertFalse("Solenoid #2 did not report off", solenoid2.get()); // Turn Solenoid #1 on, and turn Solenoid #2 off solenoid1.set(true); @@ -128,6 +130,8 @@ public class PCMTest extends AbstractComsSetup { Timer.delay(kSolenoidDelayTime); assertFalse("Solenoid #1 did not turn on", fakeSolenoid1.get()); assertTrue("Solenoid #2 did not turn off", fakeSolenoid2.get()); + assertTrue("Solenoid #1 did not report on", solenoid1.get()); + assertFalse("Solenoid #2 did not report off", solenoid2.get()); // Turn Solenoid #1 off, and turn Solenoid #2 on solenoid1.set(false); @@ -135,6 +139,8 @@ public class PCMTest extends AbstractComsSetup { Timer.delay(kSolenoidDelayTime); assertTrue("Solenoid #1 did not turn off", fakeSolenoid1.get()); assertFalse("Solenoid #2 did not turn on", fakeSolenoid2.get()); + assertFalse("Solenoid #1 did not report off", solenoid1.get()); + assertTrue("Solenoid #2 did not report on", solenoid2.get()); // Turn both Solenoids on solenoid1.set(true); @@ -142,6 +148,8 @@ public class PCMTest extends AbstractComsSetup { Timer.delay(kSolenoidDelayTime); assertFalse("Solenoid #1 did not turn on", fakeSolenoid1.get()); assertFalse("Solenoid #2 did not turn on", fakeSolenoid2.get()); + assertTrue("Solenoid #1 did not report on", solenoid1.get()); + assertTrue("Solenoid #2 did not report on", solenoid2.get()); solenoid1.free(); solenoid2.free(); @@ -159,16 +167,19 @@ public class PCMTest extends AbstractComsSetup { Timer.delay(kSolenoidDelayTime); assertTrue("Solenoid #1 did not turn off", fakeSolenoid1.get()); assertTrue("Solenoid #2 did not turn off", fakeSolenoid2.get()); + assertTrue("DoubleSolenoid did not report off", (solenoid.get() == DoubleSolenoid.Value.kOff)); solenoid.set(DoubleSolenoid.Value.kForward); Timer.delay(kSolenoidDelayTime); assertFalse("Solenoid #1 did not turn on", fakeSolenoid1.get()); assertTrue("Solenoid #2 did not turn off", fakeSolenoid2.get()); + assertTrue("DoubleSolenoid did not report Forward", (solenoid.get() == DoubleSolenoid.Value.kForward)); solenoid.set(DoubleSolenoid.Value.kReverse); Timer.delay(kSolenoidDelayTime); assertTrue("Solenoid #1 did not turn off", fakeSolenoid1.get()); assertFalse("Solenoid #2 did not turn on", fakeSolenoid2.get()); + assertTrue("DoubleSolenoid did not report Reverse", (solenoid.get() == DoubleSolenoid.Value.kReverse)); solenoid.free(); }