Skip to content

Commit

Permalink
Merge pull request #269 from ibi-group/fix-mobility-modes
Browse files Browse the repository at this point in the history
fix(MobilityProfile): Correctly assign "Some" profile
  • Loading branch information
binh-dam-ibigroup authored Nov 20, 2024
2 parents 5a7b382 + 365a25f commit 62ac8df
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,11 @@ public void updateMobilityMode() {
if (mobilityDevices.contains("manual wheelchair")) {
mModeTemp = "WChairM";
}
}

if ("None".equals(mModeTemp) && isMobilityLimited) {
mModeTemp = "Some";
}
// Adjust mobility limitations if the person has other impairments that don't require mobility devices.
if ("None".equals(mModeTemp) && isMobilityLimited) {
mModeTemp = "Some";
}

if (MobilityProfile.VisionLimitation.LOW_VISION == visionLimitation) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,34 @@
/**
* This class contains tests of selected scenarios in {@link MobilityProfile}.
*/
public class MobilityProfileTest {
class MobilityProfileTest {
// The mobility modes tested are tightly coupled with algorithms in the
// Georgia Tech Mobility Profile Configuration / Logical Flow document, as
// implemented in the MobilityProfile#updateMobilityMode() method. Changes
// to that document must be reflected in that method and in these tests.

private static Stream<Arguments> provideModes() {
return Stream.of(
Arguments.of(Set.of("service animal", "crutches"), "Device"),
Arguments.of(Set.of("service animal", "electric wheelchair"), "WChairE"),
Arguments.of(Set.of("service animal", "electric wheelchair", "white cane"), "WChairE-Blind"),
Arguments.of(Set.of("manual wheelchair", "electric wheelchair", "white cane"), "WChairM-Blind"),
Arguments.of(Collections.EMPTY_SET, "None"),
Arguments.of(Set.of("cardboard transmogrifier"), "None"), // Unknown/invalid device
Arguments.of(Set.of("cane", "none", "service animal"), "None") // Devices include "none" poison pill
Arguments.of(Set.of("service animal", "crutches"), false, "Device"),
Arguments.of(Set.of("service animal", "crutches"), true, "Device"),
Arguments.of(Set.of("service animal", "electric wheelchair"), false, "WChairE"),
Arguments.of(Set.of("service animal", "electric wheelchair", "white cane"), false, "WChairE-Blind"),
Arguments.of(Set.of("manual wheelchair", "electric wheelchair", "white cane"), false, "WChairM-Blind"),
Arguments.of(Collections.EMPTY_SET, false, "None"),
Arguments.of(Collections.EMPTY_SET, true, "Some"),
Arguments.of(Set.of("cardboard transmogrifier"), false, "None"), // Unknown/invalid device
Arguments.of(Set.of("cane", "none", "service animal"), false, "None"), // Devices include "none" poison pill
Arguments.of(Set.of("none"), false, "None"), // Devices include "none" poison pill
Arguments.of(Set.of("none"), true, "Some") // Devices include "none" poison pill
);
}

@ParameterizedTest
@MethodSource("provideModes")
public void testModes(Set<String> devices, String mode) {
void testModes(Set<String> devices, boolean isMobilityLimited, String mode) {
var prof = new MobilityProfile();
prof.mobilityDevices = devices;
prof.isMobilityLimited = isMobilityLimited;
prof.updateMobilityMode();
Assertions.assertEquals(mode, prof.mobilityMode);
}
Expand All @@ -50,7 +55,7 @@ private static Stream<Arguments> provideModesVision() {

@ParameterizedTest
@MethodSource("provideModesVision")
public void testModesVision(MobilityProfile.VisionLimitation limitation, Set<String> devices, String mode) {
void testModesVision(MobilityProfile.VisionLimitation limitation, Set<String> devices, String mode) {
var prof = new MobilityProfile();
prof.mobilityDevices = devices;
prof.visionLimitation = limitation;
Expand Down

0 comments on commit 62ac8df

Please sign in to comment.