SensorSanity { public static boolean isRawValueSane(double raw_value) { return isRawValueSane(raw_value, DexCollectionType.getDexCollectionType(), false); }  static boolean isRawValueSane(double raw_value); static boolean isRawValueSane(double raw_value, boolean hard); static boolean isRawValueSane(double raw_value, DexCollectionType type); static boolean isRawValueSane(double raw_value, DexCollectionType type, boolean hard_check); static boolean allowTestingWithDeadSensor(); static void clearEnviorment(); static boolean checkLibreSensorChangeIfEnabled(final String sn); synchronized static boolean checkLibreSensorChange(final String currentSerial); static final double DEXCOM_MIN_RAW; static final double DEXCOM_MAX_RAW; static final double DEXCOM_G6_MIN_RAW; static final double DEXCOM_G6_MAX_RAW; static final double LIBRE_MIN_RAW; }
@Test public void sanity_raw_test_1() { assertWithMessage("Unrestricted passes").that(SensorSanity.isRawValueSane(1, DexCollectionType.Disabled)).isTrue(); assertWithMessage("G5 typical OK").that(SensorSanity.isRawValueSane(100, DexCollectionType.DexcomG5)).isTrue(); assertWithMessage("G4 typical OK").that(SensorSanity.isRawValueSane(100, DexCollectionType.DexbridgeWixel)).isTrue(); assertWithMessage("Libre typical OK").that(SensorSanity.isRawValueSane(100, DexCollectionType.LimiTTer)).isTrue(); assertWithMessage("G5 low FAIL").that(SensorSanity.isRawValueSane(1, DexCollectionType.DexcomG5)).isFalse(); assertWithMessage("G4 low FAIL").that(SensorSanity.isRawValueSane(1, DexCollectionType.DexbridgeWixel)).isFalse(); assertWithMessage("Libre low FAIL").that(SensorSanity.isRawValueSane(1, DexCollectionType.LimiTTer)).isFalse(); }
@Test public void sanity_raw_test_2() { assertWithMessage("Unrestricted passes").that(SensorSanity.isRawValueSane(10000, DexCollectionType.Disabled)).isTrue(); assertWithMessage("G5 typical OK").that(SensorSanity.isRawValueSane(300, DexCollectionType.DexcomG5)).isTrue(); assertWithMessage("G4 typical OK").that(SensorSanity.isRawValueSane(300, DexCollectionType.DexbridgeWixel)).isTrue(); assertWithMessage("Libre typical OK").that(SensorSanity.isRawValueSane(300, DexCollectionType.LimiTTer)).isTrue(); assertWithMessage("G5 high FAIL").that(SensorSanity.isRawValueSane(1001, DexCollectionType.DexcomG5)).isFalse(); assertWithMessage("G4 high FAIL").that(SensorSanity.isRawValueSane(1001, DexCollectionType.DexbridgeWixel)).isFalse(); }