Merge remote-tracking branch 'Nightscout/dev' into wear/new_custom_watchface
This commit is contained in:
commit
40632d463c
|
@ -9,7 +9,7 @@
|
||||||
<string name="delta">Delta</string>
|
<string name="delta">Delta</string>
|
||||||
<string name="profile_label">Profil</string>
|
<string name="profile_label">Profil</string>
|
||||||
<string name="save">Lagre</string>
|
<string name="save">Lagre</string>
|
||||||
<string name="reloadprofile">Les inn profil på nytt</string>
|
<string name="reloadprofile">Last inn profil på nytt</string>
|
||||||
<string name="correctionbous">Korreksjon</string>
|
<string name="correctionbous">Korreksjon</string>
|
||||||
<string name="ns_upload_only">(FARLIG Å DEAKTIVERE) Kun NS opplasting</string>
|
<string name="ns_upload_only">(FARLIG Å DEAKTIVERE) Kun NS opplasting</string>
|
||||||
<string name="ns_upload_only_summary">Kun NS opplasting (deaktivert sync). Ikke effektiv på SGV med mindre en lokal kilde som xDrip+ er valgt. Ikke effektiv på Profiler mens NS-Profiler brukes.\n!!! ADVARSEL !!! Deaktivering av dette alternativet kan føre til funksjonsfeil og overdosering av insulin hvis noen av dine komponenter (AAPS, NS, xDrip+) er feil konfigurert. Observer at data som vises i AAPS samsvarer med pumpestatus!</string>
|
<string name="ns_upload_only_summary">Kun NS opplasting (deaktivert sync). Ikke effektiv på SGV med mindre en lokal kilde som xDrip+ er valgt. Ikke effektiv på Profiler mens NS-Profiler brukes.\n!!! ADVARSEL !!! Deaktivering av dette alternativet kan føre til funksjonsfeil og overdosering av insulin hvis noen av dine komponenter (AAPS, NS, xDrip+) er feil konfigurert. Observer at data som vises i AAPS samsvarer med pumpestatus!</string>
|
||||||
|
|
10
build.gradle
10
build.gradle
|
@ -11,15 +11,15 @@ buildscript {
|
||||||
rxkotlin_version = '3.0.1'
|
rxkotlin_version = '3.0.1'
|
||||||
room_version = '2.5.2'
|
room_version = '2.5.2'
|
||||||
lifecycle_version = '2.6.2'
|
lifecycle_version = '2.6.2'
|
||||||
dagger_version = '2.48'
|
dagger_version = '2.48.1'
|
||||||
coroutines_version = '1.7.3'
|
coroutines_version = '1.7.3'
|
||||||
activity_version = '1.7.2'
|
activity_version = '1.8.0'
|
||||||
fragmentktx_version = '1.6.1'
|
fragmentktx_version = '1.6.1'
|
||||||
ormLite_version = '4.46'
|
ormLite_version = '4.46'
|
||||||
gson_version = '2.10.1'
|
gson_version = '2.10.1'
|
||||||
nav_version = '2.7.3'
|
nav_version = '2.7.4'
|
||||||
appcompat_version = '1.6.1'
|
appcompat_version = '1.6.1'
|
||||||
material_version = '1.9.0'
|
material_version = '1.10.0'
|
||||||
gridlayout_version = '1.0.0'
|
gridlayout_version = '1.0.0'
|
||||||
constraintlayout_version = '2.1.4'
|
constraintlayout_version = '2.1.4'
|
||||||
preferencektx_version = '1.2.1'
|
preferencektx_version = '1.2.1'
|
||||||
|
@ -35,7 +35,7 @@ buildscript {
|
||||||
|
|
||||||
junit_version = '4.13.2'
|
junit_version = '4.13.2'
|
||||||
junit_jupiter_version = '5.10.0'
|
junit_jupiter_version = '5.10.0'
|
||||||
mockito_version = '5.5.0'
|
mockito_version = '5.6.0'
|
||||||
dexmaker_version = '1.2'
|
dexmaker_version = '1.2'
|
||||||
retrofit2_version = '2.9.0'
|
retrofit2_version = '2.9.0'
|
||||||
okhttp3_version = '4.11.0'
|
okhttp3_version = '4.11.0'
|
||||||
|
|
|
@ -138,6 +138,7 @@ open class Notification {
|
||||||
const val PUMP_SETTINGS_FAILED = 84
|
const val PUMP_SETTINGS_FAILED = 84
|
||||||
const val PUMP_TIMEZONE_UPDATE_FAILED = 85
|
const val PUMP_TIMEZONE_UPDATE_FAILED = 85
|
||||||
const val BLUETOOTH_NOT_SUPPORTED = 86
|
const val BLUETOOTH_NOT_SUPPORTED = 86
|
||||||
|
const val PUMP_WARNING = 87
|
||||||
|
|
||||||
const val USER_MESSAGE = 1000
|
const val USER_MESSAGE = 1000
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@
|
||||||
<string name="pref_show_basal_rate">Vis basalrate</string>
|
<string name="pref_show_basal_rate">Vis basalrate</string>
|
||||||
<string name="pref_show_loop_status">Vis loop status</string>
|
<string name="pref_show_loop_status">Vis loop status</string>
|
||||||
<string name="pref_show_bg">Vis BS</string>
|
<string name="pref_show_bg">Vis BS</string>
|
||||||
<string name="pref_show_bgi">Vis BS</string>
|
<string name="pref_show_bgi">Vis BGI</string>
|
||||||
<string name="pref_show_direction_arrow">Vis retningspil</string>
|
<string name="pref_show_direction_arrow">Vis retningspil</string>
|
||||||
<string name="pref_show_ago">Vis tid siden</string>
|
<string name="pref_show_ago">Vis tid siden</string>
|
||||||
<string name="pref_show_week_number">Vis ukenummer</string>
|
<string name="pref_show_week_number">Vis ukenummer</string>
|
||||||
|
|
|
@ -64,7 +64,7 @@
|
||||||
<string name="carbs">Karbo</string>
|
<string name="carbs">Karbo</string>
|
||||||
<string name="invalid_profile">Ugyldig profil!</string>
|
<string name="invalid_profile">Ugyldig profil!</string>
|
||||||
<string name="no_profile_set">INGEN PROFIL VALGT</string>
|
<string name="no_profile_set">INGEN PROFIL VALGT</string>
|
||||||
<string name="active"><![CDATA[<Active>]]></string>
|
<string name="active"><![CDATA[<Aktiv>]]></string>
|
||||||
<string name="date">Dato</string>
|
<string name="date">Dato</string>
|
||||||
<string name="units_label">Enheter</string>
|
<string name="units_label">Enheter</string>
|
||||||
<string name="dia_label">DIA</string>
|
<string name="dia_label">DIA</string>
|
||||||
|
@ -73,7 +73,7 @@
|
||||||
<string name="basal_label">Basal</string>
|
<string name="basal_label">Basal</string>
|
||||||
<string name="target_label">Målverdi</string>
|
<string name="target_label">Målverdi</string>
|
||||||
<string name="dia_long_label">Insulinets virkningstid (DIA)</string>
|
<string name="dia_long_label">Insulinets virkningstid (DIA)</string>
|
||||||
<string name="ic_long_label">Insulin- til karbohydratfaktor</string>
|
<string name="ic_long_label">Insulin-karbohydratfaktor (IK)</string>
|
||||||
<string name="isf_long_label">Insulin sensitivitetsfaktor (ISF)</string>
|
<string name="isf_long_label">Insulin sensitivitetsfaktor (ISF)</string>
|
||||||
<string name="basal_long_label">Basalrate</string>
|
<string name="basal_long_label">Basalrate</string>
|
||||||
<string name="target_long_label">Blodsukkermål</string>
|
<string name="target_long_label">Blodsukkermål</string>
|
||||||
|
@ -136,7 +136,7 @@
|
||||||
<string name="a11y_low">lavt</string>
|
<string name="a11y_low">lavt</string>
|
||||||
<string name="average">Gjennomsnitt</string>
|
<string name="average">Gjennomsnitt</string>
|
||||||
<string name="tir">TIR</string>
|
<string name="tir">TIR</string>
|
||||||
<string name="none"><![CDATA[<none>]]></string>
|
<string name="none"><![CDATA[<ingen>]]></string>
|
||||||
<string name="remove_label">FJERN</string>
|
<string name="remove_label">FJERN</string>
|
||||||
<string name="activate_profile">Aktiver profil</string>
|
<string name="activate_profile">Aktiver profil</string>
|
||||||
<string name="reset">tilbakestill</string>
|
<string name="reset">tilbakestill</string>
|
||||||
|
@ -146,7 +146,7 @@
|
||||||
<string name="confirm_remove_multiple_items">Er du sikker på at du vil fjerne %1$d elementer</string>
|
<string name="confirm_remove_multiple_items">Er du sikker på at du vil fjerne %1$d elementer</string>
|
||||||
<string name="overview_treatment_label">Behandling</string>
|
<string name="overview_treatment_label">Behandling</string>
|
||||||
<string name="copytolocalprofile">Opprett ny profil fra denne profilen?</string>
|
<string name="copytolocalprofile">Opprett ny profil fra denne profilen?</string>
|
||||||
<string name="wear_wizard_settings">Innstillinger for veiviser</string>
|
<string name="wear_wizard_settings">Kalkulatorinnstillinger</string>
|
||||||
<string name="bg_trend_label">15 min trend</string>
|
<string name="bg_trend_label">15 min trend</string>
|
||||||
<string name="treatments_wizard_cob_label">COB</string>
|
<string name="treatments_wizard_cob_label">COB</string>
|
||||||
<string name="bolus_iob_label">Bolus IOB</string>
|
<string name="bolus_iob_label">Bolus IOB</string>
|
||||||
|
@ -155,7 +155,7 @@
|
||||||
<string name="login">Login</string>
|
<string name="login">Login</string>
|
||||||
<string name="prime_fill">Prime/fylling</string>
|
<string name="prime_fill">Prime/fylling</string>
|
||||||
<string name="overview_insulin_label">Insulin</string>
|
<string name="overview_insulin_label">Insulin</string>
|
||||||
<string name="stoptemptarget">Avbryt temp target</string>
|
<string name="stoptemptarget">Avbryt midlertidig målverdi</string>
|
||||||
<string name="closedloop">Lukket Loop</string>
|
<string name="closedloop">Lukket Loop</string>
|
||||||
<string name="openloop">Åpen Loop</string>
|
<string name="openloop">Åpen Loop</string>
|
||||||
<string name="lowglucosesuspend">Stopp ved lavt BS</string>
|
<string name="lowglucosesuspend">Stopp ved lavt BS</string>
|
||||||
|
@ -220,10 +220,10 @@
|
||||||
<string name="careportal_carbscorrection">Karbo-korreksjon</string>
|
<string name="careportal_carbscorrection">Karbo-korreksjon</string>
|
||||||
<string name="careportal_openapsoffline">OpenAPS Offline</string>
|
<string name="careportal_openapsoffline">OpenAPS Offline</string>
|
||||||
<string name="pump_battery_change">Bytte pumpebatteri</string>
|
<string name="pump_battery_change">Bytte pumpebatteri</string>
|
||||||
<string name="temporary_target">Midlertidig BS-mål</string>
|
<string name="temporary_target">Midlertidig mål</string>
|
||||||
<string name="careportal_temporarytargetvalue">Midlertidig målverdi</string>
|
<string name="careportal_temporarytargetvalue">Midlertidig målverdi</string>
|
||||||
<string name="careportal_temporarytargetcancel">Avbryt midl. mål</string>
|
<string name="careportal_temporarytargetcancel">Avbryt midl. mål</string>
|
||||||
<string name="boluswizard">Bolusassistent</string>
|
<string name="boluswizard">Boluskalkulator</string>
|
||||||
<string name="glucosetype_finger">Finger</string>
|
<string name="glucosetype_finger">Finger</string>
|
||||||
<string name="glucosetype_sensor">Sensor</string>
|
<string name="glucosetype_sensor">Sensor</string>
|
||||||
<string name="manual">Manuell</string>
|
<string name="manual">Manuell</string>
|
||||||
|
@ -453,10 +453,10 @@
|
||||||
<string name="info">INFO</string>
|
<string name="info">INFO</string>
|
||||||
<!-- BolusWizard -->
|
<!-- BolusWizard -->
|
||||||
<string name="bolus_advisor">Bolusveiviser</string>
|
<string name="bolus_advisor">Bolusveiviser</string>
|
||||||
<string name="bolus_advisor_message">Du har høyt blodsukker. I stedet for å spise nå er det bedre å utsette det til du har et lavere blodsukker. Ønsker du å sette en korreksjons bolus nå og få en påminnelse om når det er på tide å spise? I dette tilfellet vil ingen karbohydrater registreres nå, og du må bruke måltidsveiviseren igjen når vi gir deg en påminnelse.</string>
|
<string name="bolus_advisor_message">Du har høyt blodsukker. I stedet for å spise nå er det bedre å utsette det til du har et lavere blodsukker. Ønsker du å sette en korreksjonsbolus nå og få en påminnelse om når det er på tide å spise? I dette tilfellet vil ingen karbohydrater registreres nå, og du må bruke boluskalkulatoren igjen når vi gir deg en påminnelse.</string>
|
||||||
<string name="cobvsiob">COB vs IOB</string>
|
<string name="cobvsiob">COB vs IOB</string>
|
||||||
<string name="slowabsorptiondetected"><![CDATA[<font color=\'%1$s\'>!! Advarsel: Oppdaget treg absorpsjon av karbohydrater: %2$d%% av tiden. Dobbeltsjekk din beregning. COB kan være misvisende og du risikerer å få for mye insulin !!</font>]]></string>
|
<string name="slowabsorptiondetected"><![CDATA[<font color=\'%1$s\'>!! Advarsel: Oppdaget treg absorpsjon av karbohydrater: %2$d%% av tiden. Dobbeltsjekk din beregning. COB kan være misvisende og du risikerer å få for mye insulin !!</font>]]></string>
|
||||||
<string name="partialboluswizard">Doser denne delen av resultatet fra bolusveiviseren [%]</string>
|
<string name="partialboluswizard">Doser denne delen av resultatet fra boluskalkulatoren [%]</string>
|
||||||
<string name="partialboluswizard_reset_time">Terskel for gammel BS-verdi [min]</string>
|
<string name="partialboluswizard_reset_time">Terskel for gammel BS-verdi [min]</string>
|
||||||
<string name="bolus_constraint_applied_warn">Bolus begrensning brukt: %1$.2f E til %2$.2f E</string>
|
<string name="bolus_constraint_applied_warn">Bolus begrensning brukt: %1$.2f E til %2$.2f E</string>
|
||||||
<string name="bolus_recorded_only">Bolus vil bare bli loggført (ikke levert av pumpe)</string>
|
<string name="bolus_recorded_only">Bolus vil bare bli loggført (ikke levert av pumpe)</string>
|
||||||
|
@ -478,7 +478,7 @@
|
||||||
<string name="wizard_explain_tt">TempT: %1$s</string>
|
<string name="wizard_explain_tt">TempT: %1$s</string>
|
||||||
<string name="wizard_explain_tt_to">%1$s til %2$s</string>
|
<string name="wizard_explain_tt_to">%1$s til %2$s</string>
|
||||||
<string name="wizard_pump_not_available">Ingen pumpe tilgjengelig!</string>
|
<string name="wizard_pump_not_available">Ingen pumpe tilgjengelig!</string>
|
||||||
<string name="quickwizard">Hurtigveiviser</string>
|
<string name="quickwizard">Hurtigknapp</string>
|
||||||
<!-- Preferences-->
|
<!-- Preferences-->
|
||||||
<string name="child">Barn</string>
|
<string name="child">Barn</string>
|
||||||
<string name="teenage">Tenåring</string>
|
<string name="teenage">Tenåring</string>
|
||||||
|
@ -486,8 +486,8 @@
|
||||||
<string name="resistant_adult">Insulinresistent voksen</string>
|
<string name="resistant_adult">Insulinresistent voksen</string>
|
||||||
<string name="pregnant">Graviditet</string>
|
<string name="pregnant">Graviditet</string>
|
||||||
<string name="patient_age_summary">Velg pasienttype for oppsett av sikkerhetsgrenser</string>
|
<string name="patient_age_summary">Velg pasienttype for oppsett av sikkerhetsgrenser</string>
|
||||||
<string name="max_bolus_title">Maks tillat bolus [U]</string>
|
<string name="max_bolus_title">Maks tillatt bolus [U]</string>
|
||||||
<string name="max_carbs_title">Maks tillat karbo [g]</string>
|
<string name="max_carbs_title">Maks tillatt karbohydrater [g]</string>
|
||||||
<string name="patient_type">Pasienttype</string>
|
<string name="patient_type">Pasienttype</string>
|
||||||
<!-- Protection-->
|
<!-- Protection-->
|
||||||
<string name="unlock_settings">Lås opp innstillinger</string>
|
<string name="unlock_settings">Lås opp innstillinger</string>
|
||||||
|
|
|
@ -105,23 +105,23 @@ import kotlin.math.roundToInt
|
||||||
removed.add(Pair("HeartRate", database.heartRateDao.deleteOlderThan(than)))
|
removed.add(Pair("HeartRate", database.heartRateDao.deleteOlderThan(than)))
|
||||||
|
|
||||||
if (deleteTrackedChanges) {
|
if (deleteTrackedChanges) {
|
||||||
removed.add(Pair("GlucoseValue", database.glucoseValueDao.deleteTrackedChanges()))
|
removed.add(Pair("CHANGES GlucoseValue", database.glucoseValueDao.deleteTrackedChanges()))
|
||||||
removed.add(Pair("TherapyEvent", database.therapyEventDao.deleteTrackedChanges()))
|
removed.add(Pair("CHANGES TherapyEvent", database.therapyEventDao.deleteTrackedChanges()))
|
||||||
removed.add(Pair("TemporaryBasal", database.temporaryBasalDao.deleteTrackedChanges()))
|
removed.add(Pair("CHANGES TemporaryBasal", database.temporaryBasalDao.deleteTrackedChanges()))
|
||||||
removed.add(Pair("Bolus", database.bolusDao.deleteTrackedChanges()))
|
removed.add(Pair("CHANGES Bolus", database.bolusDao.deleteTrackedChanges()))
|
||||||
removed.add(Pair("ExtendedBolus", database.extendedBolusDao.deleteTrackedChanges()))
|
removed.add(Pair("CHANGES ExtendedBolus", database.extendedBolusDao.deleteTrackedChanges()))
|
||||||
removed.add(Pair("MultiWaveBolus", database.multiwaveBolusLinkDao.deleteTrackedChanges()))
|
removed.add(Pair("CHANGES MultiWaveBolus", database.multiwaveBolusLinkDao.deleteTrackedChanges()))
|
||||||
// keep TDD removed.add(Pair("TotalDailyDose", database.totalDailyDoseDao.deleteTrackedChanges()))
|
// keep TDD removed.add(Pair("CHANGES TotalDailyDose", database.totalDailyDoseDao.deleteTrackedChanges()))
|
||||||
removed.add(Pair("Carbs", database.carbsDao.deleteTrackedChanges()))
|
removed.add(Pair("CHANGES Carbs", database.carbsDao.deleteTrackedChanges()))
|
||||||
removed.add(Pair("TemporaryTarget", database.temporaryTargetDao.deleteTrackedChanges()))
|
removed.add(Pair("CHANGES TemporaryTarget", database.temporaryTargetDao.deleteTrackedChanges()))
|
||||||
removed.add(Pair("ApsResultLink", database.apsResultLinkDao.deleteTrackedChanges()))
|
removed.add(Pair("CHANGES ApsResultLink", database.apsResultLinkDao.deleteTrackedChanges()))
|
||||||
removed.add(Pair("BolusCalculatorResult", database.bolusCalculatorResultDao.deleteTrackedChanges()))
|
removed.add(Pair("CHANGES BolusCalculatorResult", database.bolusCalculatorResultDao.deleteTrackedChanges()))
|
||||||
removed.add(Pair("EffectiveProfileSwitch", database.effectiveProfileSwitchDao.deleteTrackedChanges()))
|
removed.add(Pair("CHANGES EffectiveProfileSwitch", database.effectiveProfileSwitchDao.deleteTrackedChanges()))
|
||||||
removed.add(Pair("ProfileSwitch", database.profileSwitchDao.deleteTrackedChanges()))
|
removed.add(Pair("CHANGES ProfileSwitch", database.profileSwitchDao.deleteTrackedChanges()))
|
||||||
removed.add(Pair("ApsResult", database.apsResultDao.deleteTrackedChanges()))
|
removed.add(Pair("CHANGES ApsResult", database.apsResultDao.deleteTrackedChanges()))
|
||||||
// keep food database.foodDao.deleteHistory()
|
// keep food database.foodDao.deleteHistory()
|
||||||
removed.add(Pair("OfflineEvent", database.offlineEventDao.deleteTrackedChanges()))
|
removed.add(Pair("CHANGES OfflineEvent", database.offlineEventDao.deleteTrackedChanges()))
|
||||||
removed.add(Pair("HeartRate", database.heartRateDao.deleteTrackedChanges()))
|
removed.add(Pair("CHANGES HeartRate", database.heartRateDao.deleteTrackedChanges()))
|
||||||
}
|
}
|
||||||
val ret = StringBuilder()
|
val ret = StringBuilder()
|
||||||
removed
|
removed
|
||||||
|
|
|
@ -83,6 +83,7 @@
|
||||||
<string name="smb_disabled_in_preferences">SMB išjungti nustatymuose</string>
|
<string name="smb_disabled_in_preferences">SMB išjungti nustatymuose</string>
|
||||||
<string name="uam_disabled_in_preferences">NDM nustatymas išjungtas nustatymuose</string>
|
<string name="uam_disabled_in_preferences">NDM nustatymas išjungtas nustatymuose</string>
|
||||||
<string name="autosens_disabled_in_preferences">Autosens funkcija išjungta nustatymuose</string>
|
<string name="autosens_disabled_in_preferences">Autosens funkcija išjungta nustatymuose</string>
|
||||||
|
<string name="autosens_disabled_in_dyn_isf">Autosens neveikia DynISF</string>
|
||||||
<!-- Verify if needed in safety-->
|
<!-- Verify if needed in safety-->
|
||||||
<string name="limiting_iob">Ribojamas AIO iki %1$.1f V dėl %2$s</string>
|
<string name="limiting_iob">Ribojamas AIO iki %1$.1f V dėl %2$s</string>
|
||||||
<string name="maxvalueinpreferences">Maksimali reikšmė nustatymuose</string>
|
<string name="maxvalueinpreferences">Maksimali reikšmė nustatymuose</string>
|
||||||
|
|
|
@ -83,6 +83,7 @@
|
||||||
<string name="smb_disabled_in_preferences">Супер микро болюс SMB отключен в настройках</string>
|
<string name="smb_disabled_in_preferences">Супер микро болюс SMB отключен в настройках</string>
|
||||||
<string name="uam_disabled_in_preferences">Непредвиденный прием пищи UAM отключен в настройках</string>
|
<string name="uam_disabled_in_preferences">Непредвиденный прием пищи UAM отключен в настройках</string>
|
||||||
<string name="autosens_disabled_in_preferences">Автоматический подбор чувствительности Autosens отключен в настройках</string>
|
<string name="autosens_disabled_in_preferences">Автоматический подбор чувствительности Autosens отключен в настройках</string>
|
||||||
|
<string name="autosens_disabled_in_dyn_isf">Autosens отключён в DynISF</string>
|
||||||
<!-- Verify if needed in safety-->
|
<!-- Verify if needed in safety-->
|
||||||
<string name="limiting_iob">Ограничение активного инсулина IOB до %1$.1f ед. из-за %2$s</string>
|
<string name="limiting_iob">Ограничение активного инсулина IOB до %1$.1f ед. из-за %2$s</string>
|
||||||
<string name="maxvalueinpreferences">максимальное значение в настройках</string>
|
<string name="maxvalueinpreferences">максимальное значение в настройках</string>
|
||||||
|
|
|
@ -83,6 +83,7 @@
|
||||||
<string name="smb_disabled_in_preferences">SMB zakázané v nastaveniach</string>
|
<string name="smb_disabled_in_preferences">SMB zakázané v nastaveniach</string>
|
||||||
<string name="uam_disabled_in_preferences">UAM zakázané v nastaveniach</string>
|
<string name="uam_disabled_in_preferences">UAM zakázané v nastaveniach</string>
|
||||||
<string name="autosens_disabled_in_preferences">Automatická detekcia citlivosti zakázaná v nastaveniach</string>
|
<string name="autosens_disabled_in_preferences">Automatická detekcia citlivosti zakázaná v nastaveniach</string>
|
||||||
|
<string name="autosens_disabled_in_dyn_isf">Autosens zakázaný v DynISF</string>
|
||||||
<!-- Verify if needed in safety-->
|
<!-- Verify if needed in safety-->
|
||||||
<string name="limiting_iob">IOB obmedzený na %1$.1f JI: %2$s</string>
|
<string name="limiting_iob">IOB obmedzený na %1$.1f JI: %2$s</string>
|
||||||
<string name="maxvalueinpreferences">maximálna hodnota v nastaveniach</string>
|
<string name="maxvalueinpreferences">maximálna hodnota v nastaveniach</string>
|
||||||
|
|
|
@ -113,7 +113,7 @@
|
||||||
<string name="add_automation">Legg til regel</string>
|
<string name="add_automation">Legg til regel</string>
|
||||||
<string name="stop_processing">Stopp prosessering</string>
|
<string name="stop_processing">Stopp prosessering</string>
|
||||||
<!-- Reminders-->
|
<!-- Reminders-->
|
||||||
<string name="time_to_eat">Nå må du spise!\nBruk bolusveiviser og gjør beregning på nytt.</string>
|
<string name="time_to_eat">Nå må du spise!\nBruk boluskalkulator og gjør beregning på nytt.</string>
|
||||||
<string name="time_to_bolus">Tid for bolus!\nStart bolusveiviser og gjør beregning på nytt.</string>
|
<string name="time_to_bolus">Tid for bolus!\nStart boluskalkulator og gjør beregning på nytt.</string>
|
||||||
<string name="error_setting_reminder">Feil under innstilling av fremtidig alarm</string>
|
<string name="error_setting_reminder">Feil under innstilling av fremtidig alarm</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -10,12 +10,13 @@ import app.aaps.plugins.automation.triggers.TriggerConnector
|
||||||
import app.aaps.plugins.automation.triggers.TriggerConnectorTest
|
import app.aaps.plugins.automation.triggers.TriggerConnectorTest
|
||||||
import app.aaps.plugins.automation.triggers.TriggerDummy
|
import app.aaps.plugins.automation.triggers.TriggerDummy
|
||||||
import app.aaps.shared.tests.TestBase
|
import app.aaps.shared.tests.TestBase
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class AutomationEventTest : TestBase() {
|
class AutomationEventTest : TestBase() {
|
||||||
|
|
||||||
|
@ -40,8 +41,7 @@ class AutomationEventTest : TestBase() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test fun testCloneEvent() {
|
||||||
fun testCloneEvent() {
|
|
||||||
// create test object
|
// create test object
|
||||||
val event = AutomationEventObject(injector)
|
val event = AutomationEventObject(injector)
|
||||||
event.title = "Test"
|
event.title = "Test"
|
||||||
|
@ -51,33 +51,32 @@ class AutomationEventTest : TestBase() {
|
||||||
// export to json
|
// export to json
|
||||||
val eventJsonExpected =
|
val eventJsonExpected =
|
||||||
"{\"userAction\":false,\"autoRemove\":false,\"readOnly\":false,\"trigger\":\"{\\\"data\\\":{\\\"connectorType\\\":\\\"AND\\\",\\\"triggerList\\\":[\\\"{\\\\\\\"data\\\\\\\":{\\\\\\\"connectorType\\\\\\\":\\\\\\\"AND\\\\\\\",\\\\\\\"triggerList\\\\\\\":[]},\\\\\\\"type\\\\\\\":\\\\\\\"TriggerConnector\\\\\\\"}\\\"]},\\\"type\\\":\\\"TriggerConnector\\\"}\",\"title\":\"Test\",\"systemAction\":false,\"actions\":[\"{\\\"type\\\":\\\"ActionLoopEnable\\\"}\"],\"enabled\":true}"
|
"{\"userAction\":false,\"autoRemove\":false,\"readOnly\":false,\"trigger\":\"{\\\"data\\\":{\\\"connectorType\\\":\\\"AND\\\",\\\"triggerList\\\":[\\\"{\\\\\\\"data\\\\\\\":{\\\\\\\"connectorType\\\\\\\":\\\\\\\"AND\\\\\\\",\\\\\\\"triggerList\\\\\\\":[]},\\\\\\\"type\\\\\\\":\\\\\\\"TriggerConnector\\\\\\\"}\\\"]},\\\"type\\\":\\\"TriggerConnector\\\"}\",\"title\":\"Test\",\"systemAction\":false,\"actions\":[\"{\\\"type\\\":\\\"ActionLoopEnable\\\"}\"],\"enabled\":true}"
|
||||||
Assertions.assertEquals(eventJsonExpected, event.toJSON())
|
JSONAssert.assertEquals(eventJsonExpected, event.toJSON(), true)
|
||||||
|
|
||||||
// clone
|
// clone
|
||||||
val clone = AutomationEventObject(injector).fromJSON(eventJsonExpected, 1)
|
val clone = AutomationEventObject(injector).fromJSON(eventJsonExpected, 1)
|
||||||
|
|
||||||
// check title
|
// check title
|
||||||
Assertions.assertEquals(event.title, clone.title)
|
assertThat(clone.title).isEqualTo(event.title)
|
||||||
|
|
||||||
// check trigger
|
// check trigger
|
||||||
Assertions.assertNotNull(clone.trigger)
|
assertThat(clone.trigger).isNotNull()
|
||||||
Assertions.assertFalse(event.trigger === clone.trigger) // not the same object reference
|
assertThat(event.trigger).isNotSameInstanceAs(clone.trigger)
|
||||||
Assertions.assertEquals(event.trigger.javaClass, clone.trigger.javaClass)
|
assertThat(event.trigger.javaClass).isNotInstanceOf(clone.trigger.javaClass)
|
||||||
Assertions.assertEquals(event.trigger.toJSON(), clone.trigger.toJSON())
|
JSONAssert.assertEquals(event.trigger.toJSON(), clone.trigger.toJSON(), true)
|
||||||
|
|
||||||
// check action
|
// check action
|
||||||
Assertions.assertEquals(1, clone.actions.size)
|
assertThat(clone.actions).hasSize(1)
|
||||||
Assertions.assertFalse(event.actions === clone.actions) // not the same object reference
|
assertThat(event.actions).isNotSameInstanceAs(clone.actions)
|
||||||
Assertions.assertEquals(clone.toJSON(), clone.toJSON())
|
JSONAssert.assertEquals(clone.toJSON(), clone.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test fun hasStopProcessing() {
|
||||||
fun hasStopProcessing() {
|
|
||||||
val event = AutomationEventObject(injector)
|
val event = AutomationEventObject(injector)
|
||||||
event.title = "Test"
|
event.title = "Test"
|
||||||
event.trigger = TriggerDummy(injector).instantiate(JSONObject(TriggerConnectorTest().oneItem)) as TriggerConnector
|
event.trigger = TriggerDummy(injector).instantiate(JSONObject(TriggerConnectorTest().oneItem)) as TriggerConnector
|
||||||
Assertions.assertFalse(event.hasStopProcessing())
|
assertThat(event.hasStopProcessing()).isFalse()
|
||||||
event.addAction(ActionStopProcessing(injector))
|
event.addAction(ActionStopProcessing(injector))
|
||||||
Assertions.assertTrue(event.hasStopProcessing())
|
assertThat(event.hasStopProcessing()).isTrue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,9 +16,9 @@ import app.aaps.plugins.automation.triggers.Trigger
|
||||||
import app.aaps.plugins.automation.ui.TimerUtil
|
import app.aaps.plugins.automation.ui.TimerUtil
|
||||||
import app.aaps.shared.impl.utils.DateUtilImpl
|
import app.aaps.shared.impl.utils.DateUtilImpl
|
||||||
import app.aaps.shared.tests.TestBase
|
import app.aaps.shared.tests.TestBase
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.ArgumentMatchers.anyInt
|
import org.mockito.ArgumentMatchers.anyInt
|
||||||
|
@ -63,10 +63,10 @@ class BolusTimerImplTest : TestBase() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun doTest() {
|
fun doTest() {
|
||||||
Assertions.assertEquals(0, automationPlugin.size())
|
assertThat(automationPlugin.size()).isEqualTo(0)
|
||||||
automationPlugin.scheduleAutomationEventBolusReminder()
|
automationPlugin.scheduleAutomationEventBolusReminder()
|
||||||
Assertions.assertEquals(1, automationPlugin.size())
|
assertThat(automationPlugin.size()).isEqualTo(1)
|
||||||
automationPlugin.removeAutomationEventBolusReminder()
|
automationPlugin.removeAutomationEventBolusReminder()
|
||||||
Assertions.assertEquals(0, automationPlugin.size())
|
assertThat(automationPlugin.size()).isEqualTo(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,9 +16,9 @@ import app.aaps.plugins.automation.triggers.Trigger
|
||||||
import app.aaps.plugins.automation.ui.TimerUtil
|
import app.aaps.plugins.automation.ui.TimerUtil
|
||||||
import app.aaps.shared.impl.utils.DateUtilImpl
|
import app.aaps.shared.impl.utils.DateUtilImpl
|
||||||
import app.aaps.shared.tests.TestBase
|
import app.aaps.shared.tests.TestBase
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.ArgumentMatchers.any
|
import org.mockito.ArgumentMatchers.any
|
||||||
|
@ -52,25 +52,22 @@ class CarbTimerImplTest : TestBase() {
|
||||||
|
|
||||||
private lateinit var automationPlugin: AutomationPlugin
|
private lateinit var automationPlugin: AutomationPlugin
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach fun init() {
|
||||||
fun init() {
|
|
||||||
Mockito.`when`(rh.gs(anyInt())).thenReturn("")
|
Mockito.`when`(rh.gs(anyInt())).thenReturn("")
|
||||||
Mockito.`when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL)
|
Mockito.`when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL)
|
||||||
dateUtil = DateUtilImpl(context)
|
dateUtil = DateUtilImpl(context)
|
||||||
timerUtil = TimerUtil(context)
|
timerUtil = TimerUtil(context)
|
||||||
automationPlugin = AutomationPlugin(
|
automationPlugin = AutomationPlugin(
|
||||||
injector, rh, context, sp, fabricPrivacy, loop, rxBus, constraintChecker, aapsLogger, aapsSchedulers, config, locationServiceHelper, dateUtil,
|
injector, rh, context, sp, fabricPrivacy, loop, rxBus, constraintChecker, aapsLogger, aapsSchedulers, config, locationServiceHelper, dateUtil, activePlugin, timerUtil
|
||||||
activePlugin, timerUtil
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test fun doTest() {
|
||||||
fun doTest() {
|
assertThat(automationPlugin.size()).isEqualTo(0)
|
||||||
Assertions.assertEquals(0, automationPlugin.size())
|
|
||||||
automationPlugin.scheduleAutomationEventEatReminder()
|
automationPlugin.scheduleAutomationEventEatReminder()
|
||||||
Assertions.assertEquals(1, automationPlugin.size())
|
assertThat(automationPlugin.size()).isEqualTo(1)
|
||||||
automationPlugin.removeAutomationEventEatReminder()
|
automationPlugin.removeAutomationEventEatReminder()
|
||||||
Assertions.assertEquals(0, automationPlugin.size())
|
assertThat(automationPlugin.size()).isEqualTo(0)
|
||||||
|
|
||||||
automationPlugin.scheduleTimeToEatReminder(1)
|
automationPlugin.scheduleTimeToEatReminder(1)
|
||||||
Mockito.verify(context, Mockito.times(1)).startActivity(any())
|
Mockito.verify(context, Mockito.times(1)).startActivity(any())
|
||||||
|
|
|
@ -4,14 +4,14 @@ import app.aaps.plugins.automation.triggers.Trigger
|
||||||
import app.aaps.plugins.automation.triggers.TriggerConnector
|
import app.aaps.plugins.automation.triggers.TriggerConnector
|
||||||
import app.aaps.plugins.automation.triggers.TriggerDummy
|
import app.aaps.plugins.automation.triggers.TriggerDummy
|
||||||
import app.aaps.shared.tests.TestBase
|
import app.aaps.shared.tests.TestBase
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class ComposeTriggerTest : TestBase() {
|
class ComposeTriggerTest : TestBase() {
|
||||||
|
|
||||||
var injector: HasAndroidInjector = HasAndroidInjector { AndroidInjector { } }
|
val injector: HasAndroidInjector = HasAndroidInjector { AndroidInjector { } }
|
||||||
|
|
||||||
@Test fun testTriggerList() {
|
@Test fun testTriggerList() {
|
||||||
val root = TriggerConnector(injector)
|
val root = TriggerConnector(injector)
|
||||||
|
@ -23,16 +23,11 @@ class ComposeTriggerTest : TestBase() {
|
||||||
root.list.add(t1)
|
root.list.add(t1)
|
||||||
val t2: Trigger = TriggerDummy(injector)
|
val t2: Trigger = TriggerDummy(injector)
|
||||||
root.list.add(t2)
|
root.list.add(t2)
|
||||||
Assertions.assertEquals(3, root.size())
|
assertThat(root.list).containsExactly(t0, t1, t2).inOrder()
|
||||||
Assertions.assertEquals(t0, root.list[0])
|
|
||||||
Assertions.assertEquals(t1, root.list[1])
|
|
||||||
Assertions.assertEquals(t2, root.list[2])
|
|
||||||
|
|
||||||
// remove a trigger
|
// remove a trigger
|
||||||
root.list.remove(t1)
|
root.list.remove(t1)
|
||||||
Assertions.assertEquals(2, root.size())
|
assertThat(root.list).containsExactly(t0, t2).inOrder()
|
||||||
Assertions.assertEquals(t0, root.list[0])
|
|
||||||
Assertions.assertEquals(t2, root.list[1])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -44,6 +39,6 @@ class ComposeTriggerTest : TestBase() {
|
||||||
t[i] = TriggerDummy(injector)
|
t[i] = TriggerDummy(injector)
|
||||||
root.list.add(t[i]!!)
|
root.list.add(t[i]!!)
|
||||||
}
|
}
|
||||||
Assertions.assertEquals(4, root.size())
|
assertThat(root.size()).isEqualTo(4)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,14 +10,15 @@ import app.aaps.plugins.automation.R
|
||||||
import app.aaps.plugins.automation.elements.InputString
|
import app.aaps.plugins.automation.elements.InputString
|
||||||
import app.aaps.plugins.automation.ui.TimerUtil
|
import app.aaps.plugins.automation.ui.TimerUtil
|
||||||
import app.aaps.shared.tests.TestBase
|
import app.aaps.shared.tests.TestBase
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.ArgumentMatchers
|
import org.mockito.ArgumentMatchers
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class ActionAlarmTest : TestBase() {
|
class ActionAlarmTest : TestBase() {
|
||||||
|
|
||||||
|
@ -54,39 +55,39 @@ class ActionAlarmTest : TestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyNameTest() {
|
@Test fun friendlyNameTest() {
|
||||||
Assertions.assertEquals(app.aaps.core.ui.R.string.alarm, sut.friendlyName())
|
assertThat(sut.friendlyName()).isEqualTo(app.aaps.core.ui.R.string.alarm)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun shortDescriptionTest() {
|
@Test fun shortDescriptionTest() {
|
||||||
sut.text = InputString("Asd")
|
sut.text = InputString("Asd")
|
||||||
Assertions.assertEquals("Alarm: %s", sut.shortDescription())
|
assertThat(sut.shortDescription()).isEqualTo("Alarm: %s")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
Assertions.assertEquals(app.aaps.core.main.R.drawable.ic_access_alarm_24dp, sut.icon())
|
assertThat(sut.icon()).isEqualTo(app.aaps.core.main.R.drawable.ic_access_alarm_24dp)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun doActionTest() {
|
@Test fun doActionTest() {
|
||||||
sut.text = InputString("Asd")
|
sut.text = InputString("Asd")
|
||||||
sut.doAction(object : Callback() {
|
sut.doAction(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
Assertions.assertTrue(result.success)
|
assertThat(result.success).isTrue()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun hasDialogTest() {
|
@Test fun hasDialogTest() {
|
||||||
Assertions.assertTrue(sut.hasDialog())
|
assertThat(sut.hasDialog()).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun toJSONTest() {
|
@Test fun toJSONTest() {
|
||||||
sut.text = InputString("Asd")
|
sut.text = InputString("Asd")
|
||||||
Assertions.assertEquals("{\"data\":{\"text\":\"Asd\"},\"type\":\"ActionAlarm\"}", sut.toJSON())
|
JSONAssert.assertEquals("""{"data":{"text":"Asd"},"type":"ActionAlarm"}""", sut.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun fromJSONTest() {
|
@Test fun fromJSONTest() {
|
||||||
sut.text = InputString("Asd")
|
sut.text = InputString("Asd")
|
||||||
sut.fromJSON("{\"text\":\"Asd\"}")
|
sut.fromJSON("""{"text":"Asd"}""")
|
||||||
Assertions.assertEquals("Asd", sut.text.value)
|
assertThat(sut.text.value).isEqualTo("Asd")
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -8,11 +8,12 @@ import app.aaps.plugins.automation.elements.InputCarePortalMenu
|
||||||
import app.aaps.plugins.automation.elements.InputDuration
|
import app.aaps.plugins.automation.elements.InputDuration
|
||||||
import app.aaps.plugins.automation.elements.InputString
|
import app.aaps.plugins.automation.elements.InputString
|
||||||
import io.reactivex.rxjava3.core.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.ArgumentMatchers
|
import org.mockito.ArgumentMatchers
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class ActionCarePortalEventTest : ActionsTestBase() {
|
class ActionCarePortalEventTest : ActionsTestBase() {
|
||||||
|
|
||||||
|
@ -35,41 +36,42 @@ class ActionCarePortalEventTest : ActionsTestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyNameTest() {
|
@Test fun friendlyNameTest() {
|
||||||
Assertions.assertEquals(app.aaps.core.ui.R.string.careportal, sut.friendlyName())
|
assertThat(sut.friendlyName()).isEqualTo(app.aaps.core.ui.R.string.careportal)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun shortDescriptionTest() {
|
@Test fun shortDescriptionTest() {
|
||||||
Assertions.assertEquals("Note : Asd", sut.shortDescription())
|
assertThat(sut.shortDescription()).isEqualTo("Note : Asd")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
Assertions.assertEquals(app.aaps.core.main.R.drawable.ic_cp_note, sut.icon())
|
assertThat(sut.icon()).isEqualTo(app.aaps.core.main.R.drawable.ic_cp_note)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun doActionTest() {
|
@Test fun doActionTest() {
|
||||||
sut.doAction(object : Callback() {
|
sut.doAction(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
Assertions.assertTrue(result.success)
|
assertThat(result.success).isTrue()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun hasDialogTest() {
|
@Test fun hasDialogTest() {
|
||||||
Assertions.assertTrue(sut.hasDialog())
|
assertThat(sut.hasDialog()).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun toJSONTest() {
|
@Test fun toJSONTest() {
|
||||||
Assertions.assertEquals(
|
JSONAssert.assertEquals(
|
||||||
"{\"data\":{\"note\":\"Asd\",\"cpEvent\":\"NOTE\",\"durationInMinutes\":5},\"type\":\"ActionCarePortalEvent\"}",
|
"""{"data":{"note":"Asd","cpEvent":"NOTE","durationInMinutes":5},"type":"ActionCarePortalEvent"}""",
|
||||||
sut.toJSON()
|
sut.toJSON(),
|
||||||
|
true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun fromJSONTest() {
|
@Test fun fromJSONTest() {
|
||||||
sut.note = InputString("Asd")
|
sut.note = InputString("Asd")
|
||||||
sut.fromJSON("{\"note\":\"Asd\",\"cpEvent\":\"NOTE\",\"durationInMinutes\":5}")
|
sut.fromJSON("""{"note":"Asd","cpEvent":"NOTE","durationInMinutes":5}""")
|
||||||
Assertions.assertEquals("Asd", sut.note.value)
|
assertThat(sut.note.value).isEqualTo("Asd")
|
||||||
Assertions.assertEquals(5, sut.duration.value)
|
assertThat(sut.duration.value).isEqualTo(5)
|
||||||
Assertions.assertEquals(InputCarePortalMenu.EventType.NOTE, sut.cpEvent.value)
|
assertThat(sut.cpEvent.value).isEqualTo(InputCarePortalMenu.EventType.NOTE)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,20 +1,20 @@
|
||||||
package app.aaps.plugins.automation.actions
|
package app.aaps.plugins.automation.actions
|
||||||
|
|
||||||
|
import kotlin.test.assertIs
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class ActionDummyTest : ActionsTestBase() {
|
class ActionDummyTest : ActionsTestBase() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun instantiateTest() {
|
fun instantiateTest() {
|
||||||
var action: Action? = ActionDummy(injector).instantiate(JSONObject("{\"type\":\"info.nightscout.androidaps.plugins.general.automation.actions.ActionDummy\"}"))
|
var action: Action? = ActionDummy(injector).instantiate(JSONObject("""{"type":"info.nightscout.androidaps.plugins.general.automation.actions.ActionDummy"}"""))
|
||||||
Assertions.assertTrue(action is ActionDummy)
|
assertIs<ActionDummy>(action)
|
||||||
|
|
||||||
action = ActionDummy(injector).instantiate(JSONObject("{\"type\":\"app.aaps.plugins.automation.actions.ActionDummy\"}"))
|
action = ActionDummy(injector).instantiate(JSONObject("""{"type":"app.aaps.plugins.automation.actions.ActionDummy"}"""))
|
||||||
Assertions.assertTrue(action is ActionDummy)
|
assertIs<ActionDummy>(action)
|
||||||
|
|
||||||
action = ActionDummy(injector).instantiate(JSONObject("{\"type\":\"ActionDummy\"}"))
|
action = ActionDummy(injector).instantiate(JSONObject("""{"type":"ActionDummy"}"""))
|
||||||
Assertions.assertTrue(action is ActionDummy)
|
assertIs<ActionDummy>(action)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@ package app.aaps.plugins.automation.actions
|
||||||
import app.aaps.core.interfaces.plugin.PluginType
|
import app.aaps.core.interfaces.plugin.PluginType
|
||||||
import app.aaps.core.interfaces.queue.Callback
|
import app.aaps.core.interfaces.queue.Callback
|
||||||
import app.aaps.plugins.automation.R
|
import app.aaps.plugins.automation.R
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.ArgumentMatchers.eq
|
import org.mockito.ArgumentMatchers.eq
|
||||||
|
@ -27,17 +27,17 @@ class ActionLoopDisableTest : ActionsTestBase() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun friendlyNameTest() {
|
fun friendlyNameTest() {
|
||||||
Assertions.assertEquals(app.aaps.core.ui.R.string.disableloop, sut.friendlyName())
|
assertThat(sut.friendlyName()).isEqualTo(app.aaps.core.ui.R.string.disableloop)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun shortDescriptionTest() {
|
fun shortDescriptionTest() {
|
||||||
Assertions.assertEquals("Disable loop", sut.shortDescription())
|
assertThat(sut.shortDescription()).isEqualTo("Disable loop")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun iconTest() {
|
fun iconTest() {
|
||||||
Assertions.assertEquals(R.drawable.ic_stop_24dp, sut.icon())
|
assertThat(sut.icon()).isEqualTo(R.drawable.ic_stop_24dp)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -3,7 +3,7 @@ package app.aaps.plugins.automation.actions
|
||||||
import app.aaps.core.interfaces.plugin.PluginType
|
import app.aaps.core.interfaces.plugin.PluginType
|
||||||
import app.aaps.core.interfaces.queue.Callback
|
import app.aaps.core.interfaces.queue.Callback
|
||||||
import app.aaps.plugins.automation.R
|
import app.aaps.plugins.automation.R
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito
|
||||||
|
@ -24,15 +24,15 @@ class ActionLoopEnableTest : ActionsTestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyNameTest() {
|
@Test fun friendlyNameTest() {
|
||||||
Assertions.assertEquals(app.aaps.core.ui.R.string.enableloop, sut.friendlyName())
|
assertThat(sut.friendlyName()).isEqualTo(app.aaps.core.ui.R.string.enableloop)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun shortDescriptionTest() {
|
@Test fun shortDescriptionTest() {
|
||||||
Assertions.assertEquals("Enable loop", sut.shortDescription())
|
assertThat(sut.shortDescription()).isEqualTo("Enable loop")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
Assertions.assertEquals(R.drawable.ic_play_circle_outline_24dp, sut.icon())
|
assertThat(sut.icon()).isEqualTo(R.drawable.ic_play_circle_outline_24dp)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun doActionTest() {
|
@Test fun doActionTest() {
|
||||||
|
|
|
@ -6,7 +6,7 @@ import app.aaps.database.impl.transactions.CancelCurrentOfflineEventIfAnyTransac
|
||||||
import app.aaps.database.impl.transactions.Transaction
|
import app.aaps.database.impl.transactions.Transaction
|
||||||
import app.aaps.plugins.automation.R
|
import app.aaps.plugins.automation.R
|
||||||
import io.reactivex.rxjava3.core.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
@ -25,15 +25,15 @@ class ActionLoopResumeTest : ActionsTestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyNameTest() {
|
@Test fun friendlyNameTest() {
|
||||||
Assertions.assertEquals(app.aaps.core.ui.R.string.resumeloop, sut.friendlyName())
|
assertThat(sut.friendlyName()).isEqualTo(app.aaps.core.ui.R.string.resumeloop)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun shortDescriptionTest() {
|
@Test fun shortDescriptionTest() {
|
||||||
Assertions.assertEquals("Resume loop", sut.shortDescription())
|
assertThat(sut.shortDescription()).isEqualTo("Resume loop")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
Assertions.assertEquals(R.drawable.ic_replay_24dp, sut.icon())
|
assertThat(sut.icon()).isEqualTo(R.drawable.ic_replay_24dp)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun doActionTest() {
|
@Test fun doActionTest() {
|
||||||
|
|
|
@ -3,7 +3,7 @@ package app.aaps.plugins.automation.actions
|
||||||
import app.aaps.core.interfaces.queue.Callback
|
import app.aaps.core.interfaces.queue.Callback
|
||||||
import app.aaps.plugins.automation.R
|
import app.aaps.plugins.automation.R
|
||||||
import app.aaps.plugins.automation.elements.InputDuration
|
import app.aaps.plugins.automation.elements.InputDuration
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito
|
||||||
|
@ -24,16 +24,16 @@ class ActionLoopSuspendTest : ActionsTestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyNameTest() {
|
@Test fun friendlyNameTest() {
|
||||||
Assertions.assertEquals(app.aaps.core.ui.R.string.suspendloop, sut.friendlyName())
|
assertThat(sut.friendlyName()).isEqualTo(app.aaps.core.ui.R.string.suspendloop)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun shortDescriptionTest() {
|
@Test fun shortDescriptionTest() {
|
||||||
sut.minutes = InputDuration(30, InputDuration.TimeUnit.MINUTES)
|
sut.minutes = InputDuration(30, InputDuration.TimeUnit.MINUTES)
|
||||||
Assertions.assertEquals("Suspend loop for 30 min", sut.shortDescription())
|
assertThat(sut.shortDescription()).isEqualTo("Suspend loop for 30 min")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
Assertions.assertEquals(R.drawable.ic_pause_circle_outline_24dp, sut.icon())
|
assertThat(sut.icon()).isEqualTo(R.drawable.ic_pause_circle_outline_24dp)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun doActionTest() {
|
@Test fun doActionTest() {
|
||||||
|
@ -57,11 +57,11 @@ class ActionLoopSuspendTest : ActionsTestBase() {
|
||||||
a.minutes = InputDuration(20, InputDuration.TimeUnit.MINUTES)
|
a.minutes = InputDuration(20, InputDuration.TimeUnit.MINUTES)
|
||||||
val b = ActionLoopSuspend(injector)
|
val b = ActionLoopSuspend(injector)
|
||||||
b.apply(a)
|
b.apply(a)
|
||||||
Assertions.assertEquals(20, b.minutes.getMinutes().toLong())
|
assertThat(b.minutes.getMinutes().toLong()).isEqualTo(20)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun hasDialogTest() {
|
@Test fun hasDialogTest() {
|
||||||
val a = ActionLoopSuspend(injector)
|
val a = ActionLoopSuspend(injector)
|
||||||
Assertions.assertTrue(a.hasDialog())
|
assertThat(a.hasDialog()).isTrue()
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,13 +14,14 @@ import app.aaps.shared.tests.TestBase
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import io.reactivex.rxjava3.core.Completable
|
import io.reactivex.rxjava3.core.Completable
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.ArgumentMatchers
|
import org.mockito.ArgumentMatchers
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class ActionNotificationTest : TestBase() {
|
class ActionNotificationTest : TestBase() {
|
||||||
|
|
||||||
|
@ -60,22 +61,22 @@ class ActionNotificationTest : TestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyNameTest() {
|
@Test fun friendlyNameTest() {
|
||||||
Assertions.assertEquals(app.aaps.core.ui.R.string.notification, sut.friendlyName())
|
assertThat(sut.friendlyName()).isEqualTo(app.aaps.core.ui.R.string.notification)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun shortDescriptionTest() {
|
@Test fun shortDescriptionTest() {
|
||||||
sut.text = InputString("Asd")
|
sut.text = InputString("Asd")
|
||||||
Assertions.assertEquals("Notification: %s", sut.shortDescription())
|
assertThat(sut.shortDescription()).isEqualTo("Notification: %s")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
Assertions.assertEquals(R.drawable.ic_notifications, sut.icon())
|
assertThat(sut.icon()).isEqualTo(R.drawable.ic_notifications)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun doActionTest() {
|
@Test fun doActionTest() {
|
||||||
sut.doAction(object : Callback() {
|
sut.doAction(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
Assertions.assertTrue(result.success)
|
assertThat(result.success).isTrue()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Mockito.verify(rxBusMocked, Mockito.times(2)).send(anyObject())
|
Mockito.verify(rxBusMocked, Mockito.times(2)).send(anyObject())
|
||||||
|
@ -83,20 +84,21 @@ class ActionNotificationTest : TestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun hasDialogTest() {
|
@Test fun hasDialogTest() {
|
||||||
Assertions.assertTrue(sut.hasDialog())
|
assertThat(sut.hasDialog())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun toJSONTest() {
|
@Test fun toJSONTest() {
|
||||||
sut.text = InputString("Asd")
|
sut.text = InputString("Asd")
|
||||||
Assertions.assertEquals(
|
JSONAssert.assertEquals(
|
||||||
"{\"data\":{\"text\":\"Asd\"},\"type\":\"ActionNotification\"}",
|
"""{"data":{"text":"Asd"},"type":"ActionNotification"}""",
|
||||||
sut.toJSON()
|
sut.toJSON(),
|
||||||
|
true,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun fromJSONTest() {
|
@Test fun fromJSONTest() {
|
||||||
sut.text = InputString("Asd")
|
sut.text = InputString("Asd")
|
||||||
sut.fromJSON("{\"text\":\"Asd\"}")
|
sut.fromJSON("""{"text":"Asd"}""")
|
||||||
Assertions.assertEquals("Asd", sut.text.value)
|
assertThat(sut.text.value).isEqualTo("Asd")
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,11 +4,12 @@ import app.aaps.core.interfaces.queue.Callback
|
||||||
import app.aaps.plugins.automation.R
|
import app.aaps.plugins.automation.R
|
||||||
import app.aaps.plugins.automation.elements.InputDuration
|
import app.aaps.plugins.automation.elements.InputDuration
|
||||||
import app.aaps.plugins.automation.elements.InputPercent
|
import app.aaps.plugins.automation.elements.InputPercent
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class ActionProfileSwitchPercentTest : ActionsTestBase() {
|
class ActionProfileSwitchPercentTest : ActionsTestBase() {
|
||||||
|
|
||||||
|
@ -24,17 +25,17 @@ class ActionProfileSwitchPercentTest : ActionsTestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyNameTest() {
|
@Test fun friendlyNameTest() {
|
||||||
Assertions.assertEquals(R.string.profilepercentage, sut.friendlyName())
|
assertThat(sut.friendlyName()).isEqualTo(R.string.profilepercentage)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun shortDescriptionTest() {
|
@Test fun shortDescriptionTest() {
|
||||||
sut.pct = InputPercent(100.0)
|
sut.pct = InputPercent(100.0)
|
||||||
sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES)
|
sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES)
|
||||||
Assertions.assertEquals("Start profile 100% for 30 min", sut.shortDescription())
|
assertThat(sut.shortDescription()).isEqualTo("Start profile 100% for 30 min")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
Assertions.assertEquals(app.aaps.core.ui.R.drawable.ic_actions_profileswitch, sut.icon())
|
assertThat(sut.icon()).isEqualTo(app.aaps.core.ui.R.drawable.ic_actions_profileswitch)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun doActionTest() {
|
@Test fun doActionTest() {
|
||||||
|
@ -43,25 +44,25 @@ class ActionProfileSwitchPercentTest : ActionsTestBase() {
|
||||||
sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES)
|
sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES)
|
||||||
sut.doAction(object : Callback() {
|
sut.doAction(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
Assertions.assertTrue(result.success)
|
assertThat(result.success).isTrue()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Mockito.verify(profileFunction, Mockito.times(1)).createProfileSwitch(30, 110, 0)
|
Mockito.verify(profileFunction, Mockito.times(1)).createProfileSwitch(30, 110, 0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun hasDialogTest() {
|
@Test fun hasDialogTest() {
|
||||||
Assertions.assertTrue(sut.hasDialog())
|
assertThat(sut.hasDialog()).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun toJSONTest() {
|
@Test fun toJSONTest() {
|
||||||
sut.pct = InputPercent(100.0)
|
sut.pct = InputPercent(100.0)
|
||||||
sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES)
|
sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES)
|
||||||
Assertions.assertEquals("{\"data\":{\"percentage\":100,\"durationInMinutes\":30},\"type\":\"ActionProfileSwitchPercent\"}", sut.toJSON())
|
JSONAssert.assertEquals("""{"data":{"percentage":100,"durationInMinutes":30},"type":"ActionProfileSwitchPercent"}""", sut.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun fromJSONTest() {
|
@Test fun fromJSONTest() {
|
||||||
sut.fromJSON("{\"percentage\":100,\"durationInMinutes\":30}")
|
sut.fromJSON("""{"percentage":100,"durationInMinutes":30}""")
|
||||||
Assertions.assertEquals(100.0, sut.pct.value, 0.001)
|
assertThat(sut.pct.value).isWithin(0.001).of(100.0)
|
||||||
Assertions.assertEquals(30.0, sut.duration.getMinutes().toDouble(), 0.001)
|
assertThat(sut.duration.getMinutes().toDouble()).isWithin(0.001).of(30.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@ package app.aaps.plugins.automation.actions
|
||||||
import app.aaps.core.interfaces.queue.Callback
|
import app.aaps.core.interfaces.queue.Callback
|
||||||
import app.aaps.plugins.automation.R
|
import app.aaps.plugins.automation.R
|
||||||
import app.aaps.plugins.automation.elements.InputProfileName
|
import app.aaps.plugins.automation.elements.InputProfileName
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.ArgumentMatchers.anyLong
|
import org.mockito.ArgumentMatchers.anyLong
|
||||||
|
@ -11,13 +11,14 @@ import org.mockito.Mockito
|
||||||
import org.mockito.Mockito.anyInt
|
import org.mockito.Mockito.anyInt
|
||||||
import org.mockito.Mockito.anyString
|
import org.mockito.Mockito.anyString
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
|
private const val STRING_JSON = """{"data":{"profileToSwitchTo":"Test"},"type":"ActionProfileSwitch"}"""
|
||||||
|
|
||||||
class ActionProfileSwitchTest : ActionsTestBase() {
|
class ActionProfileSwitchTest : ActionsTestBase() {
|
||||||
|
|
||||||
private lateinit var sut: ActionProfileSwitch
|
private lateinit var sut: ActionProfileSwitch
|
||||||
|
|
||||||
private val stringJson = "{\"data\":{\"profileToSwitchTo\":\"Test\"},\"type\":\"ActionProfileSwitch\"}"
|
|
||||||
|
|
||||||
@BeforeEach fun setUp() {
|
@BeforeEach fun setUp() {
|
||||||
`when`(rh.gs(R.string.profilename)).thenReturn("Change profile to")
|
`when`(rh.gs(R.string.profilename)).thenReturn("Change profile to")
|
||||||
`when`(rh.gs(R.string.changengetoprofilename)).thenReturn("Change profile to %s")
|
`when`(rh.gs(R.string.changengetoprofilename)).thenReturn("Change profile to %s")
|
||||||
|
@ -30,11 +31,11 @@ class ActionProfileSwitchTest : ActionsTestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyName() {
|
@Test fun friendlyName() {
|
||||||
Assertions.assertEquals(R.string.profilename, sut.friendlyName())
|
assertThat(sut.friendlyName()).isEqualTo(R.string.profilename)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun shortDescriptionTest() {
|
@Test fun shortDescriptionTest() {
|
||||||
Assertions.assertEquals("Change profile to ", sut.shortDescription())
|
assertThat(sut.shortDescription()).isEqualTo("Change profile to ")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun doAction() {
|
@Test fun doAction() {
|
||||||
|
@ -43,7 +44,7 @@ class ActionProfileSwitchTest : ActionsTestBase() {
|
||||||
sut.inputProfileName = InputProfileName(rh, activePlugin, "")
|
sut.inputProfileName = InputProfileName(rh, activePlugin, "")
|
||||||
sut.doAction(object : Callback() {
|
sut.doAction(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
Assertions.assertFalse(result.success)
|
assertThat(result.success).isFalse()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -52,7 +53,7 @@ class ActionProfileSwitchTest : ActionsTestBase() {
|
||||||
sut.inputProfileName = InputProfileName(rh, activePlugin, "someProfile")
|
sut.inputProfileName = InputProfileName(rh, activePlugin, "someProfile")
|
||||||
sut.doAction(object : Callback() {
|
sut.doAction(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
Assertions.assertFalse(result.success)
|
assertThat(result.success).isFalse()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -62,8 +63,8 @@ class ActionProfileSwitchTest : ActionsTestBase() {
|
||||||
sut.inputProfileName = InputProfileName(rh, activePlugin, "Test")
|
sut.inputProfileName = InputProfileName(rh, activePlugin, "Test")
|
||||||
sut.doAction(object : Callback() {
|
sut.doAction(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
Assertions.assertTrue(result.success)
|
assertThat(result.success).isTrue()
|
||||||
Assertions.assertEquals("Already set", result.comment)
|
assertThat(result.comment).isEqualTo("Already set")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -72,8 +73,8 @@ class ActionProfileSwitchTest : ActionsTestBase() {
|
||||||
sut.inputProfileName = InputProfileName(rh, activePlugin, "Test")
|
sut.inputProfileName = InputProfileName(rh, activePlugin, "Test")
|
||||||
sut.doAction(object : Callback() {
|
sut.doAction(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
Assertions.assertFalse(result.success)
|
assertThat(result.success).isFalse()
|
||||||
Assertions.assertEquals("not exists", result.comment)
|
assertThat(result.comment).isEqualTo("not exists")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -83,29 +84,28 @@ class ActionProfileSwitchTest : ActionsTestBase() {
|
||||||
sut.inputProfileName = InputProfileName(rh, activePlugin, TESTPROFILENAME)
|
sut.inputProfileName = InputProfileName(rh, activePlugin, TESTPROFILENAME)
|
||||||
sut.doAction(object : Callback() {
|
sut.doAction(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
Assertions.assertTrue(result.success)
|
assertThat(result.success).isTrue()
|
||||||
Assertions.assertEquals("OK", result.comment)
|
assertThat(result.comment).isEqualTo("OK")
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Mockito.verify(profileFunction, Mockito.times(1)).createProfileSwitch(anyObject(), anyString(), anyInt(), anyInt(), anyInt(), anyLong())
|
Mockito.verify(profileFunction, Mockito.times(1)).createProfileSwitch(anyObject(), anyString(), anyInt(), anyInt(), anyInt(), anyLong())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun hasDialogTest() {
|
@Test fun hasDialogTest() {
|
||||||
Assertions.assertTrue(sut.hasDialog())
|
assertThat(sut.hasDialog()).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun toJSONTest() {
|
@Test fun toJSONTest() {
|
||||||
sut.inputProfileName = InputProfileName(rh, activePlugin, "Test")
|
sut.inputProfileName = InputProfileName(rh, activePlugin, "Test")
|
||||||
Assertions.assertEquals(stringJson, sut.toJSON())
|
JSONAssert.assertEquals(STRING_JSON, sut.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun fromJSONTest() {
|
@Test fun fromJSONTest() {
|
||||||
val data = "{\"profileToSwitchTo\":\"Test\"}"
|
sut.fromJSON("""{"profileToSwitchTo":"Test"}""")
|
||||||
sut.fromJSON(data)
|
assertThat(sut.inputProfileName.value).isEqualTo("Test")
|
||||||
Assertions.assertEquals("Test", sut.inputProfileName.value)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
Assertions.assertEquals(app.aaps.core.ui.R.drawable.ic_actions_profileswitch, sut.icon())
|
assertThat(sut.icon()).isEqualTo(app.aaps.core.ui.R.drawable.ic_actions_profileswitch)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,11 +3,12 @@ package app.aaps.plugins.automation.actions
|
||||||
import app.aaps.core.interfaces.queue.Callback
|
import app.aaps.core.interfaces.queue.Callback
|
||||||
import app.aaps.plugins.automation.R
|
import app.aaps.plugins.automation.R
|
||||||
import app.aaps.plugins.automation.elements.InputString
|
import app.aaps.plugins.automation.elements.InputString
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.ArgumentMatchers.anyString
|
import org.mockito.ArgumentMatchers.anyString
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class ActionSendSMSTest : ActionsTestBase() {
|
class ActionSendSMSTest : ActionsTestBase() {
|
||||||
|
|
||||||
|
@ -23,15 +24,15 @@ class ActionSendSMSTest : ActionsTestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyNameTest() {
|
@Test fun friendlyNameTest() {
|
||||||
Assertions.assertEquals(R.string.sendsmsactiondescription, sut.friendlyName())
|
assertThat(sut.friendlyName()).isEqualTo(R.string.sendsmsactiondescription)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun shortDescriptionTest() {
|
@Test fun shortDescriptionTest() {
|
||||||
Assertions.assertEquals("Send SMS: ", sut.shortDescription())
|
assertThat(sut.shortDescription()).isEqualTo("Send SMS: ")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
Assertions.assertEquals(R.drawable.ic_notifications, sut.icon())
|
assertThat(sut.icon()).isEqualTo(R.drawable.ic_notifications)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun doActionTest() {
|
@Test fun doActionTest() {
|
||||||
|
@ -39,22 +40,22 @@ class ActionSendSMSTest : ActionsTestBase() {
|
||||||
sut.text = InputString("Asd")
|
sut.text = InputString("Asd")
|
||||||
sut.doAction(object : Callback() {
|
sut.doAction(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
Assertions.assertTrue(result.success)
|
assertThat(result.success).isTrue()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun hasDialogTest() {
|
@Test fun hasDialogTest() {
|
||||||
Assertions.assertTrue(sut.hasDialog())
|
assertThat(sut.hasDialog()).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun toJSONTest() {
|
@Test fun toJSONTest() {
|
||||||
sut.text = InputString("Asd")
|
sut.text = InputString("Asd")
|
||||||
Assertions.assertEquals("{\"data\":{\"text\":\"Asd\"},\"type\":\"ActionSendSMS\"}", sut.toJSON())
|
JSONAssert.assertEquals("""{"data":{"text":"Asd"},"type":"ActionSendSMS"}""", sut.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun fromJSONTest() {
|
@Test fun fromJSONTest() {
|
||||||
sut.fromJSON("{\"text\":\"Asd\"}")
|
sut.fromJSON("""{"text":"Asd"}""")
|
||||||
Assertions.assertEquals("Asd", sut.text.value)
|
assertThat(sut.text.value).isEqualTo("Asd")
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,11 +9,12 @@ import app.aaps.plugins.automation.R
|
||||||
import app.aaps.plugins.automation.elements.InputDuration
|
import app.aaps.plugins.automation.elements.InputDuration
|
||||||
import app.aaps.plugins.automation.elements.InputTempTarget
|
import app.aaps.plugins.automation.elements.InputTempTarget
|
||||||
import io.reactivex.rxjava3.core.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class ActionStartTempTargetTest : ActionsTestBase() {
|
class ActionStartTempTargetTest : ActionsTestBase() {
|
||||||
|
|
||||||
|
@ -27,18 +28,18 @@ class ActionStartTempTargetTest : ActionsTestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyNameTest() {
|
@Test fun friendlyNameTest() {
|
||||||
Assertions.assertEquals(R.string.starttemptarget, sut.friendlyName())
|
assertThat(sut.friendlyName()).isEqualTo(R.string.starttemptarget)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun shortDescriptionTest() {
|
@Test fun shortDescriptionTest() {
|
||||||
sut.value = InputTempTarget(profileFunction)
|
sut.value = InputTempTarget(profileFunction)
|
||||||
sut.value.value = 100.0
|
sut.value.value = 100.0
|
||||||
sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES)
|
sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES)
|
||||||
Assertions.assertEquals("Start temp target: 100mg/dl@null(Automation)", sut.shortDescription())
|
assertThat(sut.shortDescription()).isEqualTo("Start temp target: 100mg/dl@null(Automation)")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
Assertions.assertEquals(app.aaps.core.main.R.drawable.ic_temptarget_high, sut.icon())
|
assertThat(sut.icon()).isEqualTo(app.aaps.core.main.R.drawable.ic_temptarget_high)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun doActionTest() {
|
@Test fun doActionTest() {
|
||||||
|
@ -78,27 +79,27 @@ class ActionStartTempTargetTest : ActionsTestBase() {
|
||||||
|
|
||||||
sut.doAction(object : Callback() {
|
sut.doAction(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
Assertions.assertTrue(result.success)
|
assertThat(result.success).isTrue()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Mockito.verify(repository, Mockito.times(1)).runTransactionForResult(anyObject<Transaction<InsertAndCancelCurrentTemporaryTargetTransaction.TransactionResult>>())
|
Mockito.verify(repository, Mockito.times(1)).runTransactionForResult(anyObject<Transaction<InsertAndCancelCurrentTemporaryTargetTransaction.TransactionResult>>())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun hasDialogTest() {
|
@Test fun hasDialogTest() {
|
||||||
Assertions.assertTrue(sut.hasDialog())
|
assertThat(sut.hasDialog()).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun toJSONTest() {
|
@Test fun toJSONTest() {
|
||||||
sut.value = InputTempTarget(profileFunction)
|
sut.value = InputTempTarget(profileFunction)
|
||||||
sut.value.value = 100.0
|
sut.value.value = 100.0
|
||||||
sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES)
|
sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES)
|
||||||
Assertions.assertEquals("{\"data\":{\"durationInMinutes\":30,\"units\":\"mg/dl\",\"value\":100},\"type\":\"ActionStartTempTarget\"}", sut.toJSON())
|
JSONAssert.assertEquals("""{"data":{"durationInMinutes":30,"units":"mg/dl","value":100},"type":"ActionStartTempTarget"}""", sut.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun fromJSONTest() {
|
@Test fun fromJSONTest() {
|
||||||
sut.fromJSON("{\"value\":100,\"durationInMinutes\":30,\"units\":\"mg/dl\"}")
|
sut.fromJSON("""{"value":100,"durationInMinutes":30,"units":"mg/dl"}""")
|
||||||
Assertions.assertEquals(GlucoseUnit.MGDL, sut.value.units)
|
assertThat(sut.value.units).isEqualTo(GlucoseUnit.MGDL)
|
||||||
Assertions.assertEquals(100.0, sut.value.value, 0.001)
|
assertThat(sut.value.value).isWithin(0.001).of(100.0)
|
||||||
Assertions.assertEquals(30.0, sut.duration.getMinutes().toDouble(), 0.001)
|
assertThat(sut.duration.getMinutes().toDouble()).isWithin(0.001).of(30.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@ package app.aaps.plugins.automation.actions
|
||||||
|
|
||||||
import app.aaps.core.interfaces.queue.Callback
|
import app.aaps.core.interfaces.queue.Callback
|
||||||
import app.aaps.plugins.automation.R
|
import app.aaps.plugins.automation.R
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
@ -20,24 +20,24 @@ class ActionStopProcessingTest : ActionsTestBase() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun friendlyNameTest() {
|
fun friendlyNameTest() {
|
||||||
Assertions.assertEquals(R.string.stop_processing, sut.friendlyName())
|
assertThat(sut.friendlyName()).isEqualTo(R.string.stop_processing)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun shortDescriptionTest() {
|
fun shortDescriptionTest() {
|
||||||
Assertions.assertEquals("Stop processing", sut.shortDescription())
|
assertThat(sut.shortDescription()).isEqualTo("Stop processing")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun iconTest() {
|
fun iconTest() {
|
||||||
Assertions.assertEquals(R.drawable.ic_stop_24dp, sut.icon())
|
assertThat(sut.icon()).isEqualTo(R.drawable.ic_stop_24dp)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun doActionTest() {
|
fun doActionTest() {
|
||||||
sut.doAction(object : Callback() {
|
sut.doAction(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
Assertions.assertTrue(result.success)
|
assertThat(result.success).isTrue()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,12 @@ import app.aaps.database.impl.transactions.CancelCurrentTemporaryTargetIfAnyTran
|
||||||
import app.aaps.database.impl.transactions.Transaction
|
import app.aaps.database.impl.transactions.Transaction
|
||||||
import app.aaps.plugins.automation.R
|
import app.aaps.plugins.automation.R
|
||||||
import io.reactivex.rxjava3.core.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class ActionStopTempTargetTest : ActionsTestBase() {
|
class ActionStopTempTargetTest : ActionsTestBase() {
|
||||||
|
|
||||||
|
@ -24,15 +25,15 @@ class ActionStopTempTargetTest : ActionsTestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyNameTest() {
|
@Test fun friendlyNameTest() {
|
||||||
Assertions.assertEquals(app.aaps.core.ui.R.string.stoptemptarget, sut.friendlyName())
|
assertThat(sut.friendlyName()).isEqualTo(app.aaps.core.ui.R.string.stoptemptarget)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun shortDescriptionTest() {
|
@Test fun shortDescriptionTest() {
|
||||||
Assertions.assertEquals("Stop temp target", sut.shortDescription())
|
assertThat(sut.shortDescription()).isEqualTo("Stop temp target")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
Assertions.assertEquals(R.drawable.ic_stop_24dp, sut.icon())
|
assertThat(sut.icon()).isEqualTo(R.drawable.ic_stop_24dp)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun doActionTest() {
|
@Test fun doActionTest() {
|
||||||
|
@ -52,22 +53,22 @@ class ActionStopTempTargetTest : ActionsTestBase() {
|
||||||
|
|
||||||
sut.doAction(object : Callback() {
|
sut.doAction(object : Callback() {
|
||||||
override fun run() {
|
override fun run() {
|
||||||
Assertions.assertTrue(result.success)
|
assertThat(result.success).isTrue()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Mockito.verify(repository, Mockito.times(1)).runTransactionForResult((anyObject<Transaction<CancelCurrentTemporaryTargetIfAnyTransaction.TransactionResult>>()))
|
Mockito.verify(repository, Mockito.times(1)).runTransactionForResult((anyObject<Transaction<CancelCurrentTemporaryTargetIfAnyTransaction.TransactionResult>>()))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun hasDialogTest() {
|
@Test fun hasDialogTest() {
|
||||||
Assertions.assertFalse(sut.hasDialog())
|
assertThat(sut.hasDialog()).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun toJSONTest() {
|
@Test fun toJSONTest() {
|
||||||
Assertions.assertEquals("{\"type\":\"ActionStopTempTarget\"}", sut.toJSON())
|
JSONAssert.assertEquals("""{"type":"ActionStopTempTarget"}""", sut.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun fromJSONTest() {
|
@Test fun fromJSONTest() {
|
||||||
sut.fromJSON("{\"reason\":\"Test\"}")
|
sut.fromJSON("""{"reason":"Test"}""")
|
||||||
Assertions.assertNotNull(sut)
|
assertThat(sut).isNotNull()
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,18 +1,18 @@
|
||||||
package app.aaps.plugins.automation.elements
|
package app.aaps.plugins.automation.elements
|
||||||
|
|
||||||
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class ComparatorConnectTest : TriggerTestBase() {
|
class ComparatorConnectTest : TriggerTestBase() {
|
||||||
|
|
||||||
@Test fun labelsTest() {
|
@Test fun labelsTest() {
|
||||||
Assertions.assertEquals(2, ComparatorConnect.Compare.labels(rh).size)
|
assertThat(ComparatorConnect.Compare.labels(rh)).hasSize(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun setValueTest() {
|
@Test fun setValueTest() {
|
||||||
val c = ComparatorConnect(rh)
|
val c = ComparatorConnect(rh)
|
||||||
c.value = ComparatorConnect.Compare.ON_DISCONNECT
|
c.value = ComparatorConnect.Compare.ON_DISCONNECT
|
||||||
Assertions.assertEquals(ComparatorConnect.Compare.ON_DISCONNECT, c.value)
|
assertThat(c.value).isEqualTo(ComparatorConnect.Compare.ON_DISCONNECT)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,18 +1,18 @@
|
||||||
package app.aaps.plugins.automation.elements
|
package app.aaps.plugins.automation.elements
|
||||||
|
|
||||||
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class ComparatorExistsTest : TriggerTestBase() {
|
class ComparatorExistsTest : TriggerTestBase() {
|
||||||
|
|
||||||
@Test fun labelsTest() {
|
@Test fun labelsTest() {
|
||||||
Assertions.assertEquals(2, ComparatorExists.Compare.labels(rh).size)
|
assertThat(ComparatorExists.Compare.labels(rh)).hasSize(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun setValueTest() {
|
@Test fun setValueTest() {
|
||||||
val c = ComparatorExists(rh)
|
val c = ComparatorExists(rh)
|
||||||
c.value = ComparatorExists.Compare.NOT_EXISTS
|
c.value = ComparatorExists.Compare.NOT_EXISTS
|
||||||
Assertions.assertEquals(ComparatorExists.Compare.NOT_EXISTS, c.value)
|
assertThat(c.value).isEqualTo(ComparatorExists.Compare.NOT_EXISTS)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,35 +1,35 @@
|
||||||
package app.aaps.plugins.automation.elements
|
package app.aaps.plugins.automation.elements
|
||||||
|
|
||||||
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class ComparatorTest : TriggerTestBase() {
|
class ComparatorTest : TriggerTestBase() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun checkTest() {
|
fun checkTest() {
|
||||||
Assertions.assertTrue(Comparator.Compare.IS_EQUAL.check(1, 1))
|
assertThat(Comparator.Compare.IS_EQUAL.check(1, 1)).isTrue()
|
||||||
Assertions.assertTrue(Comparator.Compare.IS_LESSER.check(1, 2))
|
assertThat(Comparator.Compare.IS_LESSER.check(1, 2)).isTrue()
|
||||||
Assertions.assertTrue(Comparator.Compare.IS_EQUAL_OR_LESSER.check(1, 2))
|
assertThat(Comparator.Compare.IS_EQUAL_OR_LESSER.check(1, 2)).isTrue()
|
||||||
Assertions.assertTrue(Comparator.Compare.IS_EQUAL_OR_LESSER.check(2, 2))
|
assertThat(Comparator.Compare.IS_EQUAL_OR_LESSER.check(2, 2)).isTrue()
|
||||||
Assertions.assertTrue(Comparator.Compare.IS_GREATER.check(2, 1))
|
assertThat(Comparator.Compare.IS_GREATER.check(2, 1)).isTrue()
|
||||||
Assertions.assertTrue(Comparator.Compare.IS_EQUAL_OR_GREATER.check(2, 1))
|
assertThat(Comparator.Compare.IS_EQUAL_OR_GREATER.check(2, 1)).isTrue()
|
||||||
Assertions.assertTrue(Comparator.Compare.IS_EQUAL_OR_GREATER.check(2, 2))
|
assertThat(Comparator.Compare.IS_EQUAL_OR_GREATER.check(2, 2)).isTrue()
|
||||||
Assertions.assertFalse(Comparator.Compare.IS_LESSER.check(2, 1))
|
assertThat(Comparator.Compare.IS_LESSER.check(2, 1)).isFalse()
|
||||||
Assertions.assertFalse(Comparator.Compare.IS_EQUAL_OR_LESSER.check(2, 1))
|
assertThat(Comparator.Compare.IS_EQUAL_OR_LESSER.check(2, 1)).isFalse()
|
||||||
Assertions.assertFalse(Comparator.Compare.IS_GREATER.check(1, 2))
|
assertThat(Comparator.Compare.IS_GREATER.check(1, 2)).isFalse()
|
||||||
Assertions.assertFalse(Comparator.Compare.IS_EQUAL_OR_GREATER.check(1, 2))
|
assertThat(Comparator.Compare.IS_EQUAL_OR_GREATER.check(1, 2)).isFalse()
|
||||||
// Assertions.assertTrue(Comparator.Compare.IS_NOT_AVAILABLE.check<Int?>(1, null))
|
// assertThat(Comparator.Compare.IS_NOT_AVAILABLE.check<Int?>(1, null)).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun labelsTest() {
|
fun labelsTest() {
|
||||||
Assertions.assertEquals(6, Comparator.Compare.labels(rh).size)
|
assertThat(Comparator.Compare.labels(rh)).hasSize(6)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun setValueTest() {
|
fun setValueTest() {
|
||||||
val c: Comparator = Comparator(rh).setValue(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
val c: Comparator = Comparator(rh).setValue(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_GREATER, c.value)
|
assertThat(c.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@ package app.aaps.plugins.automation.elements
|
||||||
|
|
||||||
import app.aaps.core.interfaces.db.GlucoseUnit
|
import app.aaps.core.interfaces.db.GlucoseUnit
|
||||||
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
@ -12,12 +12,12 @@ class InputBgTest : TriggerTestBase() {
|
||||||
@Test
|
@Test
|
||||||
fun setValueTest() {
|
fun setValueTest() {
|
||||||
var i: InputBg = InputBg(profileFunction).setUnits(GlucoseUnit.MMOL).setValue(5.0)
|
var i: InputBg = InputBg(profileFunction).setUnits(GlucoseUnit.MMOL).setValue(5.0)
|
||||||
Assertions.assertEquals(5.0, i.value, 0.01)
|
assertThat(i.value).isWithin(0.01).of(5.0)
|
||||||
Assertions.assertEquals(InputBg.MMOL_MIN, i.minValue, 0.01)
|
assertThat(i.minValue).isWithin(0.01).of(InputBg.MMOL_MIN)
|
||||||
i = InputBg(profileFunction).setValue(100.0).setUnits(GlucoseUnit.MGDL)
|
i = InputBg(profileFunction).setValue(100.0).setUnits(GlucoseUnit.MGDL)
|
||||||
Assertions.assertEquals(100.0, i.value, 0.01)
|
assertThat(i.value).isWithin(0.01).of(100.0)
|
||||||
Assertions.assertEquals(InputBg.MGDL_MIN, i.minValue, 0.01)
|
assertThat(i.minValue).isWithin(0.01).of(InputBg.MGDL_MIN)
|
||||||
Assertions.assertEquals(GlucoseUnit.MGDL, i.units)
|
assertThat(i.units).isEqualTo(GlucoseUnit.MGDL)
|
||||||
}
|
}
|
||||||
|
|
||||||
@BeforeEach
|
@BeforeEach
|
||||||
|
|
|
@ -1,19 +1,19 @@
|
||||||
package app.aaps.plugins.automation.elements
|
package app.aaps.plugins.automation.elements
|
||||||
|
|
||||||
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class InputCarePortalEventTest : TriggerTestBase() {
|
class InputCarePortalEventTest : TriggerTestBase() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun labelsTest() {
|
fun labelsTest() {
|
||||||
Assertions.assertEquals(4, InputCarePortalMenu.EventType.labels(rh).size)
|
assertThat(InputCarePortalMenu.EventType.labels(rh)).hasSize(4)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun setValueTest() {
|
fun setValueTest() {
|
||||||
val cp = InputCarePortalMenu(rh, InputCarePortalMenu.EventType.EXERCISE)
|
val cp = InputCarePortalMenu(rh, InputCarePortalMenu.EventType.EXERCISE)
|
||||||
Assertions.assertEquals(InputCarePortalMenu.EventType.EXERCISE, cp.value)
|
assertThat(cp.value).isEqualTo(InputCarePortalMenu.EventType.EXERCISE)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,20 +1,20 @@
|
||||||
package app.aaps.plugins.automation.elements
|
package app.aaps.plugins.automation.elements
|
||||||
|
|
||||||
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class InputDurationTest : TriggerTestBase() {
|
class InputDurationTest : TriggerTestBase() {
|
||||||
|
|
||||||
@Test fun setValueTest() {
|
@Test fun setValueTest() {
|
||||||
var i = InputDuration(5, InputDuration.TimeUnit.MINUTES)
|
var i = InputDuration(5, InputDuration.TimeUnit.MINUTES)
|
||||||
Assertions.assertEquals(5, i.value)
|
assertThat(i.value).isEqualTo(5)
|
||||||
Assertions.assertEquals(InputDuration.TimeUnit.MINUTES, i.unit)
|
assertThat(i.unit).isEqualTo(InputDuration.TimeUnit.MINUTES)
|
||||||
i = InputDuration(5, InputDuration.TimeUnit.HOURS)
|
i = InputDuration(5, InputDuration.TimeUnit.HOURS)
|
||||||
Assertions.assertEquals(5, i.value)
|
assertThat(i.value).isEqualTo(5)
|
||||||
Assertions.assertEquals(InputDuration.TimeUnit.HOURS, i.unit)
|
assertThat(i.unit).isEqualTo(InputDuration.TimeUnit.HOURS)
|
||||||
Assertions.assertEquals(5 * 60, i.getMinutes())
|
assertThat(i.getMinutes()).isEqualTo(5 * 60)
|
||||||
i.setMinutes(60)
|
i.setMinutes(60)
|
||||||
Assertions.assertEquals(1, i.value)
|
assertThat(i.value).isEqualTo(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
package app.aaps.plugins.automation.elements
|
package app.aaps.plugins.automation.elements
|
||||||
|
|
||||||
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class InputInsulinTest : TriggerTestBase() {
|
class InputInsulinTest : TriggerTestBase() {
|
||||||
|
@ -9,6 +9,6 @@ class InputInsulinTest : TriggerTestBase() {
|
||||||
@Test fun setValueTest() {
|
@Test fun setValueTest() {
|
||||||
val i = InputInsulin()
|
val i = InputInsulin()
|
||||||
i.value = 5.0
|
i.value = 5.0
|
||||||
Assertions.assertEquals(5.0, i.value, 0.01)
|
assertThat(i.value).isWithin(0.01).of(5.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
package app.aaps.plugins.automation.elements
|
package app.aaps.plugins.automation.elements
|
||||||
|
|
||||||
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class InputPercentTest : TriggerTestBase() {
|
class InputPercentTest : TriggerTestBase() {
|
||||||
|
@ -9,6 +9,6 @@ class InputPercentTest : TriggerTestBase() {
|
||||||
@Test fun setValueTest() {
|
@Test fun setValueTest() {
|
||||||
val i = InputPercent()
|
val i = InputPercent()
|
||||||
i.value = 10.0
|
i.value = 10.0
|
||||||
Assertions.assertEquals(10.0, i.value, 0.01)
|
assertThat(i.value).isWithin(0.01).of(10.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,15 +1,15 @@
|
||||||
package app.aaps.plugins.automation.elements
|
package app.aaps.plugins.automation.elements
|
||||||
|
|
||||||
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class InputProfileNameTest : TriggerTestBase() {
|
class InputProfileNameTest : TriggerTestBase() {
|
||||||
|
|
||||||
@Test fun setValue() {
|
@Test fun setValue() {
|
||||||
val inputProfileName = InputProfileName(rh, activePlugin, "Test")
|
val inputProfileName = InputProfileName(rh, activePlugin, "Test")
|
||||||
Assertions.assertEquals("Test", inputProfileName.value)
|
assertThat(inputProfileName.value).isEqualTo("Test")
|
||||||
inputProfileName.value = "Test2"
|
inputProfileName.value = "Test2"
|
||||||
Assertions.assertEquals("Test2", inputProfileName.value)
|
assertThat(inputProfileName.value).isEqualTo("Test2")
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
package app.aaps.plugins.automation.elements
|
package app.aaps.plugins.automation.elements
|
||||||
|
|
||||||
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class InputStringTest : TriggerTestBase() {
|
class InputStringTest : TriggerTestBase() {
|
||||||
|
@ -9,6 +9,6 @@ class InputStringTest : TriggerTestBase() {
|
||||||
@Test fun setValueTest() {
|
@Test fun setValueTest() {
|
||||||
val i = InputString()
|
val i = InputString()
|
||||||
i.value = "asd"
|
i.value = "asd"
|
||||||
Assertions.assertEquals("asd", i.value)
|
assertThat(i.value).isEqualTo("asd")
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@ package app.aaps.plugins.automation.elements
|
||||||
|
|
||||||
import app.aaps.core.interfaces.db.GlucoseUnit
|
import app.aaps.core.interfaces.db.GlucoseUnit
|
||||||
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class InputTempTargetTest : TriggerTestBase() {
|
class InputTempTargetTest : TriggerTestBase() {
|
||||||
|
@ -11,10 +11,10 @@ class InputTempTargetTest : TriggerTestBase() {
|
||||||
val i = InputTempTarget(profileFunction)
|
val i = InputTempTarget(profileFunction)
|
||||||
i.units = GlucoseUnit.MMOL
|
i.units = GlucoseUnit.MMOL
|
||||||
i.value = 5.0
|
i.value = 5.0
|
||||||
Assertions.assertEquals(5.0, i.value, 0.01)
|
assertThat(i.value).isWithin(0.01).of(5.0)
|
||||||
i.units = GlucoseUnit.MGDL
|
i.units = GlucoseUnit.MGDL
|
||||||
i.value = 100.0
|
i.value = 100.0
|
||||||
Assertions.assertEquals(100.0, i.value, 0.01)
|
assertThat(i.value).isWithin(0.01).of(100.0)
|
||||||
Assertions.assertEquals(GlucoseUnit.MGDL, i.units)
|
assertThat(i.units).isEqualTo(GlucoseUnit.MGDL)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,16 +1,17 @@
|
||||||
package app.aaps.plugins.automation.elements
|
package app.aaps.plugins.automation.elements
|
||||||
|
|
||||||
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
import kotlin.test.assertIs
|
||||||
|
|
||||||
class LabelWithElementTest : TriggerTestBase() {
|
class LabelWithElementTest : TriggerTestBase() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun constructorTest() {
|
fun constructorTest() {
|
||||||
val l = LabelWithElement(rh, "A", "B", InputInsulin())
|
val l = LabelWithElement(rh, "A", "B", InputInsulin())
|
||||||
Assertions.assertEquals("A", l.textPre)
|
assertThat(l.textPre).isEqualTo("A")
|
||||||
Assertions.assertEquals("B", l.textPost)
|
assertThat(l.textPost).isEqualTo("B")
|
||||||
Assertions.assertEquals(InputInsulin::class.java, l.element!!.javaClass)
|
assertIs<InputInsulin>(l.element)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@ package app.aaps.plugins.automation.elements
|
||||||
import app.aaps.shared.tests.TestBase
|
import app.aaps.shared.tests.TestBase
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class LayoutBuilderTest : TestBase() {
|
class LayoutBuilderTest : TestBase() {
|
||||||
|
@ -14,15 +14,15 @@ class LayoutBuilderTest : TestBase() {
|
||||||
val layoutBuilder = LayoutBuilder()
|
val layoutBuilder = LayoutBuilder()
|
||||||
val inputInsulin = InputInsulin()
|
val inputInsulin = InputInsulin()
|
||||||
layoutBuilder.add(inputInsulin)
|
layoutBuilder.add(inputInsulin)
|
||||||
Assertions.assertEquals(1, layoutBuilder.mElements.size)
|
assertThat(layoutBuilder.mElements).hasSize(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun addConditionalTest() {
|
@Test fun addConditionalTest() {
|
||||||
val layoutBuilder = LayoutBuilder()
|
val layoutBuilder = LayoutBuilder()
|
||||||
val inputInsulin = InputInsulin()
|
val inputInsulin = InputInsulin()
|
||||||
layoutBuilder.maybeAdd(inputInsulin, true)
|
layoutBuilder.maybeAdd(inputInsulin, true)
|
||||||
Assertions.assertEquals(1, layoutBuilder.mElements.size)
|
assertThat(layoutBuilder.mElements).hasSize(1)
|
||||||
layoutBuilder.maybeAdd(inputInsulin, false)
|
layoutBuilder.maybeAdd(inputInsulin, false)
|
||||||
Assertions.assertEquals(1, layoutBuilder.mElements.size)
|
assertThat(layoutBuilder.mElements).hasSize(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,7 @@ package app.aaps.plugins.automation.elements
|
||||||
|
|
||||||
import app.aaps.plugins.automation.triggers.TriggerDummy
|
import app.aaps.plugins.automation.triggers.TriggerDummy
|
||||||
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
import app.aaps.plugins.automation.triggers.TriggerTestBase
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
|
||||||
|
@ -10,9 +10,9 @@ class StaticLabelTest : TriggerTestBase() {
|
||||||
|
|
||||||
@Test fun constructor() {
|
@Test fun constructor() {
|
||||||
var sl = StaticLabel(rh, "any", TriggerDummy(injector))
|
var sl = StaticLabel(rh, "any", TriggerDummy(injector))
|
||||||
Assertions.assertEquals("any", sl.label)
|
assertThat(sl.label).isEqualTo("any")
|
||||||
`when`(rh.gs(app.aaps.core.ui.R.string.pumplimit)).thenReturn("pump limit")
|
`when`(rh.gs(app.aaps.core.ui.R.string.pumplimit)).thenReturn("pump limit")
|
||||||
sl = StaticLabel(rh, app.aaps.core.ui.R.string.pumplimit, TriggerDummy(injector))
|
sl = StaticLabel(rh, app.aaps.core.ui.R.string.pumplimit, TriggerDummy(injector))
|
||||||
Assertions.assertEquals("pump limit", sl.label)
|
assertThat(sl.label).isEqualTo("pump limit")
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,11 +5,11 @@ import app.aaps.plugins.automation.elements.Comparator
|
||||||
import app.aaps.plugins.main.iob.iobCobCalculator.data.AutosensDataObject
|
import app.aaps.plugins.main.iob.iobCobCalculator.data.AutosensDataObject
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.ArgumentMatchers
|
import org.mockito.ArgumentMatchers
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class TriggerAutosensValueTest : TriggerTestBase() {
|
class TriggerAutosensValueTest : TriggerTestBase() {
|
||||||
|
|
||||||
|
@ -20,53 +20,53 @@ class TriggerAutosensValueTest : TriggerTestBase() {
|
||||||
var t = TriggerAutosensValue(injector)
|
var t = TriggerAutosensValue(injector)
|
||||||
t.autosens.value = 110.0
|
t.autosens.value = 110.0
|
||||||
t.comparator.value = Comparator.Compare.IS_EQUAL
|
t.comparator.value = Comparator.Compare.IS_EQUAL
|
||||||
Assertions.assertEquals(110.0, t.autosens.value, 0.01)
|
assertThat(t.autosens.value).isWithin(0.01).of(110.0)
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t.comparator.value)
|
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerAutosensValue(injector)
|
t = TriggerAutosensValue(injector)
|
||||||
t.autosens.value = 100.0
|
t.autosens.value = 100.0
|
||||||
t.comparator.value = Comparator.Compare.IS_EQUAL
|
t.comparator.value = Comparator.Compare.IS_EQUAL
|
||||||
Assertions.assertEquals(100.0, t.autosens.value, 0.01)
|
assertThat(t.autosens.value).isWithin(0.01).of(100.0)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerAutosensValue(injector)
|
t = TriggerAutosensValue(injector)
|
||||||
t.autosens.value = 50.0
|
t.autosens.value = 50.0
|
||||||
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_GREATER
|
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_GREATER
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerAutosensValue(injector)
|
t = TriggerAutosensValue(injector)
|
||||||
t.autosens.value = 310.0
|
t.autosens.value = 310.0
|
||||||
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER
|
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerAutosensValue(injector)
|
t = TriggerAutosensValue(injector)
|
||||||
t.autosens.value = 420.0
|
t.autosens.value = 420.0
|
||||||
t.comparator.value = Comparator.Compare.IS_EQUAL
|
t.comparator.value = Comparator.Compare.IS_EQUAL
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerAutosensValue(injector)
|
t = TriggerAutosensValue(injector)
|
||||||
t.autosens.value = 390.0
|
t.autosens.value = 390.0
|
||||||
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER
|
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerAutosensValue(injector)
|
t = TriggerAutosensValue(injector)
|
||||||
t.autosens.value = 390.0
|
t.autosens.value = 390.0
|
||||||
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_GREATER
|
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_GREATER
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerAutosensValue(injector)
|
t = TriggerAutosensValue(injector)
|
||||||
t.autosens.value = 20.0
|
t.autosens.value = 20.0
|
||||||
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_GREATER
|
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_GREATER
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerAutosensValue(injector)
|
t = TriggerAutosensValue(injector)
|
||||||
t.autosens.value = 390.0
|
t.autosens.value = 390.0
|
||||||
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER
|
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
`when`(autosensDataStore.getLastAutosensData(anyObject(), anyObject(), anyObject())).thenReturn(AutosensDataObject(injector))
|
`when`(autosensDataStore.getLastAutosensData(anyObject(), anyObject(), anyObject())).thenReturn(AutosensDataObject(injector))
|
||||||
t = TriggerAutosensValue(injector)
|
t = TriggerAutosensValue(injector)
|
||||||
t.autosens.value = 80.0
|
t.autosens.value = 80.0
|
||||||
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER
|
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
|
|
||||||
// Test autosensData == null and Comparator == IS_NOT_AVAILABLE
|
// Test autosensData == null and Comparator == IS_NOT_AVAILABLE
|
||||||
`when`(autosensDataStore.getLastAutosensData(anyObject(), anyObject(), anyObject())).thenReturn(null)
|
`when`(autosensDataStore.getLastAutosensData(anyObject(), anyObject(), anyObject())).thenReturn(null)
|
||||||
t = TriggerAutosensValue(injector)
|
t = TriggerAutosensValue(injector)
|
||||||
t.comparator.value = Comparator.Compare.IS_NOT_AVAILABLE
|
t.comparator.value = Comparator.Compare.IS_NOT_AVAILABLE
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -75,8 +75,8 @@ class TriggerAutosensValueTest : TriggerTestBase() {
|
||||||
t.autosens.value = 213.0
|
t.autosens.value = 213.0
|
||||||
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER
|
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER
|
||||||
val t1 = t.duplicate() as TriggerAutosensValue
|
val t1 = t.duplicate() as TriggerAutosensValue
|
||||||
Assertions.assertEquals(213.0, t1.autosens.value, 0.01)
|
assertThat(t1.autosens.value).isWithin(0.01).of(213.0)
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
|
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var asJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"value\":410},\"type\":\"TriggerAutosensValue\"}"
|
private var asJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"value\":410},\"type\":\"TriggerAutosensValue\"}"
|
||||||
|
@ -86,7 +86,7 @@ class TriggerAutosensValueTest : TriggerTestBase() {
|
||||||
val t = TriggerAutosensValue(injector)
|
val t = TriggerAutosensValue(injector)
|
||||||
t.autosens.value = 410.0
|
t.autosens.value = 410.0
|
||||||
t.comparator.value = Comparator.Compare.IS_EQUAL
|
t.comparator.value = Comparator.Compare.IS_EQUAL
|
||||||
Assertions.assertEquals(asJson, t.toJSON())
|
JSONAssert.assertEquals(asJson, t.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -95,15 +95,13 @@ class TriggerAutosensValueTest : TriggerTestBase() {
|
||||||
t.autosens.value = 410.0
|
t.autosens.value = 410.0
|
||||||
t.comparator.value = Comparator.Compare.IS_EQUAL
|
t.comparator.value = Comparator.Compare.IS_EQUAL
|
||||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerAutosensValue
|
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerAutosensValue
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
|
assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(410.0, t2.autosens.value, 0.01)
|
assertThat(t2.autosens.value).isWithin(0.01).of(410.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
assertThat(TriggerAutosensValue(injector).icon().get()).isEqualTo(R.drawable.ic_as)
|
assertThat(TriggerAutosensValue(injector).icon().get()).isEqualTo(R.drawable.ic_as)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun generateAutosensData(): AutosensDataObject {
|
private fun generateAutosensData() = AutosensDataObject(injector)
|
||||||
return AutosensDataObject(injector)
|
|
||||||
}
|
|
||||||
}
|
}
|
|
@ -3,8 +3,8 @@ package app.aaps.plugins.automation.triggers
|
||||||
import app.aaps.plugins.automation.elements.ComparatorConnect
|
import app.aaps.plugins.automation.elements.ComparatorConnect
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class TriggerBTDeviceTest : TriggerTestBase() {
|
class TriggerBTDeviceTest : TriggerTestBase() {
|
||||||
|
|
||||||
|
@ -19,14 +19,14 @@ class TriggerBTDeviceTest : TriggerTestBase() {
|
||||||
@Test fun toJSON() {
|
@Test fun toJSON() {
|
||||||
val t = TriggerBTDevice(injector)
|
val t = TriggerBTDevice(injector)
|
||||||
t.btDevice.value = someName
|
t.btDevice.value = someName
|
||||||
Assertions.assertEquals(btJson, t.toJSON())
|
JSONAssert.assertEquals(btJson, t.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun fromJSON() {
|
fun fromJSON() {
|
||||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(btJson)) as TriggerBTDevice
|
val t2 = TriggerDummy(injector).instantiate(JSONObject(btJson)) as TriggerBTDevice
|
||||||
Assertions.assertEquals(ComparatorConnect.Compare.ON_CONNECT, t2.comparator.value)
|
assertThat(t2.comparator.value).isEqualTo(ComparatorConnect.Compare.ON_CONNECT)
|
||||||
Assertions.assertEquals("Headset", t2.btDevice.value)
|
assertThat(t2.btDevice.value).isEqualTo("Headset")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -40,7 +40,7 @@ class TriggerBTDeviceTest : TriggerTestBase() {
|
||||||
it.btDevice.value = someName
|
it.btDevice.value = someName
|
||||||
}
|
}
|
||||||
val t1 = t.duplicate() as TriggerBTDevice
|
val t1 = t.duplicate() as TriggerBTDevice
|
||||||
Assertions.assertEquals("Headset", t1.btDevice.value)
|
assertThat(t1.btDevice.value).isEqualTo("Headset")
|
||||||
Assertions.assertEquals(ComparatorConnect.Compare.ON_DISCONNECT, t.comparator.value)
|
assertThat(t.comparator.value).isEqualTo(ComparatorConnect.Compare.ON_DISCONNECT)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,10 +6,11 @@ import app.aaps.database.entities.GlucoseValue
|
||||||
import app.aaps.plugins.automation.elements.Comparator
|
import app.aaps.plugins.automation.elements.Comparator
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class TriggerBgTest : TriggerTestBase() {
|
class TriggerBgTest : TriggerTestBase() {
|
||||||
|
|
||||||
|
@ -22,37 +23,37 @@ class TriggerBgTest : TriggerTestBase() {
|
||||||
fun shouldRunTest() {
|
fun shouldRunTest() {
|
||||||
`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateOneCurrentRecordBgData())
|
`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateOneCurrentRecordBgData())
|
||||||
var t: TriggerBg = TriggerBg(injector).setUnits(GlucoseUnit.MMOL).setValue(4.1).comparator(Comparator.Compare.IS_EQUAL)
|
var t: TriggerBg = TriggerBg(injector).setUnits(GlucoseUnit.MMOL).setValue(4.1).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(214.0).comparator(Comparator.Compare.IS_EQUAL)
|
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(214.0).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(214.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(214.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(214.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(214.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(215.0).comparator(Comparator.Compare.IS_EQUAL)
|
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(215.0).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(215.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(215.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(215.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(215.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(ArrayList())
|
`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(ArrayList())
|
||||||
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerBg(injector).comparator(Comparator.Compare.IS_NOT_AVAILABLE)
|
t = TriggerBg(injector).comparator(Comparator.Compare.IS_NOT_AVAILABLE)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun copyConstructorTest() {
|
fun copyConstructorTest() {
|
||||||
val t: TriggerBg = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
val t: TriggerBg = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
val t1 = t.duplicate() as TriggerBg
|
val t1 = t.duplicate() as TriggerBg
|
||||||
Assertions.assertEquals(213.0, t1.bg.value, 0.01)
|
assertThat(t1.bg.value).isWithin(0.01).of(213.0)
|
||||||
Assertions.assertEquals(GlucoseUnit.MGDL, t1.bg.units)
|
assertThat(t1.bg.units).isEqualTo(GlucoseUnit.MGDL)
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
|
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var bgJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"bg\":4.1,\"units\":\"mmol\"},\"type\":\"TriggerBg\"}"
|
private var bgJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"bg\":4.1,\"units\":\"mmol\"},\"type\":\"TriggerBg\"}"
|
||||||
|
@ -60,16 +61,16 @@ class TriggerBgTest : TriggerTestBase() {
|
||||||
@Test
|
@Test
|
||||||
fun toJSONTest() {
|
fun toJSONTest() {
|
||||||
val t: TriggerBg = TriggerBg(injector).setUnits(GlucoseUnit.MMOL).setValue(4.1).comparator(Comparator.Compare.IS_EQUAL)
|
val t: TriggerBg = TriggerBg(injector).setUnits(GlucoseUnit.MMOL).setValue(4.1).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(bgJson, t.toJSON())
|
JSONAssert.assertEquals(bgJson, t.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun fromJSONTest() {
|
fun fromJSONTest() {
|
||||||
val t: TriggerBg = TriggerBg(injector).setUnits(GlucoseUnit.MMOL).setValue(4.1).comparator(Comparator.Compare.IS_EQUAL)
|
val t: TriggerBg = TriggerBg(injector).setUnits(GlucoseUnit.MMOL).setValue(4.1).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerBg
|
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerBg
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
|
assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(4.1, t2.bg.value, 0.01)
|
assertThat(t2.bg.value).isWithin(0.01).of(4.1)
|
||||||
Assertions.assertEquals(GlucoseUnit.MMOL, t2.bg.units)
|
assertThat(t2.bg.units).isEqualTo(GlucoseUnit.MMOL)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -7,9 +7,9 @@ import com.google.common.truth.Truth.assertThat
|
||||||
import io.reactivex.rxjava3.core.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class TriggerBolusAgoTest : TriggerTestBase() {
|
class TriggerBolusAgoTest : TriggerTestBase() {
|
||||||
|
|
||||||
|
@ -29,26 +29,26 @@ class TriggerBolusAgoTest : TriggerTestBase() {
|
||||||
)
|
)
|
||||||
`when`(dateUtil.now()).thenReturn(now + 10 * 60 * 1000) // set current time to now + 10 min
|
`when`(dateUtil.now()).thenReturn(now + 10 * 60 * 1000) // set current time to now + 10 min
|
||||||
var t = TriggerBolusAgo(injector).setValue(110).comparator(Comparator.Compare.IS_EQUAL)
|
var t = TriggerBolusAgo(injector).setValue(110).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(110, t.minutesAgo.value)
|
assertThat(t.minutesAgo.value).isEqualTo(110)
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t.comparator.value)
|
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerBolusAgo(injector).setValue(10).comparator(Comparator.Compare.IS_EQUAL)
|
t = TriggerBolusAgo(injector).setValue(10).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(10, t.minutesAgo.value)
|
assertThat(t.minutesAgo.value).isEqualTo(10)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerBolusAgo(injector).setValue(5).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
t = TriggerBolusAgo(injector).setValue(5).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerBolusAgo(injector).setValue(310).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerBolusAgo(injector).setValue(310).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerBolusAgo(injector).setValue(420).comparator(Comparator.Compare.IS_EQUAL)
|
t = TriggerBolusAgo(injector).setValue(420).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerBolusAgo(injector).setValue(390).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerBolusAgo(injector).setValue(390).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerBolusAgo(injector).setValue(390).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
t = TriggerBolusAgo(injector).setValue(390).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerBolusAgo(injector).setValue(2).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
t = TriggerBolusAgo(injector).setValue(2).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerBolusAgo(injector).setValue(390).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerBolusAgo(injector).setValue(390).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
// Set last bolus time to 0
|
// Set last bolus time to 0
|
||||||
`when`(repository.getLastBolusRecordOfTypeWrapped(Bolus.Type.NORMAL)).thenReturn(
|
`when`(repository.getLastBolusRecordOfTypeWrapped(Bolus.Type.NORMAL)).thenReturn(
|
||||||
Single.just(
|
Single.just(
|
||||||
|
@ -62,27 +62,27 @@ class TriggerBolusAgoTest : TriggerTestBase() {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
t = TriggerBolusAgo(injector).comparator(Comparator.Compare.IS_NOT_AVAILABLE)
|
t = TriggerBolusAgo(injector).comparator(Comparator.Compare.IS_NOT_AVAILABLE)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun copyConstructorTest() {
|
@Test fun copyConstructorTest() {
|
||||||
val t: TriggerBolusAgo = TriggerBolusAgo(injector).setValue(213).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
val t: TriggerBolusAgo = TriggerBolusAgo(injector).setValue(213).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
val t1 = t.duplicate() as TriggerBolusAgo
|
val t1 = t.duplicate() as TriggerBolusAgo
|
||||||
Assertions.assertEquals(213, t1.minutesAgo.value)
|
assertThat(t1.minutesAgo.value).isEqualTo(213)
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
|
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var lbJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"minutesAgo\":410},\"type\":\"TriggerBolusAgo\"}"
|
private var lbJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"minutesAgo\":410},\"type\":\"TriggerBolusAgo\"}"
|
||||||
@Test fun toJSONTest() {
|
@Test fun toJSONTest() {
|
||||||
val t: TriggerBolusAgo = TriggerBolusAgo(injector).setValue(410).comparator(Comparator.Compare.IS_EQUAL)
|
val t: TriggerBolusAgo = TriggerBolusAgo(injector).setValue(410).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(lbJson, t.toJSON())
|
JSONAssert.assertEquals(lbJson, t.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Throws(JSONException::class) fun fromJSONTest() {
|
@Test @Throws(JSONException::class) fun fromJSONTest() {
|
||||||
val t: TriggerBolusAgo = TriggerBolusAgo(injector).setValue(410).comparator(Comparator.Compare.IS_EQUAL)
|
val t: TriggerBolusAgo = TriggerBolusAgo(injector).setValue(410).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerBolusAgo
|
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerBolusAgo
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
|
assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(410, t2.minutesAgo.value)
|
assertThat(t2.minutesAgo.value).isEqualTo(410)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
|
|
|
@ -4,11 +4,11 @@ import app.aaps.core.interfaces.iob.CobInfo
|
||||||
import app.aaps.plugins.automation.elements.Comparator
|
import app.aaps.plugins.automation.elements.Comparator
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.ArgumentMatchers
|
import org.mockito.ArgumentMatchers
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class TriggerCOBTest : TriggerTestBase() {
|
class TriggerCOBTest : TriggerTestBase() {
|
||||||
|
|
||||||
|
@ -20,41 +20,41 @@ class TriggerCOBTest : TriggerTestBase() {
|
||||||
// COB value is 6
|
// COB value is 6
|
||||||
`when`(iobCobCalculator.getCobInfo("AutomationTriggerCOB")).thenReturn(CobInfo(0, 6.0, 2.0))
|
`when`(iobCobCalculator.getCobInfo("AutomationTriggerCOB")).thenReturn(CobInfo(0, 6.0, 2.0))
|
||||||
var t: TriggerCOB = TriggerCOB(injector).setValue(1.0).comparator(Comparator.Compare.IS_EQUAL)
|
var t: TriggerCOB = TriggerCOB(injector).setValue(1.0).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerCOB(injector).setValue(6.0).comparator(Comparator.Compare.IS_EQUAL)
|
t = TriggerCOB(injector).setValue(6.0).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerCOB(injector).setValue(5.0).comparator(Comparator.Compare.IS_GREATER)
|
t = TriggerCOB(injector).setValue(5.0).comparator(Comparator.Compare.IS_GREATER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerCOB(injector).setValue(5.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
t = TriggerCOB(injector).setValue(5.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerCOB(injector).setValue(6.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerCOB(injector).setValue(6.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerCOB(injector).setValue(1.0).comparator(Comparator.Compare.IS_EQUAL)
|
t = TriggerCOB(injector).setValue(1.0).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerCOB(injector).setValue(10.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerCOB(injector).setValue(10.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerCOB(injector).setValue(5.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerCOB(injector).setValue(5.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun copyConstructorTest() {
|
@Test fun copyConstructorTest() {
|
||||||
val t: TriggerCOB = TriggerCOB(injector).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
val t: TriggerCOB = TriggerCOB(injector).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertEquals(213.0, t.cob.value, 0.01)
|
assertThat(t.cob.value).isWithin(0.01).of(213.0)
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
|
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var bgJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"carbs\":4},\"type\":\"TriggerCOB\"}"
|
private var bgJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"carbs\":4},\"type\":\"TriggerCOB\"}"
|
||||||
@Test fun toJSONTest() {
|
@Test fun toJSONTest() {
|
||||||
val t: TriggerCOB = TriggerCOB(injector).setValue(4.0).comparator(Comparator.Compare.IS_EQUAL)
|
val t: TriggerCOB = TriggerCOB(injector).setValue(4.0).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(bgJson, t.toJSON())
|
JSONAssert.assertEquals(bgJson, t.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun fromJSONTest() {
|
fun fromJSONTest() {
|
||||||
val t: TriggerCOB = TriggerCOB(injector).setValue(4.0).comparator(Comparator.Compare.IS_EQUAL)
|
val t: TriggerCOB = TriggerCOB(injector).setValue(4.0).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerCOB
|
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerCOB
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
|
assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(4.0, t2.cob.value, 0.01)
|
assertThat(t2.cob.value).isWithin(0.01).of(4.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package app.aaps.plugins.automation.triggers
|
package app.aaps.plugins.automation.triggers
|
||||||
|
|
||||||
|
import kotlin.test.assertIs
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class TriggerDummyTest : TriggerTestBase() {
|
class TriggerDummyTest : TriggerTestBase() {
|
||||||
|
@ -9,13 +9,13 @@ class TriggerDummyTest : TriggerTestBase() {
|
||||||
@Test
|
@Test
|
||||||
fun instantiateTest() {
|
fun instantiateTest() {
|
||||||
var trigger: Trigger? = TriggerDummy(injector).instantiate(JSONObject("{\"data\":{},\"type\":\"info.nightscout.androidaps.plugins.general.automation.triggers.TriggerDummy\"}"))
|
var trigger: Trigger? = TriggerDummy(injector).instantiate(JSONObject("{\"data\":{},\"type\":\"info.nightscout.androidaps.plugins.general.automation.triggers.TriggerDummy\"}"))
|
||||||
Assertions.assertTrue(trigger is TriggerDummy)
|
assertIs<TriggerDummy>(trigger)
|
||||||
|
|
||||||
trigger = TriggerDummy(injector).instantiate(JSONObject("{\"data\":{},\"type\":\"app.aaps.plugins.automation.triggers.TriggerDummy\"}"))
|
trigger = TriggerDummy(injector).instantiate(JSONObject("{\"data\":{},\"type\":\"app.aaps.plugins.automation.triggers.TriggerDummy\"}"))
|
||||||
Assertions.assertTrue(trigger is TriggerDummy)
|
assertIs<TriggerDummy>(trigger)
|
||||||
|
|
||||||
trigger = TriggerDummy(injector).instantiate(JSONObject("{\"data\":{},\"type\":\"TriggerDummy\"}"))
|
trigger = TriggerDummy(injector).instantiate(JSONObject("{\"data\":{},\"type\":\"TriggerDummy\"}"))
|
||||||
Assertions.assertTrue(trigger is TriggerDummy)
|
assertIs<TriggerDummy>(trigger)
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -3,19 +3,20 @@ package app.aaps.plugins.automation.triggers
|
||||||
import app.aaps.database.entities.HeartRate
|
import app.aaps.database.entities.HeartRate
|
||||||
import app.aaps.plugins.automation.R
|
import app.aaps.plugins.automation.R
|
||||||
import app.aaps.plugins.automation.elements.Comparator
|
import app.aaps.plugins.automation.elements.Comparator
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import io.reactivex.rxjava3.core.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito.verify
|
import org.mockito.Mockito.verify
|
||||||
import org.mockito.Mockito.verifyNoMoreInteractions
|
import org.mockito.Mockito.verifyNoMoreInteractions
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class TriggerHeartRateTest : TriggerTestBase() {
|
class TriggerHeartRateTest : TriggerTestBase() {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun friendlyName() {
|
fun friendlyName() {
|
||||||
Assertions.assertEquals(R.string.triggerHeartRate, TriggerHeartRate(injector).friendlyName())
|
assertThat(TriggerHeartRate(injector).friendlyName()).isEqualTo(R.string.triggerHeartRate)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -23,7 +24,7 @@ class TriggerHeartRateTest : TriggerTestBase() {
|
||||||
val t = TriggerHeartRate(injector)
|
val t = TriggerHeartRate(injector)
|
||||||
`when`(rh.gs(Comparator.Compare.IS_EQUAL_OR_GREATER.stringRes)).thenReturn(">")
|
`when`(rh.gs(Comparator.Compare.IS_EQUAL_OR_GREATER.stringRes)).thenReturn(">")
|
||||||
`when`(rh.gs(R.string.triggerHeartRateDesc, ">", 80.0)).thenReturn("test")
|
`when`(rh.gs(R.string.triggerHeartRateDesc, ">", 80.0)).thenReturn("test")
|
||||||
Assertions.assertEquals("test", t.friendlyDescription())
|
assertThat(t.friendlyDescription()).isEqualTo("test")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -33,16 +34,16 @@ class TriggerHeartRateTest : TriggerTestBase() {
|
||||||
comparator.value = Comparator.Compare.IS_GREATER
|
comparator.value = Comparator.Compare.IS_GREATER
|
||||||
}
|
}
|
||||||
val dup = t.duplicate() as TriggerHeartRate
|
val dup = t.duplicate() as TriggerHeartRate
|
||||||
Assertions.assertNotSame(t, dup)
|
assertThat(dup).isNotSameInstanceAs(t)
|
||||||
Assertions.assertEquals(100.0, dup.heartRate.value, 0.01)
|
assertThat(dup.heartRate.value).isWithin(0.01).of(100.0)
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_GREATER, dup.comparator.value)
|
assertThat(dup.comparator.value).isEqualTo(Comparator.Compare.IS_GREATER)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun shouldRunNotAvailable() {
|
fun shouldRunNotAvailable() {
|
||||||
val t = TriggerHeartRate(injector).apply { comparator.value = Comparator.Compare.IS_NOT_AVAILABLE }
|
val t = TriggerHeartRate(injector).apply { comparator.value = Comparator.Compare.IS_NOT_AVAILABLE }
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
verifyNoMoreInteractions(repository)
|
verifyNoMoreInteractions(repository)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +54,7 @@ class TriggerHeartRateTest : TriggerTestBase() {
|
||||||
comparator.value = Comparator.Compare.IS_GREATER
|
comparator.value = Comparator.Compare.IS_GREATER
|
||||||
}
|
}
|
||||||
`when`(repository.getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)).thenReturn(Single.just(emptyList()))
|
`when`(repository.getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)).thenReturn(Single.just(emptyList()))
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
verify(repository).getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)
|
verify(repository).getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)
|
||||||
verifyNoMoreInteractions(repository)
|
verifyNoMoreInteractions(repository)
|
||||||
}
|
}
|
||||||
|
@ -69,7 +70,7 @@ class TriggerHeartRateTest : TriggerTestBase() {
|
||||||
HeartRate(duration = 300_000, timestamp = now, beatsPerMinute = 60.0, device = "test"),
|
HeartRate(duration = 300_000, timestamp = now, beatsPerMinute = 60.0, device = "test"),
|
||||||
)
|
)
|
||||||
`when`(repository.getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)).thenReturn(Single.just(hrs))
|
`when`(repository.getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)).thenReturn(Single.just(hrs))
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
verify(repository).getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)
|
verify(repository).getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)
|
||||||
verifyNoMoreInteractions(repository)
|
verifyNoMoreInteractions(repository)
|
||||||
}
|
}
|
||||||
|
@ -84,7 +85,7 @@ class TriggerHeartRateTest : TriggerTestBase() {
|
||||||
HeartRate(duration = 300_000, timestamp = now, beatsPerMinute = 120.0, device = "test"),
|
HeartRate(duration = 300_000, timestamp = now, beatsPerMinute = 120.0, device = "test"),
|
||||||
)
|
)
|
||||||
`when`(repository.getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)).thenReturn(Single.just(hrs))
|
`when`(repository.getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)).thenReturn(Single.just(hrs))
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
verify(repository).getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)
|
verify(repository).getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)
|
||||||
verifyNoMoreInteractions(repository)
|
verifyNoMoreInteractions(repository)
|
||||||
}
|
}
|
||||||
|
@ -95,9 +96,9 @@ class TriggerHeartRateTest : TriggerTestBase() {
|
||||||
heartRate.value = 100.0
|
heartRate.value = 100.0
|
||||||
comparator.value = Comparator.Compare.IS_GREATER
|
comparator.value = Comparator.Compare.IS_GREATER
|
||||||
}
|
}
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_GREATER, t.comparator.value)
|
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_GREATER)
|
||||||
|
|
||||||
Assertions.assertEquals("""{"data":{"comparator":"IS_GREATER","heartRate":100},"type":"TriggerHeartRate"}""".trimMargin(), t.toJSON())
|
JSONAssert.assertEquals("""{"data":{"comparator":"IS_GREATER","heartRate":100},"type":"TriggerHeartRate"}""", t.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -107,7 +108,7 @@ class TriggerHeartRateTest : TriggerTestBase() {
|
||||||
"""{"data":{"comparator":"IS_GREATER","heartRate":100},"type":"TriggerHeartRate"}"""
|
"""{"data":{"comparator":"IS_GREATER","heartRate":100},"type":"TriggerHeartRate"}"""
|
||||||
)
|
)
|
||||||
) as TriggerHeartRate
|
) as TriggerHeartRate
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_GREATER, t.comparator.value)
|
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_GREATER)
|
||||||
Assertions.assertEquals(100.0, t.heartRate.value, 0.01)
|
assertThat(t.heartRate.value).isWithin(0.01).of(100.0)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,11 +5,11 @@ import app.aaps.plugins.automation.R
|
||||||
import app.aaps.plugins.automation.elements.Comparator
|
import app.aaps.plugins.automation.elements.Comparator
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.ArgumentMatchers
|
import org.mockito.ArgumentMatchers
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class TriggerIobTest : TriggerTestBase() {
|
class TriggerIobTest : TriggerTestBase() {
|
||||||
|
|
||||||
|
@ -20,43 +20,43 @@ class TriggerIobTest : TriggerTestBase() {
|
||||||
@Test fun shouldRunTest() {
|
@Test fun shouldRunTest() {
|
||||||
`when`(iobCobCalculator.calculateFromTreatmentsAndTemps(ArgumentMatchers.anyLong(), anyObject())).thenReturn(generateIobRecordData())
|
`when`(iobCobCalculator.calculateFromTreatmentsAndTemps(ArgumentMatchers.anyLong(), anyObject())).thenReturn(generateIobRecordData())
|
||||||
var t: TriggerIob = TriggerIob(injector).setValue(1.1).comparator(Comparator.Compare.IS_EQUAL)
|
var t: TriggerIob = TriggerIob(injector).setValue(1.1).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerIob(injector).setValue(1.0).comparator(Comparator.Compare.IS_EQUAL)
|
t = TriggerIob(injector).setValue(1.0).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerIob(injector).setValue(0.8).comparator(Comparator.Compare.IS_GREATER)
|
t = TriggerIob(injector).setValue(0.8).comparator(Comparator.Compare.IS_GREATER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerIob(injector).setValue(0.8).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
t = TriggerIob(injector).setValue(0.8).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerIob(injector).setValue(0.9).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
t = TriggerIob(injector).setValue(0.9).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerIob(injector).setValue(1.2).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerIob(injector).setValue(1.2).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerIob(injector).setValue(1.1).comparator(Comparator.Compare.IS_EQUAL)
|
t = TriggerIob(injector).setValue(1.1).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerIob(injector).setValue(1.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerIob(injector).setValue(1.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerIob(injector).setValue(0.9).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerIob(injector).setValue(0.9).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun copyConstructorTest() {
|
@Test fun copyConstructorTest() {
|
||||||
val t: TriggerIob = TriggerIob(injector).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
val t: TriggerIob = TriggerIob(injector).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertEquals(213.0, t.insulin.value, 0.01)
|
assertThat(t.insulin.value).isWithin(0.01).of(213.0)
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
|
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var bgJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"insulin\":4.1},\"type\":\"TriggerIob\"}"
|
private var bgJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"insulin\":4.1},\"type\":\"TriggerIob\"}"
|
||||||
@Test fun toJSONTest() {
|
@Test fun toJSONTest() {
|
||||||
val t: TriggerIob = TriggerIob(injector).setValue(4.1).comparator(Comparator.Compare.IS_EQUAL)
|
val t: TriggerIob = TriggerIob(injector).setValue(4.1).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(bgJson, t.toJSON())
|
JSONAssert.assertEquals(bgJson, t.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun fromJSONTest() {
|
fun fromJSONTest() {
|
||||||
val t: TriggerIob = TriggerIob(injector).setValue(4.1).comparator(Comparator.Compare.IS_EQUAL)
|
val t: TriggerIob = TriggerIob(injector).setValue(4.1).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerIob
|
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerIob
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
|
assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(4.1, t2.insulin.value, 0.01)
|
assertThat(t2.insulin.value).isWithin(0.01).of(4.1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
|
|
|
@ -6,7 +6,6 @@ import app.aaps.plugins.automation.elements.InputLocationMode
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
@ -24,10 +23,10 @@ class TriggerLocationTest : TriggerTestBase() {
|
||||||
t.distance.setValue(2.0)
|
t.distance.setValue(2.0)
|
||||||
t.modeSelected.value = InputLocationMode.Mode.INSIDE
|
t.modeSelected.value = InputLocationMode.Mode.INSIDE
|
||||||
val t1 = t.duplicate() as TriggerLocation
|
val t1 = t.duplicate() as TriggerLocation
|
||||||
Assertions.assertEquals(213.0, t1.latitude.value, 0.01)
|
assertThat(t1.latitude.value).isWithin(0.01).of(213.0)
|
||||||
Assertions.assertEquals(212.0, t1.longitude.value, 0.01)
|
assertThat(t1.longitude.value).isWithin(0.01).of(212.0)
|
||||||
Assertions.assertEquals(2.0, t1.distance.value, 0.01)
|
assertThat(t1.distance.value).isWithin(0.01).of(2.0)
|
||||||
Assertions.assertEquals(InputLocationMode.Mode.INSIDE, t1.modeSelected.value)
|
assertThat(t1.modeSelected.value).isEqualTo(InputLocationMode.Mode.INSIDE)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun shouldRunTest() {
|
@Test fun shouldRunTest() {
|
||||||
|
@ -37,12 +36,12 @@ class TriggerLocationTest : TriggerTestBase() {
|
||||||
t.distance.setValue(2.0)
|
t.distance.setValue(2.0)
|
||||||
// t.modeSelected.setValue(InputLocationMode.Mode.OUTSIDE);
|
// t.modeSelected.setValue(InputLocationMode.Mode.OUTSIDE);
|
||||||
`when`(locationDataContainer.lastLocation).thenReturn(null)
|
`when`(locationDataContainer.lastLocation).thenReturn(null)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
`when`(locationDataContainer.lastLocation).thenReturn(mockedLocation())
|
`when`(locationDataContainer.lastLocation).thenReturn(mockedLocation())
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerLocation(injector)
|
t = TriggerLocation(injector)
|
||||||
t.distance.setValue(-500.0)
|
t.distance.setValue(-500.0)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
|
|
||||||
//Test of GOING_IN - last mode should be OUTSIDE, and current mode should be INSIDE
|
//Test of GOING_IN - last mode should be OUTSIDE, and current mode should be INSIDE
|
||||||
t = TriggerLocation(injector)
|
t = TriggerLocation(injector)
|
||||||
|
@ -51,9 +50,9 @@ class TriggerLocationTest : TriggerTestBase() {
|
||||||
`when`(locationDataContainer.lastLocation).thenReturn(null)
|
`when`(locationDataContainer.lastLocation).thenReturn(null)
|
||||||
`when`(locationDataContainer.lastLocation).thenReturn(mockedLocationOut())
|
`when`(locationDataContainer.lastLocation).thenReturn(mockedLocationOut())
|
||||||
t.modeSelected.value = InputLocationMode.Mode.GOING_IN
|
t.modeSelected.value = InputLocationMode.Mode.GOING_IN
|
||||||
Assertions.assertEquals(t.lastMode, InputLocationMode.Mode.OUTSIDE)
|
assertThat(InputLocationMode.Mode.OUTSIDE).isEqualTo(t.lastMode)
|
||||||
Assertions.assertEquals(t.currentMode(5.0), InputLocationMode.Mode.INSIDE)
|
assertThat(InputLocationMode.Mode.INSIDE).isEqualTo(t.currentMode(5.0))
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
|
|
||||||
//Test of GOING_OUT - last mode should be INSIDE, and current mode should be OUTSIDE
|
//Test of GOING_OUT - last mode should be INSIDE, and current mode should be OUTSIDE
|
||||||
// Currently unavailable due to problems with Location mocking
|
// Currently unavailable due to problems with Location mocking
|
||||||
|
@ -67,7 +66,7 @@ class TriggerLocationTest : TriggerTestBase() {
|
||||||
t.distance.setValue(2.0)
|
t.distance.setValue(2.0)
|
||||||
t.modeSelected.value = InputLocationMode.Mode.OUTSIDE
|
t.modeSelected.value = InputLocationMode.Mode.OUTSIDE
|
||||||
// t.modeSelected = t.modeSelected.value
|
// t.modeSelected = t.modeSelected.value
|
||||||
Assertions.assertEquals(locationJson, t.toJSON())
|
assertThat(t.toJSON()).isEqualTo(locationJson)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Throws(JSONException::class) fun fromJSONTest() {
|
@Test @Throws(JSONException::class) fun fromJSONTest() {
|
||||||
|
@ -77,18 +76,18 @@ class TriggerLocationTest : TriggerTestBase() {
|
||||||
t.distance.setValue(2.0)
|
t.distance.setValue(2.0)
|
||||||
t.modeSelected.value = InputLocationMode.Mode.INSIDE
|
t.modeSelected.value = InputLocationMode.Mode.INSIDE
|
||||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerLocation
|
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerLocation
|
||||||
Assertions.assertEquals(t.latitude.value, t2.latitude.value, 0.01)
|
assertThat(t2.latitude.value).isWithin(0.01).of(t.latitude.value)
|
||||||
Assertions.assertEquals(t.longitude.value, t2.longitude.value, 0.01)
|
assertThat(t2.longitude.value).isWithin(0.01).of(t.longitude.value)
|
||||||
Assertions.assertEquals(t.distance.value, t2.distance.value, 0.01)
|
assertThat(t2.distance.value).isWithin(0.01).of(t.distance.value)
|
||||||
Assertions.assertEquals(t.modeSelected.value, t2.modeSelected.value)
|
assertThat(t2.modeSelected.value).isEqualTo(t.modeSelected.value)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyNameTest() {
|
@Test fun friendlyNameTest() {
|
||||||
Assertions.assertEquals(R.string.location, TriggerLocation(injector).friendlyName())
|
assertThat(TriggerLocation(injector).friendlyName()).isEqualTo(R.string.location)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyDescriptionTest() {
|
@Test fun friendlyDescriptionTest() {
|
||||||
Assertions.assertEquals(null, TriggerLocation(injector).friendlyDescription()) //not mocked }
|
assertThat(TriggerLocation(injector).friendlyDescription()).isNull() //not mocked }
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
|
|
|
@ -4,10 +4,10 @@ import app.aaps.plugins.automation.R
|
||||||
import app.aaps.plugins.automation.elements.Comparator
|
import app.aaps.plugins.automation.elements.Comparator
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class TriggerProfilePercentTest : TriggerTestBase() {
|
class TriggerProfilePercentTest : TriggerTestBase() {
|
||||||
|
|
||||||
|
@ -17,43 +17,43 @@ class TriggerProfilePercentTest : TriggerTestBase() {
|
||||||
|
|
||||||
@Test fun shouldRunTest() {
|
@Test fun shouldRunTest() {
|
||||||
var t: TriggerProfilePercent = TriggerProfilePercent(injector).setValue(101.0).comparator(Comparator.Compare.IS_EQUAL)
|
var t: TriggerProfilePercent = TriggerProfilePercent(injector).setValue(101.0).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerProfilePercent(injector).setValue(100.0).comparator(Comparator.Compare.IS_EQUAL)
|
t = TriggerProfilePercent(injector).setValue(100.0).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerProfilePercent(injector).setValue(100.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
t = TriggerProfilePercent(injector).setValue(100.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerProfilePercent(injector).setValue(90.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
t = TriggerProfilePercent(injector).setValue(90.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerProfilePercent(injector).setValue(100.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerProfilePercent(injector).setValue(100.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerProfilePercent(injector).setValue(101.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerProfilePercent(injector).setValue(101.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerProfilePercent(injector).setValue(215.0).comparator(Comparator.Compare.IS_EQUAL)
|
t = TriggerProfilePercent(injector).setValue(215.0).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerProfilePercent(injector).setValue(110.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
t = TriggerProfilePercent(injector).setValue(110.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerProfilePercent(injector).setValue(90.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerProfilePercent(injector).setValue(90.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun copyConstructorTest() {
|
@Test fun copyConstructorTest() {
|
||||||
val t: TriggerProfilePercent = TriggerProfilePercent(injector).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
val t: TriggerProfilePercent = TriggerProfilePercent(injector).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
val t1 = t.duplicate() as TriggerProfilePercent
|
val t1 = t.duplicate() as TriggerProfilePercent
|
||||||
Assertions.assertEquals(213.0, t1.pct.value, 0.01)
|
assertThat( t1.pct.value).isWithin(0.01).of(213.0)
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
|
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
}
|
}
|
||||||
|
|
||||||
private val bgJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"percentage\":110},\"type\":\"TriggerProfilePercent\"}"
|
private val bgJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"percentage\":110},\"type\":\"TriggerProfilePercent\"}"
|
||||||
@Test fun toJSONTest() {
|
@Test fun toJSONTest() {
|
||||||
val t: TriggerProfilePercent = TriggerProfilePercent(injector).setValue(110.0).comparator(Comparator.Compare.IS_EQUAL)
|
val t: TriggerProfilePercent = TriggerProfilePercent(injector).setValue(110.0).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(bgJson, t.toJSON())
|
JSONAssert.assertEquals(bgJson, t.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun fromJSONTest() {
|
@Test fun fromJSONTest() {
|
||||||
val t: TriggerProfilePercent = TriggerProfilePercent(injector).setValue(120.0).comparator(Comparator.Compare.IS_EQUAL)
|
val t: TriggerProfilePercent = TriggerProfilePercent(injector).setValue(120.0).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerProfilePercent
|
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerProfilePercent
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
|
assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(120.0, t2.pct.value, 0.01)
|
assertThat(t2.pct.value).isWithin(0.01).of(120.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
|
@ -61,6 +61,6 @@ class TriggerProfilePercentTest : TriggerTestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyNameTest() {
|
@Test fun friendlyNameTest() {
|
||||||
Assertions.assertEquals(R.string.profilepercentage, TriggerProfilePercent(injector).friendlyName()) // not mocked
|
assertThat(TriggerProfilePercent(injector).friendlyName()).isEqualTo(R.string.profilepercentage) // not mocked
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,9 +4,9 @@ import app.aaps.plugins.automation.R
|
||||||
import app.aaps.plugins.automation.elements.Comparator
|
import app.aaps.plugins.automation.elements.Comparator
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class TriggerPumpLastConnectionTest : TriggerTestBase() {
|
class TriggerPumpLastConnectionTest : TriggerTestBase() {
|
||||||
|
|
||||||
|
@ -14,42 +14,42 @@ class TriggerPumpLastConnectionTest : TriggerTestBase() {
|
||||||
fun shouldRunTest() {
|
fun shouldRunTest() {
|
||||||
// System.currentTimeMillis() is always 0
|
// System.currentTimeMillis() is always 0
|
||||||
// and so is every last connection time
|
// and so is every last connection time
|
||||||
Assertions.assertEquals(0L, testPumpPlugin.lastDataTime())
|
assertThat(testPumpPlugin.lastDataTime()).isEqualTo(0L)
|
||||||
`when`(dateUtil.now()).thenReturn(now + 10 * 60 * 1000) // set current time to now + 10 min
|
`when`(dateUtil.now()).thenReturn(now + 10 * 60 * 1000) // set current time to now + 10 min
|
||||||
var t = TriggerPumpLastConnection(injector).setValue(110).comparator(Comparator.Compare.IS_EQUAL)
|
var t = TriggerPumpLastConnection(injector).setValue(110).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(110, t.minutesAgo.value)
|
assertThat(t.minutesAgo.value).isEqualTo(110)
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t.comparator.value)
|
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerPumpLastConnection(injector).setValue(10).comparator(Comparator.Compare.IS_EQUAL)
|
t = TriggerPumpLastConnection(injector).setValue(10).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(10, t.minutesAgo.value)
|
assertThat(t.minutesAgo.value).isEqualTo(10)
|
||||||
Assertions.assertFalse(t.shouldRun()) // 0 == 10 -> FALSE
|
assertThat(t.shouldRun()).isFalse() // 0 == 10 -> FALSE
|
||||||
t = TriggerPumpLastConnection(injector).setValue(5).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
t = TriggerPumpLastConnection(injector).setValue(5).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
||||||
Assertions.assertTrue(t.shouldRun()) // 5 => 0 -> TRUE
|
assertThat(t.shouldRun()).isTrue() // 5 => 0 -> TRUE
|
||||||
t = TriggerPumpLastConnection(injector).setValue(310).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerPumpLastConnection(injector).setValue(310).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertFalse(t.shouldRun()) // 310 <= 0 -> FALSE
|
assertThat(t.shouldRun()).isFalse() // 310 <= 0 -> FALSE
|
||||||
t = TriggerPumpLastConnection(injector).setValue(420).comparator(Comparator.Compare.IS_EQUAL)
|
t = TriggerPumpLastConnection(injector).setValue(420).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertFalse(t.shouldRun()) // 420 == 0 -> FALSE
|
assertThat(t.shouldRun()).isFalse() // 420 == 0 -> FALSE
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun copyConstructorTest() {
|
@Test fun copyConstructorTest() {
|
||||||
val t: TriggerPumpLastConnection = TriggerPumpLastConnection(injector).setValue(213).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
val t: TriggerPumpLastConnection = TriggerPumpLastConnection(injector).setValue(213).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
val t1 = t.duplicate() as TriggerPumpLastConnection
|
val t1 = t.duplicate() as TriggerPumpLastConnection
|
||||||
Assertions.assertEquals(213, t1.minutesAgo.value)
|
assertThat(t1.minutesAgo.value).isEqualTo(213)
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
|
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var lbJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"minutesAgo\":410},\"type\":\"TriggerPumpLastConnection\"}"
|
private var lbJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"minutesAgo\":410},\"type\":\"TriggerPumpLastConnection\"}"
|
||||||
@Test fun toJSONTest() {
|
@Test fun toJSONTest() {
|
||||||
val t: TriggerPumpLastConnection = TriggerPumpLastConnection(injector).setValue(410).comparator(Comparator.Compare.IS_EQUAL)
|
val t: TriggerPumpLastConnection = TriggerPumpLastConnection(injector).setValue(410).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(lbJson, t.toJSON())
|
JSONAssert.assertEquals(lbJson, t.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun fromJSONTest() {
|
fun fromJSONTest() {
|
||||||
val t: TriggerPumpLastConnection = TriggerPumpLastConnection(injector).setValue(410).comparator(Comparator.Compare.IS_EQUAL)
|
val t: TriggerPumpLastConnection = TriggerPumpLastConnection(injector).setValue(410).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerPumpLastConnection
|
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerPumpLastConnection
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
|
assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(410, t2.minutesAgo.value)
|
assertThat(t2.minutesAgo.value).isEqualTo(410)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
|
@ -57,6 +57,6 @@ class TriggerPumpLastConnectionTest : TriggerTestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyNameTest() {
|
@Test fun friendlyNameTest() {
|
||||||
Assertions.assertEquals(R.string.automation_trigger_pump_last_connection_label, TriggerPumpLastConnection(injector).friendlyName())
|
assertThat(TriggerPumpLastConnection(injector).friendlyName()).isEqualTo(R.string.automation_trigger_pump_last_connection_label)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,11 +2,12 @@ package app.aaps.plugins.automation.triggers
|
||||||
|
|
||||||
import app.aaps.core.interfaces.utils.MidnightTime
|
import app.aaps.core.interfaces.utils.MidnightTime
|
||||||
import app.aaps.core.interfaces.utils.T
|
import app.aaps.core.interfaces.utils.T
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class TriggerRecurringTimeTest : TriggerTestBase() {
|
class TriggerRecurringTimeTest : TriggerTestBase() {
|
||||||
|
|
||||||
|
@ -19,12 +20,12 @@ class TriggerRecurringTimeTest : TriggerTestBase() {
|
||||||
|
|
||||||
var t: TriggerRecurringTime = TriggerRecurringTime(injector).time(89)
|
var t: TriggerRecurringTime = TriggerRecurringTime(injector).time(89)
|
||||||
t.days.setAll(true)
|
t.days.setAll(true)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
|
|
||||||
// scheduled 1 min before
|
// scheduled 1 min before
|
||||||
t = TriggerRecurringTime(injector).time(94)
|
t = TriggerRecurringTime(injector).time(94)
|
||||||
t.days.setAll(true)
|
t.days.setAll(true)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
private var timeJson =
|
private var timeJson =
|
||||||
|
@ -33,13 +34,13 @@ class TriggerRecurringTimeTest : TriggerTestBase() {
|
||||||
@Test
|
@Test
|
||||||
fun toJSONTest() {
|
fun toJSONTest() {
|
||||||
val t = TriggerRecurringTime(injector).time(4444)
|
val t = TriggerRecurringTime(injector).time(4444)
|
||||||
Assertions.assertEquals(timeJson, t.toJSON())
|
JSONAssert.assertEquals(timeJson, t.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun fromJSONTest() {
|
fun fromJSONTest() {
|
||||||
val t = TriggerRecurringTime(injector).time(4444)
|
val t = TriggerRecurringTime(injector).time(4444)
|
||||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerRecurringTime
|
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerRecurringTime
|
||||||
Assertions.assertEquals(4444, t2.time.value)
|
assertThat(t2.time.value).isEqualTo(4444)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,8 +4,8 @@ import app.aaps.plugins.automation.R
|
||||||
import app.aaps.plugins.automation.elements.ComparatorExists
|
import app.aaps.plugins.automation.elements.ComparatorExists
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class TriggerTempTargetTest : TriggerTestBase() {
|
class TriggerTempTargetTest : TriggerTestBase() {
|
||||||
|
|
||||||
|
@ -13,33 +13,33 @@ class TriggerTempTargetTest : TriggerTestBase() {
|
||||||
@Test fun shouldRunTest() {
|
@Test fun shouldRunTest() {
|
||||||
`when`(repository.getTemporaryTargetActiveAt(anyObject())).thenReturn(null)
|
`when`(repository.getTemporaryTargetActiveAt(anyObject())).thenReturn(null)
|
||||||
var t: TriggerTempTarget = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.EXISTS)
|
var t: TriggerTempTarget = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.EXISTS)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.NOT_EXISTS)
|
t = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.NOT_EXISTS)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
`when`(repository.getTemporaryTargetActiveAt(anyObject())).thenReturn(TemporaryTarget(duration = 0, highTarget = 0.0, lowTarget = 0.0, reason = TemporaryTarget.Reason.CUSTOM, timestamp = 0))
|
`when`(repository.getTemporaryTargetActiveAt(anyObject())).thenReturn(TemporaryTarget(duration = 0, highTarget = 0.0, lowTarget = 0.0, reason = TemporaryTarget.Reason.CUSTOM, timestamp = 0))
|
||||||
t = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.NOT_EXISTS)
|
t = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.NOT_EXISTS)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.EXISTS)
|
t = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.EXISTS)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
@Test fun copyConstructorTest() {
|
@Test fun copyConstructorTest() {
|
||||||
val t: TriggerTempTarget = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.NOT_EXISTS)
|
val t: TriggerTempTarget = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.NOT_EXISTS)
|
||||||
val t1 = t.duplicate() as TriggerTempTarget
|
val t1 = t.duplicate() as TriggerTempTarget
|
||||||
Assertions.assertEquals(ComparatorExists.Compare.NOT_EXISTS, t1.comparator.value)
|
assertThat(t1.comparator.value).isEqualTo(ComparatorExists.Compare.NOT_EXISTS)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var ttJson = "{\"data\":{\"comparator\":\"EXISTS\"},\"type\":\"TriggerTempTarget\"}"
|
private var ttJson = "{\"data\":{\"comparator\":\"EXISTS\"},\"type\":\"TriggerTempTarget\"}"
|
||||||
@Test fun toJSONTest() {
|
@Test fun toJSONTest() {
|
||||||
val t: TriggerTempTarget = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.EXISTS)
|
val t: TriggerTempTarget = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.EXISTS)
|
||||||
Assertions.assertEquals(ttJson, t.toJSON())
|
JSONAssert.assertEquals(ttJson, t.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun fromJSONTest() {
|
fun fromJSONTest() {
|
||||||
val t: TriggerTempTarget = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.NOT_EXISTS)
|
val t: TriggerTempTarget = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.NOT_EXISTS)
|
||||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerTempTarget
|
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerTempTarget
|
||||||
Assertions.assertEquals(ComparatorExists.Compare.NOT_EXISTS, t2.comparator.value)
|
assertThat(t2.comparator.value).isEqualTo(ComparatorExists.Compare.NOT_EXISTS)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
|
|
|
@ -8,10 +8,10 @@ import app.aaps.plugins.automation.elements.Comparator
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import io.reactivex.rxjava3.core.Single
|
import io.reactivex.rxjava3.core.Single
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class TriggerTempTargetValueTest : TriggerTestBase() {
|
class TriggerTempTargetValueTest : TriggerTestBase() {
|
||||||
|
|
||||||
|
@ -36,37 +36,37 @@ class TriggerTempTargetValueTest : TriggerTestBase() {
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
var t: TriggerTempTargetValue = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MMOL).setValue(7.7).comparator(Comparator.Compare.IS_EQUAL)
|
var t: TriggerTempTargetValue = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MMOL).setValue(7.7).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(140.0).comparator(Comparator.Compare.IS_EQUAL)
|
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(140.0).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(140.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(140.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(140.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(140.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(139.0).comparator(Comparator.Compare.IS_EQUAL)
|
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(139.0).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(141.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(141.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(141.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(141.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(139.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(139.0).comparator(Comparator.Compare.IS_EQUAL_OR_GREATER)
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(139.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
t = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(139.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
t = TriggerTempTargetValue(injector).comparator(Comparator.Compare.IS_NOT_AVAILABLE)
|
t = TriggerTempTargetValue(injector).comparator(Comparator.Compare.IS_NOT_AVAILABLE)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
`when`(repository.getTemporaryTargetActiveAt(dateUtil.now())).thenReturn(Single.just(ValueWrapper.Absent()))
|
`when`(repository.getTemporaryTargetActiveAt(dateUtil.now())).thenReturn(Single.just(ValueWrapper.Absent()))
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun copyConstructorTest() {
|
fun copyConstructorTest() {
|
||||||
val t: TriggerTempTargetValue = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(140.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
val t: TriggerTempTargetValue = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(140.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
val t1 = t.duplicate() as TriggerTempTargetValue
|
val t1 = t.duplicate() as TriggerTempTargetValue
|
||||||
Assertions.assertEquals(140.0, t1.ttValue.value, 0.01)
|
assertThat(t1.ttValue.value).isWithin(0.01).of(140.0)
|
||||||
Assertions.assertEquals(GlucoseUnit.MGDL, t1.ttValue.units)
|
assertThat(t1.ttValue.units).isEqualTo(GlucoseUnit.MGDL)
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
|
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
}
|
}
|
||||||
|
|
||||||
private var ttJson = "{\"data\":{\"tt\":7.7,\"comparator\":\"IS_EQUAL\",\"units\":\"mmol\"},\"type\":\"TriggerTempTargetValue\"}"
|
private var ttJson = "{\"data\":{\"tt\":7.7,\"comparator\":\"IS_EQUAL\",\"units\":\"mmol\"},\"type\":\"TriggerTempTargetValue\"}"
|
||||||
|
@ -74,16 +74,16 @@ class TriggerTempTargetValueTest : TriggerTestBase() {
|
||||||
@Test
|
@Test
|
||||||
fun toJSONTest() {
|
fun toJSONTest() {
|
||||||
val t: TriggerTempTargetValue = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MMOL).setValue(7.7).comparator(Comparator.Compare.IS_EQUAL)
|
val t: TriggerTempTargetValue = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MMOL).setValue(7.7).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(ttJson, t.toJSON())
|
JSONAssert.assertEquals(ttJson, t.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun fromJSONTest() {
|
fun fromJSONTest() {
|
||||||
val t: TriggerTempTargetValue = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MMOL).setValue(7.7).comparator(Comparator.Compare.IS_EQUAL)
|
val t: TriggerTempTargetValue = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MMOL).setValue(7.7).comparator(Comparator.Compare.IS_EQUAL)
|
||||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerTempTargetValue
|
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerTempTargetValue
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
|
assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(7.7, t2.ttValue.value, 0.01)
|
assertThat(t2.ttValue.value).isWithin(0.01).of(7.7)
|
||||||
Assertions.assertEquals(GlucoseUnit.MMOL, t2.ttValue.units)
|
assertThat(t2.ttValue.units).isEqualTo(GlucoseUnit.MMOL)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -4,10 +4,10 @@ import app.aaps.core.interfaces.utils.MidnightTime
|
||||||
import app.aaps.plugins.automation.R
|
import app.aaps.plugins.automation.R
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class TriggerTimeRangeTest : TriggerTestBase() {
|
class TriggerTimeRangeTest : TriggerTestBase() {
|
||||||
|
|
||||||
|
@ -25,44 +25,44 @@ class TriggerTimeRangeTest : TriggerTestBase() {
|
||||||
fun shouldRunTest() {
|
fun shouldRunTest() {
|
||||||
// range starts 1 min in the future
|
// range starts 1 min in the future
|
||||||
var t: TriggerTimeRange = TriggerTimeRange(injector).period((now + 1).toInt(), (now + 30).toInt())
|
var t: TriggerTimeRange = TriggerTimeRange(injector).period((now + 1).toInt(), (now + 30).toInt())
|
||||||
Assertions.assertEquals(false, t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
|
|
||||||
// range starts 30 min back
|
// range starts 30 min back
|
||||||
t = TriggerTimeRange(injector).period((now - 30).toInt(), (now + 30).toInt())
|
t = TriggerTimeRange(injector).period((now - 30).toInt(), (now + 30).toInt())
|
||||||
Assertions.assertEquals(true, t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
|
|
||||||
// Period is all day long
|
// Period is all day long
|
||||||
t = TriggerTimeRange(injector).period(1, 1440)
|
t = TriggerTimeRange(injector).period(1, 1440)
|
||||||
Assertions.assertEquals(true, t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun toJSONTest() {
|
fun toJSONTest() {
|
||||||
val t: TriggerTimeRange = TriggerTimeRange(injector).period((now - 1).toInt(), (now + 30).toInt())
|
val t: TriggerTimeRange = TriggerTimeRange(injector).period((now - 1).toInt(), (now + 30).toInt())
|
||||||
Assertions.assertEquals(timeJson, t.toJSON())
|
JSONAssert.assertEquals(timeJson, t.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun fromJSONTest() {
|
fun fromJSONTest() {
|
||||||
val t: TriggerTimeRange = TriggerTimeRange(injector).period(120, 180)
|
val t: TriggerTimeRange = TriggerTimeRange(injector).period(120, 180)
|
||||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerTimeRange
|
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerTimeRange
|
||||||
Assertions.assertEquals((now - 1).toInt(), t2.period(753, 360).range.start)
|
assertThat(t2.period(753, 360).range.start).isEqualTo((now - 1).toInt())
|
||||||
Assertions.assertEquals(360, t2.period(753, 360).range.end)
|
assertThat(t2.period(753, 360).range.end).isEqualTo(360)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun copyConstructorTest() {
|
@Test fun copyConstructorTest() {
|
||||||
val t = TriggerTimeRange(injector)
|
val t = TriggerTimeRange(injector)
|
||||||
t.period(now.toInt(), (now + 30).toInt())
|
t.period(now.toInt(), (now + 30).toInt())
|
||||||
val t1 = t.duplicate() as TriggerTimeRange
|
val t1 = t.duplicate() as TriggerTimeRange
|
||||||
Assertions.assertEquals(now.toInt(), t1.range.start)
|
assertThat(t1.range.start).isEqualTo(now.toInt())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyNameTest() {
|
@Test fun friendlyNameTest() {
|
||||||
Assertions.assertEquals(R.string.time_range, TriggerTimeRange(injector).friendlyName())
|
assertThat(TriggerTimeRange(injector).friendlyName()).isEqualTo(R.string.time_range)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyDescriptionTest() {
|
@Test fun friendlyDescriptionTest() {
|
||||||
Assertions.assertEquals("Time is between 12:34PM and 12:34PM", TriggerTimeRange(injector).friendlyDescription())
|
assertThat(TriggerTimeRange(injector).friendlyDescription()).isEqualTo("Time is between 12:34PM and 12:34PM")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
|
|
|
@ -4,9 +4,9 @@ import app.aaps.core.interfaces.utils.T
|
||||||
import app.aaps.plugins.automation.R
|
import app.aaps.plugins.automation.R
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class TriggerTimeTest : TriggerTestBase() {
|
class TriggerTimeTest : TriggerTestBase() {
|
||||||
|
|
||||||
|
@ -19,11 +19,11 @@ class TriggerTimeTest : TriggerTestBase() {
|
||||||
|
|
||||||
// scheduled 1 min before
|
// scheduled 1 min before
|
||||||
var t: TriggerTime = TriggerTime(injector).runAt(now - T.mins(1).msecs())
|
var t: TriggerTime = TriggerTime(injector).runAt(now - T.mins(1).msecs())
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
|
|
||||||
// scheduled 1 min in the future
|
// scheduled 1 min in the future
|
||||||
t = TriggerTime(injector).runAt(now + T.mins(1).msecs())
|
t = TriggerTime(injector).runAt(now + T.mins(1).msecs())
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
private var timeJson = "{\"data\":{\"runAt\":1656358762000},\"type\":\"TriggerTime\"}"
|
private var timeJson = "{\"data\":{\"runAt\":1656358762000},\"type\":\"TriggerTime\"}"
|
||||||
|
@ -31,14 +31,14 @@ class TriggerTimeTest : TriggerTestBase() {
|
||||||
@Test
|
@Test
|
||||||
fun toJSONTest() {
|
fun toJSONTest() {
|
||||||
val t: TriggerTime = TriggerTime(injector).runAt(now - T.mins(1).msecs())
|
val t: TriggerTime = TriggerTime(injector).runAt(now - T.mins(1).msecs())
|
||||||
Assertions.assertEquals(timeJson, t.toJSON())
|
JSONAssert.assertEquals(timeJson, t.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun fromJSONTest() {
|
fun fromJSONTest() {
|
||||||
val t: TriggerTime = TriggerTime(injector).runAt(now - T.mins(1).msecs())
|
val t: TriggerTime = TriggerTime(injector).runAt(now - T.mins(1).msecs())
|
||||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerTime
|
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerTime
|
||||||
Assertions.assertEquals(now - T.mins(1).msecs(), t2.time.value)
|
assertThat(t2.time.value).isEqualTo(now - T.mins(1).msecs())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@ -46,18 +46,18 @@ class TriggerTimeTest : TriggerTestBase() {
|
||||||
val t = TriggerTime(injector)
|
val t = TriggerTime(injector)
|
||||||
t.runAt(now)
|
t.runAt(now)
|
||||||
val t1 = t.duplicate() as TriggerTime
|
val t1 = t.duplicate() as TriggerTime
|
||||||
Assertions.assertEquals(now, t1.time.value)
|
assertThat(t1.time.value).isEqualTo(now)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun friendlyNameTest() {
|
fun friendlyNameTest() {
|
||||||
Assertions.assertEquals(app.aaps.core.ui.R.string.time, TriggerTime(injector).friendlyName())
|
assertThat(TriggerTime(injector).friendlyName()).isEqualTo(app.aaps.core.ui.R.string.time)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun friendlyDescriptionTest() {
|
fun friendlyDescriptionTest() {
|
||||||
Mockito.`when`(rh.gs(R.string.atspecifiedtime)).thenReturn("At %1\$s")
|
Mockito.`when`(rh.gs(R.string.atspecifiedtime)).thenReturn("At %1\$s")
|
||||||
Assertions.assertTrue(TriggerTime(injector).friendlyDescription().startsWith("At "))
|
assertThat(TriggerTime(injector).friendlyDescription()).startsWith("At ")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|
|
@ -6,9 +6,9 @@ import app.aaps.plugins.automation.elements.Comparator
|
||||||
import com.google.common.truth.Truth.assertThat
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.json.JSONException
|
import org.json.JSONException
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito.`when`
|
import org.mockito.Mockito.`when`
|
||||||
|
import org.skyscreamer.jsonassert.JSONAssert
|
||||||
|
|
||||||
class TriggerWifiSsidTest : TriggerTestBase() {
|
class TriggerWifiSsidTest : TriggerTestBase() {
|
||||||
|
|
||||||
|
@ -17,40 +17,40 @@ class TriggerWifiSsidTest : TriggerTestBase() {
|
||||||
`when`(receiverStatusStore.lastNetworkEvent).thenReturn(e)
|
`when`(receiverStatusStore.lastNetworkEvent).thenReturn(e)
|
||||||
var t: TriggerWifiSsid = TriggerWifiSsid(injector).setValue("aSSID 1").comparator(Comparator.Compare.IS_EQUAL)
|
var t: TriggerWifiSsid = TriggerWifiSsid(injector).setValue("aSSID 1").comparator(Comparator.Compare.IS_EQUAL)
|
||||||
e.wifiConnected = false
|
e.wifiConnected = false
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
e.wifiConnected = true
|
e.wifiConnected = true
|
||||||
e.ssid = "otherSSID"
|
e.ssid = "otherSSID"
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
e.wifiConnected = true
|
e.wifiConnected = true
|
||||||
e.ssid = "aSSID 1"
|
e.ssid = "aSSID 1"
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
t = TriggerWifiSsid(injector).setValue("aSSID 1").comparator(Comparator.Compare.IS_NOT_AVAILABLE)
|
t = TriggerWifiSsid(injector).setValue("aSSID 1").comparator(Comparator.Compare.IS_NOT_AVAILABLE)
|
||||||
e.wifiConnected = false
|
e.wifiConnected = false
|
||||||
Assertions.assertTrue(t.shouldRun())
|
assertThat(t.shouldRun()).isTrue()
|
||||||
|
|
||||||
// no network data
|
// no network data
|
||||||
`when`(receiverStatusStore.lastNetworkEvent).thenReturn(null)
|
`when`(receiverStatusStore.lastNetworkEvent).thenReturn(null)
|
||||||
Assertions.assertFalse(t.shouldRun())
|
assertThat(t.shouldRun()).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun copyConstructorTest() {
|
@Test fun copyConstructorTest() {
|
||||||
val t: TriggerWifiSsid = TriggerWifiSsid(injector).setValue("aSSID").comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
val t: TriggerWifiSsid = TriggerWifiSsid(injector).setValue("aSSID").comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
val t1 = t.duplicate() as TriggerWifiSsid
|
val t1 = t.duplicate() as TriggerWifiSsid
|
||||||
Assertions.assertEquals("aSSID", t1.ssid.value)
|
assertThat(t1.ssid.value).isEqualTo("aSSID")
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
|
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||||
}
|
}
|
||||||
|
|
||||||
var json = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"ssid\":\"aSSID\"},\"type\":\"TriggerWifiSsid\"}"
|
var json = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"ssid\":\"aSSID\"},\"type\":\"TriggerWifiSsid\"}"
|
||||||
@Test fun toJSONTest() {
|
@Test fun toJSONTest() {
|
||||||
val t: TriggerWifiSsid = TriggerWifiSsid(injector).setValue("aSSID").comparator(Comparator.Compare.IS_EQUAL)
|
val t: TriggerWifiSsid = TriggerWifiSsid(injector).setValue("aSSID").comparator(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals(json, t.toJSON())
|
JSONAssert.assertEquals(json, t.toJSON(), true)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Throws(JSONException::class) fun fromJSONTest() {
|
@Test @Throws(JSONException::class) fun fromJSONTest() {
|
||||||
val t: TriggerWifiSsid = TriggerWifiSsid(injector).setValue("aSSID").comparator(Comparator.Compare.IS_EQUAL)
|
val t: TriggerWifiSsid = TriggerWifiSsid(injector).setValue("aSSID").comparator(Comparator.Compare.IS_EQUAL)
|
||||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerWifiSsid
|
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerWifiSsid
|
||||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
|
assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||||
Assertions.assertEquals("aSSID", t2.ssid.value)
|
assertThat(t2.ssid.value).isEqualTo("aSSID")
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun iconTest() {
|
@Test fun iconTest() {
|
||||||
|
@ -58,10 +58,10 @@ class TriggerWifiSsidTest : TriggerTestBase() {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyNameTest() {
|
@Test fun friendlyNameTest() {
|
||||||
Assertions.assertEquals(app.aaps.core.ui.R.string.ns_wifi_ssids, TriggerWifiSsid(injector).friendlyName())
|
assertThat(TriggerWifiSsid(injector).friendlyName()).isEqualTo(app.aaps.core.ui.R.string.ns_wifi_ssids)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun friendlyDescriptionTest() {
|
@Test fun friendlyDescriptionTest() {
|
||||||
Assertions.assertEquals(null, TriggerWifiSsid(injector).friendlyDescription()) //not mocked
|
assertThat(TriggerWifiSsid(injector).friendlyDescription()).isNull() //not mocked
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -46,7 +46,7 @@
|
||||||
<string name="setupwizard_pump_riley_link_status">RileyLink status:</string>
|
<string name="setupwizard_pump_riley_link_status">RileyLink status:</string>
|
||||||
<string name="readstatus">Les status</string>
|
<string name="readstatus">Les status</string>
|
||||||
<string name="data_choices">Datavalg</string>
|
<string name="data_choices">Datavalg</string>
|
||||||
<string name="fabric_upload">Innlesing av fabrikkinstillinger</string>
|
<string name="fabric_upload">Innlesing av fabrikkinnstillinger</string>
|
||||||
<string name="allow_automated_crash_reporting">Tillat automatisk rapportering av appkrasj og bruksdata til utviklerne via fabrioc.io-tjenesten.</string>
|
<string name="allow_automated_crash_reporting">Tillat automatisk rapportering av appkrasj og bruksdata til utviklerne via fabrioc.io-tjenesten.</string>
|
||||||
<string name="summary_email_for_crash_report">Denne e-postadressen vedlegges krasjrapporter slik at vi kan kontakte deg i akutte tilfeller. Det er valgfritt.</string>
|
<string name="summary_email_for_crash_report">Denne e-postadressen vedlegges krasjrapporter slik at vi kan kontakte deg i akutte tilfeller. Det er valgfritt.</string>
|
||||||
<string name="identification">Identifikasjon (e-post, Facebook eller Discord nick osv.)</string>
|
<string name="identification">Identifikasjon (e-post, Facebook eller Discord nick osv.)</string>
|
||||||
|
@ -81,7 +81,7 @@
|
||||||
<string name="description_config_builder">Brukes for innstilling av aktive plugins</string>
|
<string name="description_config_builder">Brukes for innstilling av aktive plugins</string>
|
||||||
<string name="allow_hardware_pump_text">Varsel: Hvis du aktiverer og kobler til en pumpe, så vil AndroidAPS kopiere basalinnstillinger fra din profil over til pumpen og overskrive verdiene som er lagret i pumpen. Sjekk at du har riktige basalverdier i AndroidAPS. Hvis du ikke er sikker eller ikke ønsker å overskrive basalverdiene i pumpen, trykk avbryt og koble til pumpen senere.</string>
|
<string name="allow_hardware_pump_text">Varsel: Hvis du aktiverer og kobler til en pumpe, så vil AndroidAPS kopiere basalinnstillinger fra din profil over til pumpen og overskrive verdiene som er lagret i pumpen. Sjekk at du har riktige basalverdier i AndroidAPS. Hvis du ikke er sikker eller ikke ønsker å overskrive basalverdiene i pumpen, trykk avbryt og koble til pumpen senere.</string>
|
||||||
<string name="a11y_open_settings">åpne innstillinger</string>
|
<string name="a11y_open_settings">åpne innstillinger</string>
|
||||||
<string name="nsclient_version_does_not_match">NSClient-versjonen samsvarer ikke med AAPS-versjonen. Vennligst oppdater.</string>
|
<string name="nsclient_version_does_not_match">AAPSClient-versjonen samsvarer ikke med AAPS-versjonen. Vennligst oppdater.</string>
|
||||||
<!--ImportExport-->
|
<!--ImportExport-->
|
||||||
<string name="nav_preferences">Innstillinger</string>
|
<string name="nav_preferences">Innstillinger</string>
|
||||||
<string name="password_preferences_encrypt_prompt">Du må angi et hovedpassord som vil bli brukt til å kryptere dine eksporterte innstillinger. Husk dette!</string>
|
<string name="password_preferences_encrypt_prompt">Du må angi et hovedpassord som vil bli brukt til å kryptere dine eksporterte innstillinger. Husk dette!</string>
|
||||||
|
|
|
@ -148,6 +148,7 @@
|
||||||
<string name="cob3_longer">Nustačius 150% profilį, sistemos apskaičiuotas angliavandenių įsisavinimo laikas pailgėja</string>
|
<string name="cob3_longer">Nustačius 150% profilį, sistemos apskaičiuotas angliavandenių įsisavinimo laikas pailgėja</string>
|
||||||
<string name="cob3_shorter">Nustačius 150% profilį, sistemos apskaičiuotas angliavandenių įsisavinimo laikas sutrumpėja</string>
|
<string name="cob3_shorter">Nustačius 150% profilį, sistemos apskaičiuotas angliavandenių įsisavinimo laikas sutrumpėja</string>
|
||||||
<string name="cob3_no_effect">Nustačius 150% profilį, sistemos apskaičiuotas angliavandenių įsisavinimo laikas nepakinta</string>
|
<string name="cob3_no_effect">Nustačius 150% profilį, sistemos apskaičiuotas angliavandenių įsisavinimo laikas nepakinta</string>
|
||||||
|
<string name="cob_hint1">https://wiki.aaps.app/en/latest/Usage/COB-calculation.html#how-does-aaps-calculate-the-cob-value</string>
|
||||||
<string name="iob_value">AIO keičia nustatyta laikina valandinė bazė.</string>
|
<string name="iob_value">AIO keičia nustatyta laikina valandinė bazė.</string>
|
||||||
<string name="iob_hightemp">Padidinta laikina bazė nebus nustatyta, jei glikemija yra žemiau numatyto tikslo.</string>
|
<string name="iob_hightemp">Padidinta laikina bazė nebus nustatyta, jei glikemija yra žemiau numatyto tikslo.</string>
|
||||||
<string name="iob_negiob">Jei ilgą laiką stebima neigiama AIO reikšmė ir nėra fizinio aktyvumo, tai rodo, kad Jūsų nustatymai yra per „agresyvūs“ ir Jums reikia mažiau insulino.</string>
|
<string name="iob_negiob">Jei ilgą laiką stebima neigiama AIO reikšmė ir nėra fizinio aktyvumo, tai rodo, kad Jūsų nustatymai yra per „agresyvūs“ ir Jums reikia mažiau insulino.</string>
|
||||||
|
|
|
@ -9,7 +9,7 @@
|
||||||
<string name="objectives_0_gate">Kontroller at BS er tilgjengelig i Nightscout og at insulindata fra pumpen lastes opp</string>
|
<string name="objectives_0_gate">Kontroller at BS er tilgjengelig i Nightscout og at insulindata fra pumpen lastes opp</string>
|
||||||
<string name="objectives_0_learned">Du har gjort et grunnleggende oppsett av AAPS økosystem. Nightscout (NS) er ikke nødvendig for at AAPS skal kunne kjøres, men det er svært nyttig for å lage rapporter eller gi innsyn i dine data. Det er ikke nødvendig å være tilkoblet NS hele tiden hvis du bruker NS kun for deg selv. Du kan lage innstillinger for å laste opp dine data til NS når du er tilkoblet hjemme wifi og spare batteri.</string>
|
<string name="objectives_0_learned">Du har gjort et grunnleggende oppsett av AAPS økosystem. Nightscout (NS) er ikke nødvendig for at AAPS skal kunne kjøres, men det er svært nyttig for å lage rapporter eller gi innsyn i dine data. Det er ikke nødvendig å være tilkoblet NS hele tiden hvis du bruker NS kun for deg selv. Du kan lage innstillinger for å laste opp dine data til NS når du er tilkoblet hjemme wifi og spare batteri.</string>
|
||||||
<string name="objectives_openloop_objective">Starter med åpen loop</string>
|
<string name="objectives_openloop_objective">Starter med åpen loop</string>
|
||||||
<string name="objectives_openloop_gate">Kjør i \"Åpen Loop\" modus i noen dager og aktiver flere temp basaler. Konfigurer og aktiver flere midlertidige og default temp BS mål (f.eks. for Aktivitet eller Hypo behandling)</string>
|
<string name="objectives_openloop_gate">Kjør i \"Åpen Loop\"-modus i noen dager og aktiver flere midlertidige basaler. Konfigurer og aktiver flere midlertidige mål og standard midlertidige mål (f.eks. for Aktivitet og Hypo)</string>
|
||||||
<string name="objectives_openloop_learned">Åpen loop kan brukes til anbefalinger hvis du ikke har en kompatibel pumpe eller hvis du ikke er klar til å kjøre i lukket loop.</string>
|
<string name="objectives_openloop_learned">Åpen loop kan brukes til anbefalinger hvis du ikke har en kompatibel pumpe eller hvis du ikke er klar til å kjøre i lukket loop.</string>
|
||||||
<string name="objectives_maxbasal_objective">Forstå din åpen loop, inkludert den temp basal anbefalingen</string>
|
<string name="objectives_maxbasal_objective">Forstå din åpen loop, inkludert den temp basal anbefalingen</string>
|
||||||
<string name="objectives_maxbasal_gate">Ut ifra hva du har erfart og lært, avgjør hva din max basal skal være og still den inn i både pumpen og AAPS innstillinger</string>
|
<string name="objectives_maxbasal_gate">Ut ifra hva du har erfart og lært, avgjør hva din max basal skal være og still den inn i både pumpen og AAPS innstillinger</string>
|
||||||
|
@ -42,7 +42,7 @@
|
||||||
<string name="objectives_useprofileswitch">Angi profil 90% for 10 min (langt-trykk på profilnavn i Oversikt)</string>
|
<string name="objectives_useprofileswitch">Angi profil 90% for 10 min (langt-trykk på profilnavn i Oversikt)</string>
|
||||||
<string name="objectives_usedisconnectpump">Simuler dusjing. Frakoble pumpen i 1t (langt trykk på Åpen Loop)</string>
|
<string name="objectives_usedisconnectpump">Simuler dusjing. Frakoble pumpen i 1t (langt trykk på Åpen Loop)</string>
|
||||||
<string name="objectives_usereconnectpump">... og koble til igjen på samme måte</string>
|
<string name="objectives_usereconnectpump">... og koble til igjen på samme måte</string>
|
||||||
<string name="objectives_usetemptarget">Opprett egendefinerte midlertidige BS mål med 10 min varighet (langt-trykk på gjeldende mål)</string>
|
<string name="objectives_usetemptarget">Opprett egendefinerte midlertidige mål med 10 min varighet (langt-trykk på gjeldende mål)</string>
|
||||||
<string name="objectives_useactions">I Konfigurasjonsverktøyet aktiverer du Hendelser plugin, og gjør det synlig og viser innholdet fra menyen i øverste linje</string>
|
<string name="objectives_useactions">I Konfigurasjonsverktøyet aktiverer du Hendelser plugin, og gjør det synlig og viser innholdet fra menyen i øverste linje</string>
|
||||||
<string name="objectives_useloop">Vis innholdet i Loop plugin</string>
|
<string name="objectives_useloop">Vis innholdet i Loop plugin</string>
|
||||||
<string name="objectives_usescale">Test skaleringsfunksjonen ved et langt trykk på BS grafen</string>
|
<string name="objectives_usescale">Test skaleringsfunksjonen ved et langt trykk på BS grafen</string>
|
||||||
|
|
|
@ -148,6 +148,7 @@
|
||||||
<string name="cob3_longer">Установка профиля на 150% увеличит расчетное время усвоения углеводов</string>
|
<string name="cob3_longer">Установка профиля на 150% увеличит расчетное время усвоения углеводов</string>
|
||||||
<string name="cob3_shorter">Установка профиля на 150% уменьшит расчетное время усвоения углеводов</string>
|
<string name="cob3_shorter">Установка профиля на 150% уменьшит расчетное время усвоения углеводов</string>
|
||||||
<string name="cob3_no_effect">Установка профиля на 150% не повлияет на расчетное время усвоения углеводов</string>
|
<string name="cob3_no_effect">Установка профиля на 150% не повлияет на расчетное время усвоения углеводов</string>
|
||||||
|
<string name="cob_hint1">https://wiki.aaps.app/en/latest/Usage/COB-calculation.html#how-does-aaps-calculate-the-cob-value</string>
|
||||||
<string name="iob_value">На величину IOB влияют устанавливаемые ВБС.</string>
|
<string name="iob_value">На величину IOB влияют устанавливаемые ВБС.</string>
|
||||||
<string name="iob_hightemp">Высокая ВБС не будет применяться, если уровень сахара в крови ниже целевого.</string>
|
<string name="iob_hightemp">Высокая ВБС не будет применяться, если уровень сахара в крови ниже целевого.</string>
|
||||||
<string name="iob_negiob">Отрицательный IOB в течение длительного периода при отсутствии физнагрузки указывает на то, что ваш профиль завышен и требуется снизить кол-во инсулина в настройках.</string>
|
<string name="iob_negiob">Отрицательный IOB в течение длительного периода при отсутствии физнагрузки указывает на то, что ваш профиль завышен и требуется снизить кол-во инсулина в настройках.</string>
|
||||||
|
|
|
@ -148,6 +148,7 @@
|
||||||
<string name="cob3_longer">Nastavenie profilu na 150% spôsobí, že vypočítaná doba absorbcie sacharidov bude dlhšia</string>
|
<string name="cob3_longer">Nastavenie profilu na 150% spôsobí, že vypočítaná doba absorbcie sacharidov bude dlhšia</string>
|
||||||
<string name="cob3_shorter">Nastavenie profilu na 150% spôsobí, že vypočítaná doba absorbcie sacharidov bude kratšia</string>
|
<string name="cob3_shorter">Nastavenie profilu na 150% spôsobí, že vypočítaná doba absorbcie sacharidov bude kratšia</string>
|
||||||
<string name="cob3_no_effect">Nastavenie profilu na 150% neovplyvní vypočítanú absorbciu sacharidov</string>
|
<string name="cob3_no_effect">Nastavenie profilu na 150% neovplyvní vypočítanú absorbciu sacharidov</string>
|
||||||
|
<string name="cob_hint1">https://wiki.aaps.app/cs/latest/Usage/COB-calculation.html#how-does-aaps-calculate-the-cob-value</string>
|
||||||
<string name="iob_value">Hodnota IOB je ovplyvnená vydanými dočasnými bazálmi.</string>
|
<string name="iob_value">Hodnota IOB je ovplyvnená vydanými dočasnými bazálmi.</string>
|
||||||
<string name="iob_hightemp">Vysoký dočasný bazál nebude spustený, pokiaľ je Vaša glykémia nižšia, ako cieľ.</string>
|
<string name="iob_hightemp">Vysoký dočasný bazál nebude spustený, pokiaľ je Vaša glykémia nižšia, ako cieľ.</string>
|
||||||
<string name="iob_negiob">Negatívne IOB po značnú dobu bez cvičenia naznačuje, že váš profil je príliš \"silný\" a vo vašom profile je potrebného menej inzulínu.</string>
|
<string name="iob_negiob">Negatívne IOB po značnú dobu bez cvičenia naznačuje, že váš profil je príliš \"silný\" a vo vašom profile je potrebného menej inzulínu.</string>
|
||||||
|
|
|
@ -495,11 +495,12 @@ class DataHandlerMobile @Inject constructor(
|
||||||
val message = rh.gs(R.string.quick_wizard_message, quickWizardEntry.buttonText(), wizard.calculatedTotalInsulin, quickWizardEntry.carbs()) +
|
val message = rh.gs(R.string.quick_wizard_message, quickWizardEntry.buttonText(), wizard.calculatedTotalInsulin, quickWizardEntry.carbs()) +
|
||||||
"\n_____________\n" + wizard.explainShort()
|
"\n_____________\n" + wizard.explainShort()
|
||||||
|
|
||||||
|
lastBolusWizard = wizard
|
||||||
rxBus.send(
|
rxBus.send(
|
||||||
EventMobileToWear(
|
EventMobileToWear(
|
||||||
EventData.ConfirmAction(
|
EventData.ConfirmAction(
|
||||||
rh.gs(app.aaps.core.ui.R.string.confirm).uppercase(), message,
|
rh.gs(app.aaps.core.ui.R.string.confirm).uppercase(), message,
|
||||||
returnCommand = EventData.ActionBolusConfirmed(insulinAfterConstraints, carbsAfterConstraints)
|
returnCommand = EventData.ActionWizardConfirmed(wizard.timeStamp)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
|
@ -137,10 +137,10 @@
|
||||||
<string name="delete_current_profile">Slette gjeldende profil?</string>
|
<string name="delete_current_profile">Slette gjeldende profil?</string>
|
||||||
<string name="units_colon">Enheter:</string>
|
<string name="units_colon">Enheter:</string>
|
||||||
<string name="missing_profile_name">Mangler profilnavn</string>
|
<string name="missing_profile_name">Mangler profilnavn</string>
|
||||||
<string name="error_in_ic_values">Feil i IK faktoren</string>
|
<string name="error_in_ic_values">Feil i IK-faktoren</string>
|
||||||
<string name="error_in_basal_values">Feil i basalverdiene</string>
|
<string name="error_in_basal_values">Feil i basalverdiene</string>
|
||||||
<string name="error_in_target_values">Feil i BS målverdier</string>
|
<string name="error_in_target_values">Feil i BS målverdier</string>
|
||||||
<string name="error_in_isf_values">Feil i IF verdien</string>
|
<string name="error_in_isf_values">Feil i ISF-verdien</string>
|
||||||
<string name="profile_name_contains_dot">Noen av profilnavnene inneholder punktum.\nDette støttes ikke av NS.\nProfilen er ikke lastet opp til NS.</string>
|
<string name="profile_name_contains_dot">Noen av profilnavnene inneholder punktum.\nDette støttes ikke av NS.\nProfilen er ikke lastet opp til NS.</string>
|
||||||
<string name="invalid_profile_not_accepted">Ugyldig profil %1$s ikke akseptert fra NS</string>
|
<string name="invalid_profile_not_accepted">Ugyldig profil %1$s ikke akseptert fra NS</string>
|
||||||
<string name="view">Visning</string>
|
<string name="view">Visning</string>
|
||||||
|
@ -212,26 +212,26 @@
|
||||||
<string name="openaps">OpenAPS</string>
|
<string name="openaps">OpenAPS</string>
|
||||||
<string name="uploader">Opplaster</string>
|
<string name="uploader">Opplaster</string>
|
||||||
<string name="data_status">BS data status</string>
|
<string name="data_status">BS data status</string>
|
||||||
<string name="quickwizard_settings">Innstillinger for hurtigveiviser</string>
|
<string name="quickwizard_settings">Innstillinger for hurtigknapp</string>
|
||||||
<string name="keep_screen_on_title">Hold skjermen påslått</string>
|
<string name="keep_screen_on_title">Hold skjermen påslått</string>
|
||||||
<string name="keep_screen_on_summary">Forhindre Android fra å slå av skjermen. Mobilen vil bruke mye batteri hvis den ikke kobles til strømledning.</string>
|
<string name="keep_screen_on_summary">Forhindre Android fra å slå av skjermen. Mobilen vil bruke mye batteri hvis den ikke kobles til strømledning.</string>
|
||||||
<string name="treatments">Behandlinger</string>
|
<string name="treatments">Behandlinger</string>
|
||||||
<string name="carb_increment_button_message">Antall karbohydrater som skal legges til når knappen trykkes</string>
|
<string name="carb_increment_button_message">Antall karbohydrater som skal legges til når knappen trykkes</string>
|
||||||
<string name="insulin_increment_button_message">Mengde insulin som skal legges til når knappen trykkes</string>
|
<string name="insulin_increment_button_message">Mengde insulin som skal legges til når knappen trykkes</string>
|
||||||
<string name="firstinsulinincrement">Første økning hurtigknapp for insulin</string>
|
<string name="firstinsulinincrement">Første økning knapp for insulin</string>
|
||||||
<string name="secondinsulinincrement">Andre økning hurtigknapp for insulin</string>
|
<string name="secondinsulinincrement">Andre økning knapp for insulin</string>
|
||||||
<string name="thirdinsulinincrement">Tredje økning hurtigknapp for insulin</string>
|
<string name="thirdinsulinincrement">Tredje økning knapp for insulin</string>
|
||||||
<string name="firstcarbsincrement">Første økning hurtigknapp for karbohydrater</string>
|
<string name="firstcarbsincrement">Første økning knapp for karbohydrater</string>
|
||||||
<string name="secondcarbsincrement">Andre økning hurtigknapp for karbohydrater</string>
|
<string name="secondcarbsincrement">Andre økning knapp for karbohydrater</string>
|
||||||
<string name="thirdcarbsincrement">Tredje økning hurtigknapp for karbohydrater</string>
|
<string name="thirdcarbsincrement">Tredje økning knapp for karbohydrater</string>
|
||||||
<string name="cgm">CGM</string>
|
<string name="cgm">CGM</string>
|
||||||
<string name="default_temptargets">Standard midl. mål</string>
|
<string name="default_temptargets">Standard midlertidig mål</string>
|
||||||
<string name="eatingsoon_duration">spise snart varighet</string>
|
<string name="eatingsoon_duration">Spise snart varighet (min)</string>
|
||||||
<string name="eatingsoon_target">spise snart målverdi</string>
|
<string name="eatingsoon_target">Spise snart målverdi</string>
|
||||||
<string name="activity_duration">varighet for aktivitet</string>
|
<string name="activity_duration">Aktivitet varighet (min)</string>
|
||||||
<string name="activity_target">målverdi ved aktivitet</string>
|
<string name="activity_target">Aktivitet målverdi</string>
|
||||||
<string name="hypo_duration">hypo varighet</string>
|
<string name="hypo_duration">Hypo varighet (min)</string>
|
||||||
<string name="hypo_target">hypo målverdi</string>
|
<string name="hypo_target">Hypo målverdi</string>
|
||||||
<string name="fill_bolus_title">Standardverdier for påfyll/prime</string>
|
<string name="fill_bolus_title">Standardverdier for påfyll/prime</string>
|
||||||
<string name="button1">Knapp 1</string>
|
<string name="button1">Knapp 1</string>
|
||||||
<string name="button2">Knapp 2</string>
|
<string name="button2">Knapp 2</string>
|
||||||
|
@ -241,23 +241,23 @@
|
||||||
<string name="low_mark">Lav verdi</string>
|
<string name="low_mark">Lav verdi</string>
|
||||||
<string name="high_mark">Høy verdi</string>
|
<string name="high_mark">Høy verdi</string>
|
||||||
<string name="short_tabtitles">Korte navn i menyfaner</string>
|
<string name="short_tabtitles">Korte navn i menyfaner</string>
|
||||||
<string name="overview_show_notes_field_in_dialogs_title">Vis merknadsfelt i dialogvindu for behandlinger</string>
|
<string name="overview_show_notes_field_in_dialogs_title">Vis merknadsfelt i dialogvindu for boluskalkulator</string>
|
||||||
<string name="deliverpartofboluswizard">Bolusveiviser utfører beregninger, men bare denne del av beregnet insulin leveres. Nyttig ved bruk av SMB-algoritmen.</string>
|
<string name="deliverpartofboluswizard">Bolusveiviser utfører beregninger, men bare denne del av beregnet insulin leveres. Nyttig ved bruk av SMB-algoritmen.</string>
|
||||||
<string name="deliver_part_of_boluswizard_reset_time">Gi full bolus (100 %) dersom blodsukker er eldre enn</string>
|
<string name="deliver_part_of_boluswizard_reset_time">Gi full bolus (100 %) dersom blodsukker er eldre enn</string>
|
||||||
<string name="enable_bolus_advisor">Aktiver boluskalkulator</string>
|
<string name="enable_bolus_advisor">Aktiver bolusveileder</string>
|
||||||
<string name="enable_bolus_advisor_summary">Bruk en påminnelse om å spise senere isetdet for beregnet av kalkulator når blodsukker er høyt (\"pre-bolus\")</string>
|
<string name="enable_bolus_advisor_summary">Bruk en påminnelse om å spise senere istedet for boluskalkulatorens resultat når blodsukker er høyt (\"pre-bolus\")</string>
|
||||||
<string name="enablesuperbolus">Aktiver superbolus i veiviser</string>
|
<string name="enablesuperbolus">Aktiver superbolus i veiviser</string>
|
||||||
<string name="enablesuperbolus_summary">Aktiver superbolus-funksjonen i veiviseren. Ikke aktiver denne før du vet hvordan den fungerer. DEN KAN LEDE TIL EN OVERDOSERING AV INSULIN HVIS DEN BRUKES UKRITISK!</string>
|
<string name="enablesuperbolus_summary">Aktiver superbolus-funksjonen i boluskalkulatoren. Ikke aktiver denne før du vet hvordan den fungerer. DEN KAN LEDE TIL EN OVERDOSERING AV INSULIN HVIS DEN BRUKES UKRITISK!</string>
|
||||||
<string name="enablebolusreminder">Aktiver boluspåminnelse</string>
|
<string name="enablebolusreminder">Aktiver boluspåminnelse</string>
|
||||||
<string name="enablebolusreminder_summary">Bruk påminnelse for å sette bolusdosen senere med veiviseren («post bolus»)</string>
|
<string name="enablebolusreminder_summary">Bruk en påminnelse for å sette bolusdosen senere med boluskalkulatoren («post bolus»)</string>
|
||||||
<string name="run_question">Kjør %s?</string>
|
<string name="run_question">Kjør %s?</string>
|
||||||
<!-- OverviewMenu-->
|
<!-- OverviewMenu-->
|
||||||
<string name="overview_show_predictions">Prognoser</string>
|
<string name="overview_show_predictions">Prognoser</string>
|
||||||
<string name="overview_show_treatments">Behandlinger</string>
|
<string name="overview_show_treatments">Behandlinger</string>
|
||||||
<string name="overview_show_heartRate">Puls</string>
|
<string name="overview_show_heartRate">Puls</string>
|
||||||
<string name="overview_show_deviation_slope">Avvikskurve</string>
|
<string name="overview_show_deviation_slope">Avvikskurve</string>
|
||||||
<string name="overview_show_activity">Aktivitet</string>
|
<string name="overview_show_activity">Insulinaktivitet</string>
|
||||||
<string name="overview_show_bgi">Blodsukkerpåvirkning</string>
|
<string name="overview_show_bgi">BS-påvirkning (BGI)</string>
|
||||||
<string name="overview_show_sensitivity">Sensitivitet</string>
|
<string name="overview_show_sensitivity">Sensitivitet</string>
|
||||||
<string name="overview_show_deviations">Avvik</string>
|
<string name="overview_show_deviations">Avvik</string>
|
||||||
<string name="overview_show_cob">Aktive KH (COB)</string>
|
<string name="overview_show_cob">Aktive KH (COB)</string>
|
||||||
|
@ -274,7 +274,7 @@
|
||||||
<string name="treatments_shortname">BEH</string>
|
<string name="treatments_shortname">BEH</string>
|
||||||
<string name="heartRate_shortname">HR</string>
|
<string name="heartRate_shortname">HR</string>
|
||||||
<string name="sensitivity_shortname">SENS</string>
|
<string name="sensitivity_shortname">SENS</string>
|
||||||
<string name="graph_scale">Graf skala</string>
|
<string name="graph_scale">Graf-skala</string>
|
||||||
<string name="graph_menu_divider_header">Graf</string>
|
<string name="graph_menu_divider_header">Graf</string>
|
||||||
<!-- Skins -->
|
<!-- Skins -->
|
||||||
<string name="classic_description">Opprinnelig visningstema</string>
|
<string name="classic_description">Opprinnelig visningstema</string>
|
||||||
|
@ -291,9 +291,9 @@
|
||||||
<string name="no_watch_connected">(Ingen klokke tilkoblet)</string>
|
<string name="no_watch_connected">(Ingen klokke tilkoblet)</string>
|
||||||
<string name="pump_status">Pumpestatus</string>
|
<string name="pump_status">Pumpestatus</string>
|
||||||
<string name="loop_status">Loopstatus</string>
|
<string name="loop_status">Loopstatus</string>
|
||||||
<string name="wizard_result">Kalkulator hurtigveiviser:\nInsulin: %1$.2fE\nKarbo: %2$dg</string>
|
<string name="wizard_result">Boluskalkulator:\nInsulin: %1$.2fE\nKarbo: %2$dg</string>
|
||||||
<string name="quick_wizard_not_available">Den valgte hurtigveiviseren er ikke tilgjengelig lenger, oppdater klokkeurskive</string>
|
<string name="quick_wizard_not_available">Den valgte hurtigknappen er ikke lenger tilgjengelig, oppdater klokkeflis</string>
|
||||||
<string name="quick_wizard_message">Hurtigveiviser: %1$s\ninsulin: %2$.2fE\nKarbo: %3$dg</string>
|
<string name="quick_wizard_message">Hurtigknapp: %1$s\ninsulin: %2$.2fE\nKarbo: %3$dg</string>
|
||||||
<string name="wear_action_tempt_preset_error">Ukjent forhåndsinnstilling midl. mål: %1$s</string>
|
<string name="wear_action_tempt_preset_error">Ukjent forhåndsinnstilling midl. mål: %1$s</string>
|
||||||
<string name="wear_action_tempt_cancel_message">Avbryt gjeldende midl. mål?</string>
|
<string name="wear_action_tempt_cancel_message">Avbryt gjeldende midl. mål?</string>
|
||||||
<string name="wear_action_tempt_unit_error">Forskjellige enheter brukt på klokke og telefon!</string>
|
<string name="wear_action_tempt_unit_error">Forskjellige enheter brukt på klokke og telefon!</string>
|
||||||
|
@ -307,7 +307,7 @@
|
||||||
<string name="wear_settings">Klokkeinnstillinger</string>
|
<string name="wear_settings">Klokkeinnstillinger</string>
|
||||||
<string name="wearcontrol_title">Kontroller fra klokke</string>
|
<string name="wearcontrol_title">Kontroller fra klokke</string>
|
||||||
<string name="wearcontrol_summary">Sett midl. mål og angi behandlinger fra klokken.</string>
|
<string name="wearcontrol_summary">Sett midl. mål og angi behandlinger fra klokken.</string>
|
||||||
<string name="wear_wizard_settings_summary">Beregninger inkludert i resultatet fra veiviseren:</string>
|
<string name="wear_wizard_settings_summary">Beregninger inkludert i resultatet fra kalkulator:</string>
|
||||||
<string name="wear_general_settings">Generelle innstillinger</string>
|
<string name="wear_general_settings">Generelle innstillinger</string>
|
||||||
<string name="wear_notifysmb_title">Varsle ved SMB</string>
|
<string name="wear_notifysmb_title">Varsle ved SMB</string>
|
||||||
<string name="wear_notifysmb_summary">Vis SMB på klokken som en standard bolus.</string>
|
<string name="wear_notifysmb_summary">Vis SMB på klokken som en standard bolus.</string>
|
||||||
|
@ -332,7 +332,7 @@
|
||||||
<string name="grams_short">g</string>
|
<string name="grams_short">g</string>
|
||||||
<string name="hour_short">t</string>
|
<string name="hour_short">t</string>
|
||||||
<string name="no_active_profile">Det er ikke angitt noen aktiv profil!</string>
|
<string name="no_active_profile">Det er ikke angitt noen aktiv profil!</string>
|
||||||
<string name="profile_message">Profil:\n\nTidsforskyving: %1$d\nProsent: %2$d%%\"</string>
|
<string name="profile_message">Profil:\n\nTidsforskyving: %1$d\nProsent: %2$d%%</string>
|
||||||
<string name="tdd_line">%1$.2fE %1$.0f%%</string>
|
<string name="tdd_line">%1$.2fE %1$.0f%%</string>
|
||||||
<string name="no_profile">Ingen profil valgt</string>
|
<string name="no_profile">Ingen profil valgt</string>
|
||||||
<string name="aps_only">Bare bruk i APS-modus!</string>
|
<string name="aps_only">Bare bruk i APS-modus!</string>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
<resources>
|
<resources>
|
||||||
<string name="smoothing_shortname">UTJEVNING</string>
|
<string name="smoothing_shortname">UTJEVNING</string>
|
||||||
<string name="exponential_smoothing_name">Eksponentiell utjevning</string>
|
<string name="exponential_smoothing_name">Eksponentiell utjevning</string>
|
||||||
<string name="description_exponential_smoothing">"Andre algoritme for eksponentiell utjevning"</string>
|
<string name="description_exponential_smoothing">"Andre ordens algoritme for eksponentiell utjevning"</string>
|
||||||
<string name="avg_smoothing_name">Gjennomsnittlig utjevning</string>
|
<string name="avg_smoothing_name">Gjennomsnittlig utjevning</string>
|
||||||
<string name="description_avg_smoothing">"Gjennomsnittlig utjevnings-algoritme, nyeste verdi påvirkes ikke"</string>
|
<string name="description_avg_smoothing">"Gjennomsnittlig utjevnings-algoritme, nyeste verdi påvirkes ikke"</string>
|
||||||
<string name="no_smoothing_name">Ingen utjevning</string>
|
<string name="no_smoothing_name">Ingen utjevning</string>
|
||||||
|
|
|
@ -34,6 +34,6 @@
|
||||||
<string name="do_xdrip_upload_summary">I xDrip+, velg 640G/Eversens som datakilde</string>
|
<string name="do_xdrip_upload_summary">I xDrip+, velg 640G/Eversens som datakilde</string>
|
||||||
<string name="bgsource_upload">Innstillinger for opplasting av BS</string>
|
<string name="bgsource_upload">Innstillinger for opplasting av BS</string>
|
||||||
<string name="dexcom_log_ns_sensor_change_title">Logg sensorbytte til NS</string>
|
<string name="dexcom_log_ns_sensor_change_title">Logg sensorbytte til NS</string>
|
||||||
<string name="dexcom_log_ns_sensor_change_summary">Opprett hendelse \"Senso bytte\" automatisk i NS ved start av sensoren</string>
|
<string name="dexcom_log_ns_sensor_change_summary">Opprett hendelse \"Sensor bytte\" automatisk i NS ved start av sensoren</string>
|
||||||
<string name="direction">retning</string>
|
<string name="direction">retning</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -4,6 +4,9 @@ import app.aaps.core.interfaces.logging.AAPSLogger
|
||||||
import app.aaps.core.interfaces.logging.LTag
|
import app.aaps.core.interfaces.logging.LTag
|
||||||
import app.aaps.core.interfaces.plugin.ActivePlugin
|
import app.aaps.core.interfaces.plugin.ActivePlugin
|
||||||
import app.aaps.core.interfaces.profile.ProfileFunction
|
import app.aaps.core.interfaces.profile.ProfileFunction
|
||||||
|
import app.aaps.core.interfaces.rx.bus.RxBus
|
||||||
|
import app.aaps.core.interfaces.rx.events.EventNSClientNewLog
|
||||||
|
import app.aaps.core.interfaces.rx.events.EventXdripNewLog
|
||||||
import app.aaps.core.interfaces.sharedPreferences.SP
|
import app.aaps.core.interfaces.sharedPreferences.SP
|
||||||
import app.aaps.core.interfaces.sync.DataSyncSelector
|
import app.aaps.core.interfaces.sync.DataSyncSelector
|
||||||
import app.aaps.core.interfaces.sync.DataSyncSelectorXdrip
|
import app.aaps.core.interfaces.sync.DataSyncSelectorXdrip
|
||||||
|
@ -25,7 +28,8 @@ class DataSyncSelectorXdripImpl @Inject constructor(
|
||||||
private val profileFunction: ProfileFunction,
|
private val profileFunction: ProfileFunction,
|
||||||
private val activePlugin: ActivePlugin,
|
private val activePlugin: ActivePlugin,
|
||||||
private val xdripBroadcast: Lazy<XDripBroadcast>,
|
private val xdripBroadcast: Lazy<XDripBroadcast>,
|
||||||
private val appRepository: AppRepository
|
private val appRepository: AppRepository,
|
||||||
|
private val rxBus: RxBus
|
||||||
) : DataSyncSelectorXdrip {
|
) : DataSyncSelectorXdrip {
|
||||||
|
|
||||||
class QueueCounter(
|
class QueueCounter(
|
||||||
|
@ -72,7 +76,17 @@ class DataSyncSelectorXdripImpl @Inject constructor(
|
||||||
|
|
||||||
override fun queueSize(): Long = queueCounter.size()
|
override fun queueSize(): Long = queueCounter.size()
|
||||||
|
|
||||||
|
private var running = false
|
||||||
|
private val sync = Any()
|
||||||
|
|
||||||
override suspend fun doUpload() {
|
override suspend fun doUpload() {
|
||||||
|
synchronized(sync) {
|
||||||
|
if (running) {
|
||||||
|
rxBus.send(EventXdripNewLog("RUN", "Already running"))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
running = true
|
||||||
|
}
|
||||||
if (isEnabled) {
|
if (isEnabled) {
|
||||||
processChangedGlucoseValues()
|
processChangedGlucoseValues()
|
||||||
processChangedBoluses()
|
processChangedBoluses()
|
||||||
|
@ -96,6 +110,7 @@ class DataSyncSelectorXdripImpl @Inject constructor(
|
||||||
// not supported at the moment
|
// not supported at the moment
|
||||||
//processChangedProfileStore()
|
//processChangedProfileStore()
|
||||||
}
|
}
|
||||||
|
running = false
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun resetToNextFullSync() {
|
override fun resetToNextFullSync() {
|
||||||
|
|
|
@ -13,8 +13,8 @@
|
||||||
<string name="ns_create_announcements_from_carbs_req_title">Opprett varslinger hvis det er nødvendig med karbohydrater</string>
|
<string name="ns_create_announcements_from_carbs_req_title">Opprett varslinger hvis det er nødvendig med karbohydrater</string>
|
||||||
<string name="ns_create_announcements_from_errors_summary">Opprett varslinger i Nightscout ved feil eller meldinger (også synlig i Careportal under Behandlinger)</string>
|
<string name="ns_create_announcements_from_errors_summary">Opprett varslinger i Nightscout ved feil eller meldinger (også synlig i Careportal under Behandlinger)</string>
|
||||||
<string name="ns_create_announcements_from_carbs_req_summary">Opprett Nightscout-meldinger ved behov for karbohydrater</string>
|
<string name="ns_create_announcements_from_carbs_req_summary">Opprett Nightscout-meldinger ved behov for karbohydrater</string>
|
||||||
<string name="description_ns_client">Synkroniserer dine data med Nightscout</string>
|
<string name="description_ns_client">Synkroniserer dine data med Nightscout v1 API</string>
|
||||||
<string name="description_ns_client_v3">Synkroniserer dataene dine med Nightscout med v3 API</string>
|
<string name="description_ns_client_v3">Synkroniserer dine data med Nightscout v3 API</string>
|
||||||
<string name="blocked_by_charging">Blokkert på grunn av ladealternativer</string>
|
<string name="blocked_by_charging">Blokkert på grunn av ladealternativer</string>
|
||||||
<string name="blocked_by_connectivity">Blokkert på grunn av tilkoblingsalternativer</string>
|
<string name="blocked_by_connectivity">Blokkert på grunn av tilkoblingsalternativer</string>
|
||||||
<string name="unsupported_ns_version">Versjonen av Nightscout støttes ikke</string>
|
<string name="unsupported_ns_version">Versjonen av Nightscout støttes ikke</string>
|
||||||
|
@ -51,20 +51,20 @@
|
||||||
<string name="ns_upload">Last opp data til NS</string>
|
<string name="ns_upload">Last opp data til NS</string>
|
||||||
<string name="ns_receive_profile_store">Hent lagrede profiler</string>
|
<string name="ns_receive_profile_store">Hent lagrede profiler</string>
|
||||||
<string name="ns_receive_profile_store_summary">Synkroniser profiler fra NS profileditor</string>
|
<string name="ns_receive_profile_store_summary">Synkroniser profiler fra NS profileditor</string>
|
||||||
<string name="ns_receive_temp_target">Motta midlertidige BS-mål</string>
|
<string name="ns_receive_temp_target">Motta midlertidige mål</string>
|
||||||
<string name="ns_receive_temp_target_summary">Aksepter midlertidige mål angitt med NS eller NSClient</string>
|
<string name="ns_receive_temp_target_summary">Aksepter midlertidige mål angitt med NS eller AAPSClient</string>
|
||||||
<string name="ns_receive_profile_switch">Motta profilbytter</string>
|
<string name="ns_receive_profile_switch">Motta profilbytter</string>
|
||||||
<string name="ns_receive_profile_switch_summary">Aksepter profilbytter som er angitt via NS eller NSClient</string>
|
<string name="ns_receive_profile_switch_summary">Aksepter profilbytter som er angitt via NS eller NSClient</string>
|
||||||
<string name="ns_receive_offline_event">Motta APS offline hendelser</string>
|
<string name="ns_receive_offline_event">Motta APS offline hendelser</string>
|
||||||
<string name="ns_receive_offline_event_summary">Aksepter APS offline hendelser lagt inn gjennom NS eller NSClient</string>
|
<string name="ns_receive_offline_event_summary">Aksepter APS offline hendelser lagt inn gjennom NS eller AAPSClient</string>
|
||||||
<string name="ns_receive_tbr_eb">Motta TBR og EB</string>
|
<string name="ns_receive_tbr_eb">Motta TBR og EB</string>
|
||||||
<string name="ns_receive_tbr_eb_summary">Godta TBR og EB beregninger fra tilleggsmodul</string>
|
<string name="ns_receive_tbr_eb_summary">Godta TBR og EB beregninger fra tilleggsmodul</string>
|
||||||
<string name="ns_receive_insulin">Motta insulin</string>
|
<string name="ns_receive_insulin">Motta insulin</string>
|
||||||
<string name="ns_receive_insulin_summary">Aksepter insulin angitt via NS eller NSClient (enhetene er ikke dosert, kun beregnet mot IOB)</string>
|
<string name="ns_receive_insulin_summary">Aksepter insulin angitt via NS eller AAPSClient (enhetene er ikke dosert, kun beregnet mot IOB)</string>
|
||||||
<string name="ns_receive_carbs">Motta karbohydrater</string>
|
<string name="ns_receive_carbs">Motta karbohydrater</string>
|
||||||
<string name="ns_receive_carbs_summary">Aksepter karbohydrater angitt med NS eller NSClient</string>
|
<string name="ns_receive_carbs_summary">Aksepter karbohydrater angitt med NS eller AAPSClient</string>
|
||||||
<string name="ns_receive_therapy_events">Motta behandlingshendelser</string>
|
<string name="ns_receive_therapy_events">Motta behandlingshendelser</string>
|
||||||
<string name="ns_receive_therapy_events_summary">Godta behandlingshendelser (kanyle, insulin, batteribytte osv.) som er lagt inn gjennom NS eller NSClient</string>
|
<string name="ns_receive_therapy_events_summary">Godta behandlingshendelser (kanyle, insulin, batteribytte osv.) som er lagt inn gjennom NS eller AAPSClient</string>
|
||||||
<string name="ns_receive_cgm">Motta/tilbakefyll CGM data</string>
|
<string name="ns_receive_cgm">Motta/tilbakefyll CGM data</string>
|
||||||
<string name="ns_receive_cgm_summary">Aksepter CGM data fra NS</string>
|
<string name="ns_receive_cgm_summary">Aksepter CGM data fra NS</string>
|
||||||
<string name="ns_sync_slow">Reduser opplastingshastighet</string>
|
<string name="ns_sync_slow">Reduser opplastingshastighet</string>
|
||||||
|
@ -76,7 +76,7 @@
|
||||||
<string name="ns_log_app_started_event">Logg app-start til NS</string>
|
<string name="ns_log_app_started_event">Logg app-start til NS</string>
|
||||||
<string name="copy_existing_values">Kopiere NS innstillinger (hvis de eksisterer)?</string>
|
<string name="copy_existing_values">Kopiere NS innstillinger (hvis de eksisterer)?</string>
|
||||||
<string name="ns_use_ws_title">Koble til websockets</string>
|
<string name="ns_use_ws_title">Koble til websockets</string>
|
||||||
<string name="ns_use_ws_summary">Aktivering vetyr: hurtigere oppdateringer, mottak av alarmer og kunngjøringer og høyere batteriforbruk som ligner v1. Alle andre opplastere til NS må bruke v3 protokoll.</string>
|
<string name="ns_use_ws_summary">Aktivering betyr: hurtigere oppdateringer, mottak av alarmer og kunngjøringer og høyere batteriforbruk som ligner v1 API. Alle andre opplastere til NS må bruke v3 API.</string>
|
||||||
<!-- Tidepool -->
|
<!-- Tidepool -->
|
||||||
<string name="summary_tidepool_username">Ditt Tidepool brukernavn, normalt din e-postadresse</string>
|
<string name="summary_tidepool_username">Ditt Tidepool brukernavn, normalt din e-postadresse</string>
|
||||||
<string name="title_tidepool_username">Brukernavn for innlogging</string>
|
<string name="title_tidepool_username">Brukernavn for innlogging</string>
|
||||||
|
|
|
@ -12,11 +12,11 @@ import app.aaps.core.interfaces.sharedPreferences.SP
|
||||||
import app.aaps.core.interfaces.ui.UiInteraction
|
import app.aaps.core.interfaces.ui.UiInteraction
|
||||||
import app.aaps.core.interfaces.utils.DateUtil
|
import app.aaps.core.interfaces.utils.DateUtil
|
||||||
import app.aaps.shared.tests.TestBase
|
import app.aaps.shared.tests.TestBase
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.pump.combo.ruffyscripter.RuffyScripter
|
import info.nightscout.pump.combo.ruffyscripter.RuffyScripter
|
||||||
import info.nightscout.pump.combo.ruffyscripter.history.Bolus
|
import info.nightscout.pump.combo.ruffyscripter.history.Bolus
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
|
@ -56,8 +56,8 @@ class ComboPluginTest : TestBase() {
|
||||||
comboPlugin.setPluginEnabled(PluginType.PUMP, true)
|
comboPlugin.setPluginEnabled(PluginType.PUMP, true)
|
||||||
comboPlugin.setValidBasalRateProfileSelectedOnPump(false)
|
comboPlugin.setValidBasalRateProfileSelectedOnPump(false)
|
||||||
val c = comboPlugin.isLoopInvocationAllowed(ConstraintObject(true, aapsLogger))
|
val c = comboPlugin.isLoopInvocationAllowed(ConstraintObject(true, aapsLogger))
|
||||||
Assertions.assertEquals("Combo: No valid basal rate read from pump", c.getReasons())
|
assertThat(c.getReasons()).isEqualTo("Combo: No valid basal rate read from pump")
|
||||||
Assertions.assertEquals(false, c.value())
|
assertThat(c.value()).isFalse()
|
||||||
comboPlugin.setPluginEnabled(PluginType.PUMP, false)
|
comboPlugin.setPluginEnabled(PluginType.PUMP, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -66,18 +66,16 @@ class ComboPluginTest : TestBase() {
|
||||||
val now = System.currentTimeMillis()
|
val now = System.currentTimeMillis()
|
||||||
val pumpTimestamp = now - now % 1000
|
val pumpTimestamp = now - now % 1000
|
||||||
// same timestamp, different bolus leads to different fake timestamp
|
// same timestamp, different bolus leads to different fake timestamp
|
||||||
Assertions.assertNotEquals(
|
assertThat(
|
||||||
comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.1, true)),
|
|
||||||
comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.3, true))
|
comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.3, true))
|
||||||
)
|
).isNotEqualTo(comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.1, true)))
|
||||||
// different timestamp, same bolus leads to different fake timestamp
|
// different timestamp, same bolus leads to different fake timestamp
|
||||||
Assertions.assertNotEquals(
|
assertThat(
|
||||||
comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.3, true)),
|
|
||||||
comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp + 60 * 1000, 0.3, true))
|
comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp + 60 * 1000, 0.3, true))
|
||||||
)
|
).isNotEqualTo(comboPlugin.generatePumpBolusId(Bolus(pumpTimestamp, 0.3, true)))
|
||||||
// generated timestamp has second-precision
|
// generated timestamp has second-precision
|
||||||
val bolus = Bolus(pumpTimestamp, 0.2, true)
|
val bolus = Bolus(pumpTimestamp, 0.2, true)
|
||||||
val calculatedTimestamp = comboPlugin.generatePumpBolusId(bolus)
|
val calculatedTimestamp = comboPlugin.generatePumpBolusId(bolus)
|
||||||
Assertions.assertEquals(calculatedTimestamp, calculatedTimestamp - calculatedTimestamp % 1000)
|
assertThat(calculatedTimestamp - calculatedTimestamp % 1000).isEqualTo(calculatedTimestamp)
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -73,7 +73,7 @@
|
||||||
<string name="medtronic_cmd_desc_set_basal_profile">Angi basal profil</string>
|
<string name="medtronic_cmd_desc_set_basal_profile">Angi basal profil</string>
|
||||||
<string name="medtronic_cmd_desc_get_tbr">Henter Temp Basal</string>
|
<string name="medtronic_cmd_desc_get_tbr">Henter Temp Basal</string>
|
||||||
<string name="medtronic_cmd_desc_set_tbr">Angi Temp Basal</string>
|
<string name="medtronic_cmd_desc_set_tbr">Angi Temp Basal</string>
|
||||||
<string name="medtronic_cmd_desc_cancel_tbr">Avbryt temp basal</string>
|
<string name="medtronic_cmd_desc_cancel_tbr">Avbryt midlertidig basal</string>
|
||||||
<string name="medtronic_cmd_desc_set_bolus">Angi Bolus</string>
|
<string name="medtronic_cmd_desc_set_bolus">Angi Bolus</string>
|
||||||
<string name="medtronic_cmd_desc_get_remaining_insulin">Oppdater status insulinvolum</string>
|
<string name="medtronic_cmd_desc_get_remaining_insulin">Oppdater status insulinvolum</string>
|
||||||
<string name="medtronic_pump_status_pump_unreachable">Pumpe utilgjengelig</string>
|
<string name="medtronic_pump_status_pump_unreachable">Pumpe utilgjengelig</string>
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump
|
package info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump
|
||||||
|
|
||||||
import app.aaps.core.interfaces.ui.UiInteraction
|
import app.aaps.core.interfaces.ui.UiInteraction
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicTestBase
|
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicTestBase
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RawHistoryPage
|
import info.nightscout.androidaps.plugins.pump.medtronic.comm.history.RawHistoryPage
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType
|
import info.nightscout.androidaps.plugins.pump.medtronic.defs.MedtronicDeviceType
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
|
import info.nightscout.androidaps.plugins.pump.medtronic.driver.MedtronicPumpStatus
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
|
import info.nightscout.androidaps.plugins.pump.medtronic.util.MedtronicUtil
|
||||||
import info.nightscout.pump.common.utils.ByteUtil
|
import info.nightscout.pump.common.utils.ByteUtil
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.BeforeEach
|
import org.junit.jupiter.api.BeforeEach
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
|
@ -162,7 +162,7 @@ class MedtronicPumpHistoryDecoderUTest : MedtronicTestBase() {
|
||||||
"5A 0F 20 F4 0C 03 15 19 11 00 17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1A 11 00 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 01 12 12 00 25 DE 2D 43 15 01 50 50 00 26 EA 2D 43 15 01 4B 4B 00 2C C9 34 43 15 62 00 2F CB 17 03 15 01 33 33 00 16 DE 37 43 15 07 00 00 07 FE 23 95 6D 23 95 0A 08 00 2B 00 00 00 00 07 FE 03 8E 2C 04 70 38 00 00 04 70 38 00 00 00 00 00 00 04 70 64 06 00 00 00 06 08 00 2B 00 00 00 2C A0 2F E3 01 04 15 33 00 2F E7 04 44 15 00 16 03 2F E7 04 44 15 33 28 3B C2 06 44 15 00 16 01 3B C2 06 44 15 08 08 17 DB 0B 44 15 00 26 00 06 26 00 0C 26 00 12 28 00 18 26 00 1E 26 00 24 24 00 2A 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 18 17 DB 0B 44 15 00 26 00 02 26 00 04 26 00 06 24 00 08 24 00 0A 24 00 0C 26 00 0E 26 00 10 26 00 12 28 00 14 28 00 16 28 00 18 26 00 1A 26 00 1C 26 00 1E 26 00 20 26 00 22 26 00 24 24 00 26 24 00 28 24 00 2A 26 00 2C 26 00 2E 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 45 45 00 28 E9 2B 44 15 19 00 00 C1 0D 04 15 1A 00 15 C3 0D 04 15 1A 01 33 C3 0D 04 15 01 28 28 00 07 CC 2E 44 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 2D",
|
"5A 0F 20 F4 0C 03 15 19 11 00 17 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1A 11 00 0F 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 1E 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 32 50 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 33 01 12 12 00 25 DE 2D 43 15 01 50 50 00 26 EA 2D 43 15 01 4B 4B 00 2C C9 34 43 15 62 00 2F CB 17 03 15 01 33 33 00 16 DE 37 43 15 07 00 00 07 FE 23 95 6D 23 95 0A 08 00 2B 00 00 00 00 07 FE 03 8E 2C 04 70 38 00 00 04 70 38 00 00 00 00 00 00 04 70 64 06 00 00 00 06 08 00 2B 00 00 00 2C A0 2F E3 01 04 15 33 00 2F E7 04 44 15 00 16 03 2F E7 04 44 15 33 28 3B C2 06 44 15 00 16 01 3B C2 06 44 15 08 08 17 DB 0B 44 15 00 26 00 06 26 00 0C 26 00 12 28 00 18 26 00 1E 26 00 24 24 00 2A 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 18 17 DB 0B 44 15 00 26 00 02 26 00 04 26 00 06 24 00 08 24 00 0A 24 00 0C 26 00 0E 26 00 10 26 00 12 28 00 14 28 00 16 28 00 18 26 00 1A 26 00 1C 26 00 1E 26 00 20 26 00 22 26 00 24 24 00 26 24 00 28 24 00 2A 26 00 2C 26 00 2E 26 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 45 45 00 28 E9 2B 44 15 19 00 00 C1 0D 04 15 1A 00 15 C3 0D 04 15 1A 01 33 C3 0D 04 15 01 28 28 00 07 CC 2E 44 15 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 14 2D",
|
||||||
MedtronicDeviceType.Medtronic_522_722
|
MedtronicDeviceType.Medtronic_522_722
|
||||||
)
|
)
|
||||||
Assertions.assertEquals(20, pumpHistoryEntries.size.toLong())
|
assertThat(pumpHistoryEntries).hasSize(20)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Throws(Exception::class) fun historyProblem_423_duzy78() {
|
@Test @Throws(Exception::class) fun historyProblem_423_duzy78() {
|
||||||
|
@ -170,7 +170,7 @@ class MedtronicPumpHistoryDecoderUTest : MedtronicTestBase() {
|
||||||
"16 00 08 D0 0E 51 15 33 60 0A D0 0E 51 15 00 16 01 0A D0 0E 51 15 33 00 07 DF 0E 51 15 00 16 00 07 DF 0E 51 15 33 6C 09 DF 0E 51 15 00 16 01 09 DF 0E 51 15 33 00 25 ED 0E 51 15 00 16 00 25 ED 0E 51 15 33 2C 27 ED 0E 51 15 00 16 01 27 ED 0E 51 15 33 00 07 F4 0E 51 15 00 16 00 07 F4 0E 51 15 33 00 09 F4 0E 51 15 00 16 01 09 F4 0E 51 15 33 2C 25 D5 0F 51 15 00 16 01 25 D5 0F 51 15 01 3C 3C 00 30 D5 4F 51 15 33 2C 25 F7 0F 51 15 00 16 01 25 F7 0F 51 15 33 00 07 C6 10 51 15 00 16 00 07 C6 10 51 15 33 30 09 C6 10 51 15 00 16 01 09 C6 10 51 15 33 30 25 E8 10 51 15 00 16 01 25 E8 10 51 15 33 30 24 CF 11 51 15 00 16 01 24 CF 11 51 15 33 00 23 E4 11 51 15 00 16 00 23 E4 11 51 15 33 3C 25 E4 11 51 15 00 16 01 25 E4 11 51 15 33 00 23 E8 11 51 15 00 16 00 23 E8 11 51 15 33 4A 25 E8 11 51 15 00 16 01 25 E8 11 51 15 33 00 19 EE 11 51 15 00 16 00 19 EE 11 51 15 33 30 1B EE 11 51 15 00 16 01 1B EE 11 51 15 33 00 23 F2 11 51 15 00 16 00 23 F2 11 51 15 33 3E 25 F2 11 51 15 00 16 01 25 F2 11 51 15 33 00 24 C0 12 51 15 00 16 00 24 C0 12 51 15 33 5E 25 C0 12 51 15 00 16 01 25 C0 12 51 15 33 00 23 CF 12 51 15 00 16 00 23 CF 12 51 15 33 64 25 CF 12 51 15 00 16 01 25 CF 12 51 15 33 00 23 D9 12 51 15 00 16 00 23 D9 12 51 15 33 6A 25 D9 12 51 15 00 16 01 25 D9 12 51 15 33 00 23 E9 12 51 15 00 16 00 23 E9 12 51 15 33 30 25 E9 12 51 15 00 16 01 25 E9 12 51 15 01 16 16 00 10 C2 53 51 15 33 30 24 CF 13 51 15 00 16 01 24 CF 13 51 15 33 30 04 EE 13 51 15 00 16 01 04 EE 13 51 15 01 14 14 00 3B F0 53 51 15 33 00 22 C0 14 51 15 00 16 00 22 C0 14 51 15 33 22 24 C0 14 51 15 00 16 01 24 C0 14 51 15 33 22 03 DF 14 51 15 00 16 01 03 DF 14 51 15 1E 00 37 E1 14 11 15 1F 00 01 EE 14 11 15 33 22 03 C6 15 51 15 00 16 01 03 C6 15 51 15 33 00 20 D9 15 51 15 00 16 00 20 D9 15 51 15 33 34 22 D9 15 51 15 00 16 01 22 D9 15 51 15 39 14 0E DF 35 71 15 83 92 40 01 0B 0B 00 37 E0 55 51 15 33 00 21 E3 15 51 15 00 16 00 21 E3 15 51 15 33 22 22 E3 15 51 15 00 16 01 22 E3 15 51 15 33 00 21 E8 15 51 15 00 16 00 21 E8 15 51 15 33 30 23 E8 15 51 15 00 16 01 23 E8 15 51 15 33 00 20 ED 15 51 15 00 16 00 20 ED 15 51 15 33 22 22 ED 15 51 15 00 16 01 22 ED 15 51 15 33 00 03 F8 15 51 15 00 16 00 03 F8 15 51 15 33 32 05 F8 15 51 15 00 16 01 05 F8 15 51 15 33 00 01 CB 16 51 15 00 16 00 01 CB 16 51 15 33 20 03 CB 16 51 15 00 16 01 03 CB 16 51 15 33 2A 20 ED 16 51 15 00 16 01 20 ED 16 51 15 33 00 02 F8 16 51 15 00 16 00 02 F8 16 51 15 33 2C 04 F8 16 51 15 00 16 01 04 F8 16 51 15 33 00 1F CA 17 51 15 00 16 00 1F CA 17 51 15 33 34 21 CA 17 51 15 00 16 01 21 CA 17 51 15 33 00 1F D4 17 51 15 00 16 00 1F D4 17 51 15 33 38 21 D4 17 51 15 00 16 01 21 D4 17 51 15 33 00 15 EE 17 51 15 00 16 00 15 EE 17 51 15 33 42 17 EE 17 51 15 00 16 01 17 EE 17 51 15 07 00 00 08 0A 31 95 6C 31 95 05 00 A1 A1 A1 01 00 00 08 0A 04 8E 39 03 7C 2B 00 00 03 7C 2B 00 00 00 00 00 00 03 7C 64 07 00 00 00 07 33 00 05 C1 00 52 15 00 16 00 05 C1 00 52 15 33 50 07 C1 00 52 15 00 16 01 07 C1 00 52 15 33 00 01 CB 00 52 15 00 16 00 01 CB 00 52 15 33 26 03 CB 00 52 15 00 16 01 03 CB 00 52 15 33 00 1E DE 00 52 15 00 00 00 8F 0E",
|
"16 00 08 D0 0E 51 15 33 60 0A D0 0E 51 15 00 16 01 0A D0 0E 51 15 33 00 07 DF 0E 51 15 00 16 00 07 DF 0E 51 15 33 6C 09 DF 0E 51 15 00 16 01 09 DF 0E 51 15 33 00 25 ED 0E 51 15 00 16 00 25 ED 0E 51 15 33 2C 27 ED 0E 51 15 00 16 01 27 ED 0E 51 15 33 00 07 F4 0E 51 15 00 16 00 07 F4 0E 51 15 33 00 09 F4 0E 51 15 00 16 01 09 F4 0E 51 15 33 2C 25 D5 0F 51 15 00 16 01 25 D5 0F 51 15 01 3C 3C 00 30 D5 4F 51 15 33 2C 25 F7 0F 51 15 00 16 01 25 F7 0F 51 15 33 00 07 C6 10 51 15 00 16 00 07 C6 10 51 15 33 30 09 C6 10 51 15 00 16 01 09 C6 10 51 15 33 30 25 E8 10 51 15 00 16 01 25 E8 10 51 15 33 30 24 CF 11 51 15 00 16 01 24 CF 11 51 15 33 00 23 E4 11 51 15 00 16 00 23 E4 11 51 15 33 3C 25 E4 11 51 15 00 16 01 25 E4 11 51 15 33 00 23 E8 11 51 15 00 16 00 23 E8 11 51 15 33 4A 25 E8 11 51 15 00 16 01 25 E8 11 51 15 33 00 19 EE 11 51 15 00 16 00 19 EE 11 51 15 33 30 1B EE 11 51 15 00 16 01 1B EE 11 51 15 33 00 23 F2 11 51 15 00 16 00 23 F2 11 51 15 33 3E 25 F2 11 51 15 00 16 01 25 F2 11 51 15 33 00 24 C0 12 51 15 00 16 00 24 C0 12 51 15 33 5E 25 C0 12 51 15 00 16 01 25 C0 12 51 15 33 00 23 CF 12 51 15 00 16 00 23 CF 12 51 15 33 64 25 CF 12 51 15 00 16 01 25 CF 12 51 15 33 00 23 D9 12 51 15 00 16 00 23 D9 12 51 15 33 6A 25 D9 12 51 15 00 16 01 25 D9 12 51 15 33 00 23 E9 12 51 15 00 16 00 23 E9 12 51 15 33 30 25 E9 12 51 15 00 16 01 25 E9 12 51 15 01 16 16 00 10 C2 53 51 15 33 30 24 CF 13 51 15 00 16 01 24 CF 13 51 15 33 30 04 EE 13 51 15 00 16 01 04 EE 13 51 15 01 14 14 00 3B F0 53 51 15 33 00 22 C0 14 51 15 00 16 00 22 C0 14 51 15 33 22 24 C0 14 51 15 00 16 01 24 C0 14 51 15 33 22 03 DF 14 51 15 00 16 01 03 DF 14 51 15 1E 00 37 E1 14 11 15 1F 00 01 EE 14 11 15 33 22 03 C6 15 51 15 00 16 01 03 C6 15 51 15 33 00 20 D9 15 51 15 00 16 00 20 D9 15 51 15 33 34 22 D9 15 51 15 00 16 01 22 D9 15 51 15 39 14 0E DF 35 71 15 83 92 40 01 0B 0B 00 37 E0 55 51 15 33 00 21 E3 15 51 15 00 16 00 21 E3 15 51 15 33 22 22 E3 15 51 15 00 16 01 22 E3 15 51 15 33 00 21 E8 15 51 15 00 16 00 21 E8 15 51 15 33 30 23 E8 15 51 15 00 16 01 23 E8 15 51 15 33 00 20 ED 15 51 15 00 16 00 20 ED 15 51 15 33 22 22 ED 15 51 15 00 16 01 22 ED 15 51 15 33 00 03 F8 15 51 15 00 16 00 03 F8 15 51 15 33 32 05 F8 15 51 15 00 16 01 05 F8 15 51 15 33 00 01 CB 16 51 15 00 16 00 01 CB 16 51 15 33 20 03 CB 16 51 15 00 16 01 03 CB 16 51 15 33 2A 20 ED 16 51 15 00 16 01 20 ED 16 51 15 33 00 02 F8 16 51 15 00 16 00 02 F8 16 51 15 33 2C 04 F8 16 51 15 00 16 01 04 F8 16 51 15 33 00 1F CA 17 51 15 00 16 00 1F CA 17 51 15 33 34 21 CA 17 51 15 00 16 01 21 CA 17 51 15 33 00 1F D4 17 51 15 00 16 00 1F D4 17 51 15 33 38 21 D4 17 51 15 00 16 01 21 D4 17 51 15 33 00 15 EE 17 51 15 00 16 00 15 EE 17 51 15 33 42 17 EE 17 51 15 00 16 01 17 EE 17 51 15 07 00 00 08 0A 31 95 6C 31 95 05 00 A1 A1 A1 01 00 00 08 0A 04 8E 39 03 7C 2B 00 00 03 7C 2B 00 00 00 00 00 00 03 7C 64 07 00 00 00 07 33 00 05 C1 00 52 15 00 16 00 05 C1 00 52 15 33 50 07 C1 00 52 15 00 16 01 07 C1 00 52 15 33 00 01 CB 00 52 15 00 16 00 01 CB 00 52 15 33 26 03 CB 00 52 15 00 16 01 03 CB 00 52 15 33 00 1E DE 00 52 15 00 00 00 8F 0E",
|
||||||
MedtronicDeviceType.Medtronic_515_715
|
MedtronicDeviceType.Medtronic_515_715
|
||||||
)
|
)
|
||||||
Assertions.assertEquals(131, pumpHistoryEntries.size.toLong())
|
assertThat(pumpHistoryEntries).hasSize(131)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test @Throws(Exception::class) fun historyProblem_476_OpossumGit() {
|
@Test @Throws(Exception::class) fun historyProblem_476_OpossumGit() {
|
||||||
|
@ -178,7 +178,7 @@ class MedtronicPumpHistoryDecoderUTest : MedtronicTestBase() {
|
||||||
"08 07 50 05 0D 4D 15 00 18 00 08 14 00 0E 10 00 14 08 00 1E 12 00 26 16 00 2B 1A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 18 50 05 0D 4D 15 00 18 00 02 18 00 04 18 00 06 18 00 08 14 00 0A 14 00 0C 14 00 0E 10 00 10 10 00 12 10 00 14 08 00 16 08 00 18 08 00 1A 08 00 1C 08 00 1E 14 00 20 14 00 22 14 00 24 14 00 26 16 00 28 16 00 2A 16 00 2C 1C 00 2E 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04 04 00 44 09 4D 4D 15 33 06 57 15 0D 4D 15 00 16 01 57 15 0D 4D 15 33 00 77 15 0D 4D 15 00 16 00 77 15 0D 4D 15 33 00 5D 16 0D 4D 15 00 16 04 5D 16 0D 4D 15 33 00 61 1A 0D 4D 15 00 16 00 61 1A 0D 4D 15 5D 00 5E 31 0D 0D 15 1A 00 6E 31 0D 0D 15 06 03 04 D2 6E 31 6D 0D 15 0C 03 11 40 00 01 05 64 01 13 40 00 01 05 17 00 0A 41 00 01 05 18 00 40 39 15 0D 15 21 00 53 04 16 0D 15 03 00 00 00 58 57 09 36 0D 15 5D 01 78 0A 16 0D 15 64 01 78 0A 16 8D 15 2C 68 78 0A 16 8D 15 24 3C 78 0A 16 8D 15 63 02 78 0A 16 8D 15 1B 12 78 0A 16 8D 15 65 61 78 0A 16 8D 15 61 00 78 0A 16 8D 15 32 0E 78 0A 16 8D 15 66 00 78 0A 16 8D 15 3C 01 78 0A 16 8D 15 3D 88 32 93 00 00 00 3E 00 00 00 00 00 00 26 01 78 0A 16 8D 15 27 01 B2 08 00 00 00 28 00 00 00 00 00 00 60 00 78 0A 16 4D 15 23 00 78 0A 16 8D 15 5E 01 78 0A 16 8D 15 2D 01 78 0A 16 8D 15 5A 0F 78 0A 16 8D 15 49 13 00 07 12 0A 1E 0B 2A 0A 00 00 00 00 00 00 00 00 00 23 08 27 2C 23 00 00 00 00 00 00 00 00 00 00 00 32 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 13 00 07 12 0A 1E 0B 2A 0A 00 00 00 00 00 00 00 00 00 23 08 27 2C 23 00 00 00 00 00 00 00 00 00 00 00 32 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 22 62 00 78 0A 16 8D 15 5F 51 78 0A 16 8D 15 4F 00 78 0A 16 8D 15 40 01 00 6F 1C 16 1E 00 3C 14 00 1E 3C 1F 15 70 40 01 00 6F 1C 16 1E 00 3C 14 00 1E 3C 1F 15 70 08 18 78 0A 16 8D 15 00 18 00 02 18 00 04 18 00 06 18 00 08 14 00 0A 14 00 0C 14 00 0E 10 00 10 10 00 12 10 00 14 08 00 16 08 00 18 08 00 1A 08 00 1C 08 00 1E 14 00 20 14 00 22 14 00 24 14 00 26 16 00 28 16 00 2A 16 00 2C 1C 00 2E 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 D6 06",
|
"08 07 50 05 0D 4D 15 00 18 00 08 14 00 0E 10 00 14 08 00 1E 12 00 26 16 00 2B 1A 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 09 18 50 05 0D 4D 15 00 18 00 02 18 00 04 18 00 06 18 00 08 14 00 0A 14 00 0C 14 00 0E 10 00 10 10 00 12 10 00 14 08 00 16 08 00 18 08 00 1A 08 00 1C 08 00 1E 14 00 20 14 00 22 14 00 24 14 00 26 16 00 28 16 00 2A 16 00 2C 1C 00 2E 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 04 04 00 44 09 4D 4D 15 33 06 57 15 0D 4D 15 00 16 01 57 15 0D 4D 15 33 00 77 15 0D 4D 15 00 16 00 77 15 0D 4D 15 33 00 5D 16 0D 4D 15 00 16 04 5D 16 0D 4D 15 33 00 61 1A 0D 4D 15 00 16 00 61 1A 0D 4D 15 5D 00 5E 31 0D 0D 15 1A 00 6E 31 0D 0D 15 06 03 04 D2 6E 31 6D 0D 15 0C 03 11 40 00 01 05 64 01 13 40 00 01 05 17 00 0A 41 00 01 05 18 00 40 39 15 0D 15 21 00 53 04 16 0D 15 03 00 00 00 58 57 09 36 0D 15 5D 01 78 0A 16 0D 15 64 01 78 0A 16 8D 15 2C 68 78 0A 16 8D 15 24 3C 78 0A 16 8D 15 63 02 78 0A 16 8D 15 1B 12 78 0A 16 8D 15 65 61 78 0A 16 8D 15 61 00 78 0A 16 8D 15 32 0E 78 0A 16 8D 15 66 00 78 0A 16 8D 15 3C 01 78 0A 16 8D 15 3D 88 32 93 00 00 00 3E 00 00 00 00 00 00 26 01 78 0A 16 8D 15 27 01 B2 08 00 00 00 28 00 00 00 00 00 00 60 00 78 0A 16 4D 15 23 00 78 0A 16 8D 15 5E 01 78 0A 16 8D 15 2D 01 78 0A 16 8D 15 5A 0F 78 0A 16 8D 15 49 13 00 07 12 0A 1E 0B 2A 0A 00 00 00 00 00 00 00 00 00 23 08 27 2C 23 00 00 00 00 00 00 00 00 00 00 00 32 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 49 13 00 07 12 0A 1E 0B 2A 0A 00 00 00 00 00 00 00 00 00 23 08 27 2C 23 00 00 00 00 00 00 00 00 00 00 00 32 41 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 22 62 00 78 0A 16 8D 15 5F 51 78 0A 16 8D 15 4F 00 78 0A 16 8D 15 40 01 00 6F 1C 16 1E 00 3C 14 00 1E 3C 1F 15 70 40 01 00 6F 1C 16 1E 00 3C 14 00 1E 3C 1F 15 70 08 18 78 0A 16 8D 15 00 18 00 02 18 00 04 18 00 06 18 00 08 14 00 0A 14 00 0C 14 00 0E 10 00 10 10 00 12 10 00 14 08 00 16 08 00 18 08 00 1A 08 00 1C 08 00 1E 14 00 20 14 00 22 14 00 24 14 00 26 16 00 28 16 00 2A 16 00 2C 1C 00 2E 1C 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 D6 06",
|
||||||
MedtronicDeviceType.Medtronic_522_722
|
MedtronicDeviceType.Medtronic_522_722
|
||||||
)
|
)
|
||||||
Assertions.assertEquals(41, pumpHistoryEntries.size.toLong())
|
assertThat(pumpHistoryEntries).hasSize(41)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Throws(Exception::class)
|
@Throws(Exception::class)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
package info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump
|
package info.nightscout.androidaps.plugins.pump.medtronic.comm.history.pump
|
||||||
|
|
||||||
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicTestBase
|
import info.nightscout.androidaps.plugins.pump.medtronic.MedtronicTestBase
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -16,6 +16,6 @@ class PumpHistoryEntryUTest : MedtronicTestBase() {
|
||||||
val queryObject = 20191009000000L
|
val queryObject = 20191009000000L
|
||||||
val phe = PumpHistoryEntry()
|
val phe = PumpHistoryEntry()
|
||||||
phe.atechDateTime = dateObject
|
phe.atechDateTime = dateObject
|
||||||
Assertions.assertTrue(phe.isAfter(queryObject))
|
assertThat(phe.isAfter(queryObject)).isTrue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -71,6 +71,15 @@ class MedtrumPump @Inject constructor(
|
||||||
_activeAlarms = value
|
_activeAlarms = value
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// New pump warnings
|
||||||
|
private val _pumpWarning = MutableStateFlow(AlarmState.NONE)
|
||||||
|
val pumpWarningFlow: StateFlow<AlarmState> = _pumpWarning
|
||||||
|
var pumpWarning: AlarmState
|
||||||
|
get() = _pumpWarning.value
|
||||||
|
set(value) {
|
||||||
|
_pumpWarning.value = value
|
||||||
|
}
|
||||||
|
|
||||||
// Prime progress as state flow
|
// Prime progress as state flow
|
||||||
private val _primeProgress = MutableStateFlow(0)
|
private val _primeProgress = MutableStateFlow(0)
|
||||||
val primeProgressFlow: StateFlow<Int> = _primeProgress
|
val primeProgressFlow: StateFlow<Int> = _primeProgress
|
||||||
|
|
|
@ -200,7 +200,11 @@ class NotificationPacket(val injector: HasAndroidInjector) {
|
||||||
val alarmState = AlarmState.values()[i]
|
val alarmState = AlarmState.values()[i]
|
||||||
if ((alarmFlags shr i) and 1 != 0) {
|
if ((alarmFlags shr i) and 1 != 0) {
|
||||||
// If the alarm bit is set, add the corresponding alarm to activeAlarms
|
// If the alarm bit is set, add the corresponding alarm to activeAlarms
|
||||||
|
if (!medtrumPump.activeAlarms.contains(alarmState)) {
|
||||||
|
aapsLogger.debug(LTag.PUMPCOMM, "Adding alarm $alarmState to active alarms")
|
||||||
medtrumPump.addAlarm(alarmState)
|
medtrumPump.addAlarm(alarmState)
|
||||||
|
medtrumPump.pumpWarning = alarmState
|
||||||
|
}
|
||||||
} else if (medtrumPump.activeAlarms.contains(alarmState)) {
|
} else if (medtrumPump.activeAlarms.contains(alarmState)) {
|
||||||
// If the alarm bit is not set, and the corresponding alarm is in activeAlarms, remove it
|
// If the alarm bit is not set, and the corresponding alarm is in activeAlarms, remove it
|
||||||
medtrumPump.removeAlarm(alarmState)
|
medtrumPump.removeAlarm(alarmState)
|
||||||
|
|
|
@ -164,6 +164,11 @@ class MedtrumService : DaggerService(), BLECommCallback {
|
||||||
handleConnectionStateChange(connectionState)
|
handleConnectionStateChange(connectionState)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
scope.launch {
|
||||||
|
medtrumPump.pumpWarningFlow.collect { pumpWarning ->
|
||||||
|
notifyPumpWarning(pumpWarning)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
|
@ -317,6 +322,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
|
||||||
}
|
}
|
||||||
// Resume suspended pump
|
// Resume suspended pump
|
||||||
if (result) result = sendPacketAndGetResponse(ResumePumpPacket(injector))
|
if (result) result = sendPacketAndGetResponse(ResumePumpPacket(injector))
|
||||||
|
if (result) medtrumPump.clearAlarmState()
|
||||||
}
|
}
|
||||||
return result
|
return result
|
||||||
}
|
}
|
||||||
|
@ -420,6 +426,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
|
||||||
var communicationLost = false
|
var communicationLost = false
|
||||||
var connectionRetryCounter = 0
|
var connectionRetryCounter = 0
|
||||||
var checkTime = medtrumPump.bolusProgressLastTimeStamp
|
var checkTime = medtrumPump.bolusProgressLastTimeStamp
|
||||||
|
var lastSentBolusAmount: Double? = null
|
||||||
|
|
||||||
while (!medtrumPump.bolusStopped && !medtrumPump.bolusDone && !communicationLost) {
|
while (!medtrumPump.bolusStopped && !medtrumPump.bolusDone && !communicationLost) {
|
||||||
SystemClock.sleep(100)
|
SystemClock.sleep(100)
|
||||||
|
@ -436,10 +443,15 @@ class MedtrumService : DaggerService(), BLECommCallback {
|
||||||
disconnect("Communication stopped")
|
disconnect("Communication stopped")
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
val currentBolusAmount = medtrumPump.bolusingTreatment?.insulin
|
||||||
|
|
||||||
|
if (currentBolusAmount != null && currentBolusAmount != lastSentBolusAmount) {
|
||||||
bolusingEvent.t = medtrumPump.bolusingTreatment
|
bolusingEvent.t = medtrumPump.bolusingTreatment
|
||||||
bolusingEvent.status = rh.gs(info.nightscout.pump.common.R.string.bolus_delivered_so_far, medtrumPump.bolusingTreatment?.insulin, medtrumPump.bolusAmountToBeDelivered)
|
bolusingEvent.status = rh.gs(info.nightscout.pump.common.R.string.bolus_delivered_so_far, medtrumPump.bolusingTreatment?.insulin, medtrumPump.bolusAmountToBeDelivered)
|
||||||
bolusingEvent.percent = round((medtrumPump.bolusingTreatment?.insulin?.div(medtrumPump.bolusAmountToBeDelivered) ?: 0.0) * 100).toInt() - 1
|
bolusingEvent.percent = round(currentBolusAmount.div(medtrumPump.bolusAmountToBeDelivered) * 100).toInt() - 1
|
||||||
rxBus.send(bolusingEvent)
|
rxBus.send(bolusingEvent)
|
||||||
|
lastSentBolusAmount = currentBolusAmount
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -577,6 +589,7 @@ class MedtrumService : DaggerService(), BLECommCallback {
|
||||||
when (state) {
|
when (state) {
|
||||||
MedtrumPumpState.NONE,
|
MedtrumPumpState.NONE,
|
||||||
MedtrumPumpState.STOPPED -> {
|
MedtrumPumpState.STOPPED -> {
|
||||||
|
rxBus.send(EventDismissNotification(Notification.PUMP_WARNING))
|
||||||
rxBus.send(EventDismissNotification(Notification.PUMP_ERROR))
|
rxBus.send(EventDismissNotification(Notification.PUMP_ERROR))
|
||||||
rxBus.send(EventDismissNotification(Notification.PUMP_SUSPENDED))
|
rxBus.send(EventDismissNotification(Notification.PUMP_SUSPENDED))
|
||||||
uiInteraction.addNotification(
|
uiInteraction.addNotification(
|
||||||
|
@ -607,7 +620,6 @@ class MedtrumService : DaggerService(), BLECommCallback {
|
||||||
MedtrumPumpState.ACTIVE_ALT -> {
|
MedtrumPumpState.ACTIVE_ALT -> {
|
||||||
rxBus.send(EventDismissNotification(Notification.PATCH_NOT_ACTIVE))
|
rxBus.send(EventDismissNotification(Notification.PATCH_NOT_ACTIVE))
|
||||||
rxBus.send(EventDismissNotification(Notification.PUMP_SUSPENDED))
|
rxBus.send(EventDismissNotification(Notification.PUMP_SUSPENDED))
|
||||||
medtrumPump.clearAlarmState()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MedtrumPumpState.LOW_BG_SUSPENDED,
|
MedtrumPumpState.LOW_BG_SUSPENDED,
|
||||||
|
@ -625,20 +637,22 @@ class MedtrumService : DaggerService(), BLECommCallback {
|
||||||
}
|
}
|
||||||
|
|
||||||
MedtrumPumpState.HOURLY_MAX_SUSPENDED -> {
|
MedtrumPumpState.HOURLY_MAX_SUSPENDED -> {
|
||||||
uiInteraction.addNotification(
|
uiInteraction.addNotificationWithSound(
|
||||||
Notification.PUMP_SUSPENDED,
|
Notification.PUMP_SUSPENDED,
|
||||||
rh.gs(R.string.pump_is_suspended_hour_max),
|
rh.gs(R.string.pump_is_suspended_hour_max),
|
||||||
Notification.NORMAL,
|
Notification.URGENT,
|
||||||
|
app.aaps.core.ui.R.raw.alarm
|
||||||
)
|
)
|
||||||
// Pump will report proper TBR for this from loadEvents()
|
// Pump will report proper TBR for this from loadEvents()
|
||||||
commandQueue.loadEvents(null)
|
commandQueue.loadEvents(null)
|
||||||
}
|
}
|
||||||
|
|
||||||
MedtrumPumpState.DAILY_MAX_SUSPENDED -> {
|
MedtrumPumpState.DAILY_MAX_SUSPENDED -> {
|
||||||
uiInteraction.addNotification(
|
uiInteraction.addNotificationWithSound(
|
||||||
Notification.PUMP_SUSPENDED,
|
Notification.PUMP_SUSPENDED,
|
||||||
rh.gs(R.string.pump_is_suspended_day_max),
|
rh.gs(R.string.pump_is_suspended_day_max),
|
||||||
Notification.NORMAL,
|
Notification.URGENT,
|
||||||
|
app.aaps.core.ui.R.raw.alarm
|
||||||
)
|
)
|
||||||
// Pump will report proper TBR for this from loadEvents()
|
// Pump will report proper TBR for this from loadEvents()
|
||||||
commandQueue.loadEvents(null)
|
commandQueue.loadEvents(null)
|
||||||
|
@ -683,6 +697,23 @@ class MedtrumService : DaggerService(), BLECommCallback {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun notifyPumpWarning(alarmState: AlarmState) {
|
||||||
|
// Notification on pump warning
|
||||||
|
if (sp.getBoolean(R.string.key_pump_warning_notification, true) && alarmState != AlarmState.NONE) {
|
||||||
|
uiInteraction.addNotification(
|
||||||
|
Notification.PUMP_WARNING,
|
||||||
|
rh.gs(R.string.pump_warning, medtrumPump.alarmStateToString(alarmState)),
|
||||||
|
Notification.ANNOUNCEMENT,
|
||||||
|
)
|
||||||
|
pumpSync.insertAnnouncement(
|
||||||
|
medtrumPump.alarmStateToString(alarmState),
|
||||||
|
null,
|
||||||
|
medtrumPump.pumpType(),
|
||||||
|
medtrumPump.pumpSN.toString(radix = 16)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** BLECommCallbacks */
|
/** BLECommCallbacks */
|
||||||
override fun onBLEConnected() {
|
override fun onBLEConnected() {
|
||||||
aapsLogger.debug(LTag.PUMPCOMM, "<<<<< onBLEConnected")
|
aapsLogger.debug(LTag.PUMPCOMM, "<<<<< onBLEConnected")
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<string name="medtrum_pump_description">Integrace pumpy pro Medtrum Nano a Medtrum 300U</string>
|
<string name="medtrum_pump_description">Integrace pumpy pro Medtrum Nano a Medtrum 300U</string>
|
||||||
<string name="medtrum_pump_setting">Nastavení pumpy Medtrum</string>
|
<string name="medtrum_pump_setting">Nastavení pumpy Medtrum</string>
|
||||||
<string name="pump_error">Chyba pumpy: %1$s!! </string>
|
<string name="pump_error">Chyba pumpy: %1$s!! </string>
|
||||||
|
<string name="pump_warning">Varování pumpy: %1$s </string>
|
||||||
<string name="pump_is_suspended">Pumpa je pozastavena</string>
|
<string name="pump_is_suspended">Pumpa je pozastavena</string>
|
||||||
<string name="pump_is_suspended_hour_max">Pumpa je pozastavena kvůli překročení maximálního množství inzulínu za hodinu</string>
|
<string name="pump_is_suspended_hour_max">Pumpa je pozastavena kvůli překročení maximálního množství inzulínu za hodinu</string>
|
||||||
<string name="pump_is_suspended_day_max">Pumpa je pozastavena kvůli překročení maximálního množství inzulínu za den</string>
|
<string name="pump_is_suspended_day_max">Pumpa je pozastavena kvůli překročení maximálního množství inzulínu za den</string>
|
||||||
|
@ -106,6 +107,8 @@
|
||||||
<string name="pump_unsupported">Nevyzkoušená pumpa: %1$d! Kontaktujte nás na Discordu nebo Githubu, kde získáte podporu.</string>
|
<string name="pump_unsupported">Nevyzkoušená pumpa: %1$d! Kontaktujte nás na Discordu nebo Githubu, kde získáte podporu.</string>
|
||||||
<string name="alarm_setting_title">Nastavení alarmů</string>
|
<string name="alarm_setting_title">Nastavení alarmů</string>
|
||||||
<string name="alarm_setting_summary">Vyberte preferované nastavení alarmů.</string>
|
<string name="alarm_setting_summary">Vyberte preferované nastavení alarmů.</string>
|
||||||
|
<string name="pump_warning_notification_title">Oznámení o varování pumpy</string>
|
||||||
|
<string name="pump_warning_notification_summary">Zobrazit upozornění na nekritická varování pumpy: vybitá baterie, téměř prázdný zásobník (20 jednotek) a brzy dojde inzulin. Doporučeno ponechat zapnuté, když jsou výstrahy pumpy nastaveny na ticho.</string>
|
||||||
<string name="patch_expiration_title">Vypršení platnosti Patche</string>
|
<string name="patch_expiration_title">Vypršení platnosti Patche</string>
|
||||||
<string name="patch_expiration_summary">Pokud je povoleno, Patch vyprší po 3 dnech s maximální dobou odkladu 8 hodin.</string>
|
<string name="patch_expiration_summary">Pokud je povoleno, Patch vyprší po 3 dnech s maximální dobou odkladu 8 hodin.</string>
|
||||||
<string name="hourly_max_insulin_title">Hodinové maximum inzulínu</string>
|
<string name="hourly_max_insulin_title">Hodinové maximum inzulínu</string>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<string name="medtrum_pump_description">Integración de bombas de insulina Medtrum Nano y Medtrum 300U</string>
|
<string name="medtrum_pump_description">Integración de bombas de insulina Medtrum Nano y Medtrum 300U</string>
|
||||||
<string name="medtrum_pump_setting">Ajustes de la bomba Medtrum</string>
|
<string name="medtrum_pump_setting">Ajustes de la bomba Medtrum</string>
|
||||||
<string name="pump_error">Error de bomba: %1$s !! </string>
|
<string name="pump_error">Error de bomba: %1$s !! </string>
|
||||||
|
<string name="pump_warning">Advertencia de la bomba: %1$s</string>
|
||||||
<string name="pump_is_suspended">Bomba suspendida</string>
|
<string name="pump_is_suspended">Bomba suspendida</string>
|
||||||
<string name="pump_is_suspended_hour_max">Bomba suspendida por superarse el máximo de insulina por hora</string>
|
<string name="pump_is_suspended_hour_max">Bomba suspendida por superarse el máximo de insulina por hora</string>
|
||||||
<string name="pump_is_suspended_day_max">Bomba suspendida por superar el máximo diario de insulina</string>
|
<string name="pump_is_suspended_day_max">Bomba suspendida por superar el máximo diario de insulina</string>
|
||||||
|
@ -106,6 +107,8 @@
|
||||||
<string name="pump_unsupported">Bomba no probada: %1$d! Por favor, contacta con nosotros en Discord o GitHub para obtener soporte</string>
|
<string name="pump_unsupported">Bomba no probada: %1$d! Por favor, contacta con nosotros en Discord o GitHub para obtener soporte</string>
|
||||||
<string name="alarm_setting_title">Ajustes de las alarmas</string>
|
<string name="alarm_setting_title">Ajustes de las alarmas</string>
|
||||||
<string name="alarm_setting_summary">Selecciona los ajustes de la alarma de la bomba que prefieras.</string>
|
<string name="alarm_setting_summary">Selecciona los ajustes de la alarma de la bomba que prefieras.</string>
|
||||||
|
<string name="pump_warning_notification_title">Notificación sobre advertencia de la bomba</string>
|
||||||
|
<string name="pump_warning_notification_summary">Mostrar notificación en advertencias de la bomba no críticas: batería baja, reserva baja (20 unidades) y próxima a caducar. Se recomienda dejarlo habilitado cuando las alarmas de la bomba estén configuradas en silencio.</string>
|
||||||
<string name="patch_expiration_title">Caducidad del parche</string>
|
<string name="patch_expiration_title">Caducidad del parche</string>
|
||||||
<string name="patch_expiration_summary">Cuando está activado, el parche caducará a los 3 días, con un periodo de gracia de 8 horas adicionales</string>
|
<string name="patch_expiration_summary">Cuando está activado, el parche caducará a los 3 días, con un periodo de gracia de 8 horas adicionales</string>
|
||||||
<string name="hourly_max_insulin_title">Insulina máxima por hora</string>
|
<string name="hourly_max_insulin_title">Insulina máxima por hora</string>
|
||||||
|
|
|
@ -70,6 +70,7 @@
|
||||||
<string name="step_retry_activation">Įjungiama</string>
|
<string name="step_retry_activation">Įjungiama</string>
|
||||||
<string name="unexpected_state">Netikėta būsena: %1$s</string>
|
<string name="unexpected_state">Netikėta būsena: %1$s</string>
|
||||||
<string name="no_profile_selected">Nepasirinktas profilis. Pasirinkite profilį ir bandykite dar kartą.</string>
|
<string name="no_profile_selected">Nepasirinktas profilis. Pasirinkite profilį ir bandykite dar kartą.</string>
|
||||||
|
<string name="no_sn_in_settings">Nežinomas SN. Įveskite pompos pagrindo serijos numerį nustatymuose ir bandykite vėl.</string>
|
||||||
<string name="base_serial">Pompos pagrindo SN: %1$X</string>
|
<string name="base_serial">Pompos pagrindo SN: %1$X</string>
|
||||||
<string name="patch_begin_activation">Nėra aktyvaus rezervuaro. Spauskite <b>Kitas</b> ir pradėkite aktyvavimą.</string>
|
<string name="patch_begin_activation">Nėra aktyvaus rezervuaro. Spauskite <b>Kitas</b> ir pradėkite aktyvavimą.</string>
|
||||||
<string name="patch_not_active_note">Neprijunkite pagrindo prie rezervuaro iki kito žingsnio!</string>
|
<string name="patch_not_active_note">Neprijunkite pagrindo prie rezervuaro iki kito žingsnio!</string>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<string name="medtrum_pump_description">Pumpeintegrasjon for Medtrum Nano og Medtrum 300U</string>
|
<string name="medtrum_pump_description">Pumpeintegrasjon for Medtrum Nano og Medtrum 300U</string>
|
||||||
<string name="medtrum_pump_setting">Medtrum pumpeinnstillinger</string>
|
<string name="medtrum_pump_setting">Medtrum pumpeinnstillinger</string>
|
||||||
<string name="pump_error">Pumpefeil: %1$s!! </string>
|
<string name="pump_error">Pumpefeil: %1$s!! </string>
|
||||||
|
<string name="pump_warning">Pumpeadvarsel: %1$s </string>
|
||||||
<string name="pump_is_suspended">Pumpen er pauset</string>
|
<string name="pump_is_suspended">Pumpen er pauset</string>
|
||||||
<string name="pump_is_suspended_hour_max">Pumpe er pauset fordi maksimal insulinleveranse per time er overskredet</string>
|
<string name="pump_is_suspended_hour_max">Pumpe er pauset fordi maksimal insulinleveranse per time er overskredet</string>
|
||||||
<string name="pump_is_suspended_day_max">Pumpe er pauset fordi maksimal insulinleveranse per dag er overskredet</string>
|
<string name="pump_is_suspended_day_max">Pumpe er pauset fordi maksimal insulinleveranse per dag er overskredet</string>
|
||||||
|
@ -106,6 +107,8 @@
|
||||||
<string name="pump_unsupported">Pumpe ikke testet: %1$d! Kontakt oss på discord eller github for støtte</string>
|
<string name="pump_unsupported">Pumpe ikke testet: %1$d! Kontakt oss på discord eller github for støtte</string>
|
||||||
<string name="alarm_setting_title">Alarminnstillinger</string>
|
<string name="alarm_setting_title">Alarminnstillinger</string>
|
||||||
<string name="alarm_setting_summary">Velg dine foretrukne alarminnstillinger.</string>
|
<string name="alarm_setting_summary">Velg dine foretrukne alarminnstillinger.</string>
|
||||||
|
<string name="pump_warning_notification_title">Varsel om pumpeadvarsel</string>
|
||||||
|
<string name="pump_warning_notification_summary">Vis varsel om ikke-kritisk pumpeadvarsel: lavt batteri, lavt reservoar (20 enheter) og utløper snart. Anbefales og la være aktivert når pumpealarmer er satt til stillemodus.</string>
|
||||||
<string name="patch_expiration_title">Patch utløpsdato</string>
|
<string name="patch_expiration_title">Patch utløpsdato</string>
|
||||||
<string name="patch_expiration_summary">Når aktivert vil plasteret utløpe etter 3 dager, med en nådeperiode på 8 timer etter det.</string>
|
<string name="patch_expiration_summary">Når aktivert vil plasteret utløpe etter 3 dager, med en nådeperiode på 8 timer etter det.</string>
|
||||||
<string name="hourly_max_insulin_title">Maksimal insulin per time</string>
|
<string name="hourly_max_insulin_title">Maksimal insulin per time</string>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<string name="medtrum_pump_description">Pomp integratie voor Medtrum Nano en Medtrum 300U</string>
|
<string name="medtrum_pump_description">Pomp integratie voor Medtrum Nano en Medtrum 300U</string>
|
||||||
<string name="medtrum_pump_setting">Medtrum pomp instellingen</string>
|
<string name="medtrum_pump_setting">Medtrum pomp instellingen</string>
|
||||||
<string name="pump_error">Pomp fout: %1$s!! </string>
|
<string name="pump_error">Pomp fout: %1$s!! </string>
|
||||||
|
<string name="pump_warning">Pomp waarschuwing: %1$s </string>
|
||||||
<string name="pump_is_suspended">Pomp is onderbroken</string>
|
<string name="pump_is_suspended">Pomp is onderbroken</string>
|
||||||
<string name="pump_is_suspended_hour_max">Pomp is onderbroken als gevolg van overschrijding max insuline per uur</string>
|
<string name="pump_is_suspended_hour_max">Pomp is onderbroken als gevolg van overschrijding max insuline per uur</string>
|
||||||
<string name="pump_is_suspended_day_max">Pomp is onderbroken als gevolg van overschrijding max insuline per dag</string>
|
<string name="pump_is_suspended_day_max">Pomp is onderbroken als gevolg van overschrijding max insuline per dag</string>
|
||||||
|
@ -106,6 +107,7 @@
|
||||||
<string name="pump_unsupported">Pomp niet getest, %1$d! Neem contact met ons op via discord of github voor ondersteuning</string>
|
<string name="pump_unsupported">Pomp niet getest, %1$d! Neem contact met ons op via discord of github voor ondersteuning</string>
|
||||||
<string name="alarm_setting_title">Alarminstellingen</string>
|
<string name="alarm_setting_title">Alarminstellingen</string>
|
||||||
<string name="alarm_setting_summary">Selecteer uw gewenste alarminstellingen voor de pomp.</string>
|
<string name="alarm_setting_summary">Selecteer uw gewenste alarminstellingen voor de pomp.</string>
|
||||||
|
<string name="pump_warning_notification_title">Notificatie bij pomp waarschuwing</string>
|
||||||
<string name="patch_expiration_title">Patch vervalt</string>
|
<string name="patch_expiration_title">Patch vervalt</string>
|
||||||
<string name="patch_expiration_summary">Wanneer ingeschakeld, zal de patch na 3 dagen verlopen met een extra periode van 8 uur coulance.</string>
|
<string name="patch_expiration_summary">Wanneer ingeschakeld, zal de patch na 3 dagen verlopen met een extra periode van 8 uur coulance.</string>
|
||||||
<string name="hourly_max_insulin_title">Maximale insuline per uur</string>
|
<string name="hourly_max_insulin_title">Maximale insuline per uur</string>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<string name="medtrum_pump_description">Integracja z pompami Medtrum Nano i Medtrum 300U</string>
|
<string name="medtrum_pump_description">Integracja z pompami Medtrum Nano i Medtrum 300U</string>
|
||||||
<string name="medtrum_pump_setting">Ustawienia pompy Medtrum</string>
|
<string name="medtrum_pump_setting">Ustawienia pompy Medtrum</string>
|
||||||
<string name="pump_error">Błąd pompy: %1$s!! </string>
|
<string name="pump_error">Błąd pompy: %1$s!! </string>
|
||||||
|
<string name="pump_warning">Ostrzeżenie pompy: %1$s </string>
|
||||||
<string name="pump_is_suspended">Pompa jest wstrzymana</string>
|
<string name="pump_is_suspended">Pompa jest wstrzymana</string>
|
||||||
<string name="pump_is_suspended_hour_max">Pompa jest wstrzymana z powodu przekroczenia maksymalnej godzinowej dawki insuliny</string>
|
<string name="pump_is_suspended_hour_max">Pompa jest wstrzymana z powodu przekroczenia maksymalnej godzinowej dawki insuliny</string>
|
||||||
<string name="pump_is_suspended_day_max">Pompa jest wstrzymana z powodu przekroczenia maksymalnej dziennej dawki insuliny</string>
|
<string name="pump_is_suspended_day_max">Pompa jest wstrzymana z powodu przekroczenia maksymalnej dziennej dawki insuliny</string>
|
||||||
|
@ -106,6 +107,8 @@
|
||||||
<string name="pump_unsupported">Pompa nieprzetestowana: %1$d! Skontaktuj się z nami na Discordzie lub github, aby uzyskać wsparcie</string>
|
<string name="pump_unsupported">Pompa nieprzetestowana: %1$d! Skontaktuj się z nami na Discordzie lub github, aby uzyskać wsparcie</string>
|
||||||
<string name="alarm_setting_title">Ustawienia alarmu</string>
|
<string name="alarm_setting_title">Ustawienia alarmu</string>
|
||||||
<string name="alarm_setting_summary">Wybierz preferowaną konfigurację alarmu pompy.</string>
|
<string name="alarm_setting_summary">Wybierz preferowaną konfigurację alarmu pompy.</string>
|
||||||
|
<string name="pump_warning_notification_title">Powiadomienie o ostrzeżeniu pompy</string>
|
||||||
|
<string name="pump_warning_notification_summary">Pokaż powiadomienia o niekrytycznych ostrzeżeniach pompy takich jak: niski poziom baterii, niski poziom zbiornika (20 jednostek) i wkrótce wygasa. Zalecane zostawianie włączonych powiadomień, gdy alarmy pompy są wyciszone.</string>
|
||||||
<string name="patch_expiration_title">Wygaśnięcie Patcha</string>
|
<string name="patch_expiration_title">Wygaśnięcie Patcha</string>
|
||||||
<string name="patch_expiration_summary">Po uruchomieniu Patch wygaśnie po 3 dniach, z dodatkowym 8 godzinowym okresem karencji.</string>
|
<string name="patch_expiration_summary">Po uruchomieniu Patch wygaśnie po 3 dniach, z dodatkowym 8 godzinowym okresem karencji.</string>
|
||||||
<string name="hourly_max_insulin_title">Maksymalna Insulina w godzinę</string>
|
<string name="hourly_max_insulin_title">Maksymalna Insulina w godzinę</string>
|
||||||
|
|
|
@ -6,6 +6,7 @@
|
||||||
<string name="medtrum_pump_description">Integrarea pompei pentru Medtrum Nano și Medtrum 300U</string>
|
<string name="medtrum_pump_description">Integrarea pompei pentru Medtrum Nano și Medtrum 300U</string>
|
||||||
<string name="medtrum_pump_setting">Setări pompă Medtrum</string>
|
<string name="medtrum_pump_setting">Setări pompă Medtrum</string>
|
||||||
<string name="pump_error">Eroare pompă: %1$s!! </string>
|
<string name="pump_error">Eroare pompă: %1$s!! </string>
|
||||||
|
<string name="pump_warning">Avertizare pompă: %1$s </string>
|
||||||
<string name="pump_is_suspended">Pompă suspendată</string>
|
<string name="pump_is_suspended">Pompă suspendată</string>
|
||||||
<string name="pump_is_suspended_hour_max">Pompă suspendată din cauza depăşirii valorii maxime a insulinei pe oră</string>
|
<string name="pump_is_suspended_hour_max">Pompă suspendată din cauza depăşirii valorii maxime a insulinei pe oră</string>
|
||||||
<string name="pump_is_suspended_day_max">Pompă suspendată din cauza depăşirii valorii maxime zilnice a insulinei</string>
|
<string name="pump_is_suspended_day_max">Pompă suspendată din cauza depăşirii valorii maxime zilnice a insulinei</string>
|
||||||
|
@ -106,6 +107,8 @@
|
||||||
<string name="pump_unsupported">Pompă netestată: %1$d! Te rugăm să ne contactezi pe discord sau github pentru suport.</string>
|
<string name="pump_unsupported">Pompă netestată: %1$d! Te rugăm să ne contactezi pe discord sau github pentru suport.</string>
|
||||||
<string name="alarm_setting_title">Setări alarmă</string>
|
<string name="alarm_setting_title">Setări alarmă</string>
|
||||||
<string name="alarm_setting_summary">Selectează setările preferate pentru alarma pompei.</string>
|
<string name="alarm_setting_summary">Selectează setările preferate pentru alarma pompei.</string>
|
||||||
|
<string name="pump_warning_notification_title">Notificare la avertizarea pompei</string>
|
||||||
|
<string name="pump_warning_notification_summary">Arată notificare cu privire la avertismentele non-critice ale pompei: baterie scăzută, rezervor redus (20 de unități) și expiră în curând. Se recomandă să lăsaţi activat când alarmele pompei sunt setate la silențios.</string>
|
||||||
<string name="patch_expiration_title">Patch Expirare</string>
|
<string name="patch_expiration_title">Patch Expirare</string>
|
||||||
<string name="patch_expiration_summary">Când este activat, patchul va expira după 3 zile, cu o perioadă de graţie de 8 ore după expirare.</string>
|
<string name="patch_expiration_summary">Când este activat, patchul va expira după 3 zile, cu o perioadă de graţie de 8 ore după expirare.</string>
|
||||||
<string name="hourly_max_insulin_title">Insulină maximă pe oră</string>
|
<string name="hourly_max_insulin_title">Insulină maximă pe oră</string>
|
||||||
|
|
|
@ -39,6 +39,8 @@
|
||||||
<string name="alarm_low_bg_suspended">Приостановка на низкой ГК</string>
|
<string name="alarm_low_bg_suspended">Приостановка на низкой ГК</string>
|
||||||
<string name="alarm_low_bg_suspended2">Приостановка на низкой ГК 2</string>
|
<string name="alarm_low_bg_suspended2">Приостановка на низкой ГК 2</string>
|
||||||
<string name="alarm_auto_suspended">Автоматическая приостановка</string>
|
<string name="alarm_auto_suspended">Автоматическая приостановка</string>
|
||||||
|
<string name="alarm_hourly_max_suspended">почасовой максимальный приостановлен</string>
|
||||||
|
<string name="alarm_daily_max_suspended">суточный максимальный приостановлен</string>
|
||||||
<string name="alarm_suspended">Приостановлено</string>
|
<string name="alarm_suspended">Приостановлено</string>
|
||||||
<string name="alarm_paused">На паузе</string>
|
<string name="alarm_paused">На паузе</string>
|
||||||
<string name="alarm_occlusion">Окклюзия</string>
|
<string name="alarm_occlusion">Окклюзия</string>
|
||||||
|
@ -68,6 +70,7 @@
|
||||||
<string name="step_retry_activation">Выполняется активация</string>
|
<string name="step_retry_activation">Выполняется активация</string>
|
||||||
<string name="unexpected_state">Непредвиденное состояние: %1$s</string>
|
<string name="unexpected_state">Непредвиденное состояние: %1$s</string>
|
||||||
<string name="no_profile_selected">Профиль не выбран. Выберите профиль и повторите попытку.</string>
|
<string name="no_profile_selected">Профиль не выбран. Выберите профиль и повторите попытку.</string>
|
||||||
|
<string name="no_sn_in_settings">Серийный номер не известен. Введите серийный номер помпы в настройках и повторите попытку.</string>
|
||||||
<string name="base_serial">Серийный номер основания: %1$X</string>
|
<string name="base_serial">Серийный номер основания: %1$X</string>
|
||||||
<string name="patch_begin_activation">Активный патч отсутствует. Нажмите <b>Далее</b> для начала процесса активации.</string>
|
<string name="patch_begin_activation">Активный патч отсутствует. Нажмите <b>Далее</b> для начала процесса активации.</string>
|
||||||
<string name="patch_not_active_note">Не соединяйте основание и патч до следующего шага!</string>
|
<string name="patch_not_active_note">Не соединяйте основание и патч до следующего шага!</string>
|
||||||
|
|
|
@ -70,6 +70,7 @@
|
||||||
<string name="step_retry_activation">Aktivácia prebieha</string>
|
<string name="step_retry_activation">Aktivácia prebieha</string>
|
||||||
<string name="unexpected_state">Neočakávaný stav: %1$s</string>
|
<string name="unexpected_state">Neočakávaný stav: %1$s</string>
|
||||||
<string name="no_profile_selected">Žiadny vybraný profil. Prosím vyberte si profil a skúste to znovu.</string>
|
<string name="no_profile_selected">Žiadny vybraný profil. Prosím vyberte si profil a skúste to znovu.</string>
|
||||||
|
<string name="no_sn_in_settings">Nie je zadané žiadne sériové číslo. Zadajte sériové číslo pumpy v nastaveniach a skúste to znova.</string>
|
||||||
<string name="base_serial">Sériové číslo základne pumpy: %1$X</string>
|
<string name="base_serial">Sériové číslo základne pumpy: %1$X</string>
|
||||||
<string name="patch_begin_activation">Žiadny aktívny Patch. Stlačte <b>Ďalšia</b> pre zahájenie aktivačného procesu.</string>
|
<string name="patch_begin_activation">Žiadny aktívny Patch. Stlačte <b>Ďalšia</b> pre zahájenie aktivačného procesu.</string>
|
||||||
<string name="patch_not_active_note">Základňa by nemala byť pripojená ku kanyle až do dalšieho kroku!</string>
|
<string name="patch_not_active_note">Základňa by nemala byť pripojená ku kanyle až do dalšieho kroku!</string>
|
||||||
|
|
|
@ -4,6 +4,7 @@
|
||||||
<string name="key_sn_input" translatable="false">sn_input</string>
|
<string name="key_sn_input" translatable="false">sn_input</string>
|
||||||
<string name="key_alarm_setting" translatable="false">alarm_setting</string>
|
<string name="key_alarm_setting" translatable="false">alarm_setting</string>
|
||||||
<string name="key_patch_expiration" translatable="false">patch_expiration</string>
|
<string name="key_patch_expiration" translatable="false">patch_expiration</string>
|
||||||
|
<string name="key_pump_warning_notification" translatable="false">pump_warning_notification</string>
|
||||||
<string name="key_hourly_max_insulin" translatable="false">hourly_max_insulin</string>
|
<string name="key_hourly_max_insulin" translatable="false">hourly_max_insulin</string>
|
||||||
<string name="key_daily_max_insulin" translatable="false">daily_max_insulin</string>
|
<string name="key_daily_max_insulin" translatable="false">daily_max_insulin</string>
|
||||||
|
|
||||||
|
@ -30,6 +31,7 @@
|
||||||
<string name="medtrum_pump_description">Pump integration for Medtrum Nano and Medtrum 300U</string>
|
<string name="medtrum_pump_description">Pump integration for Medtrum Nano and Medtrum 300U</string>
|
||||||
<string name="medtrum_pump_setting">Medtrum pump settings</string>
|
<string name="medtrum_pump_setting">Medtrum pump settings</string>
|
||||||
<string name="pump_error">Pump error: %1$s !! </string>
|
<string name="pump_error">Pump error: %1$s !! </string>
|
||||||
|
<string name="pump_warning">Pump warning: %1$s </string>
|
||||||
<string name="pump_is_suspended">Pump is suspended</string>
|
<string name="pump_is_suspended">Pump is suspended</string>
|
||||||
<string name="pump_is_suspended_hour_max">Pump is suspended due to hourly max insulin exceeded</string>
|
<string name="pump_is_suspended_hour_max">Pump is suspended due to hourly max insulin exceeded</string>
|
||||||
<string name="pump_is_suspended_day_max">Pump is suspended due to daily max insulin exceeded</string>
|
<string name="pump_is_suspended_day_max">Pump is suspended due to daily max insulin exceeded</string>
|
||||||
|
@ -138,6 +140,8 @@
|
||||||
<string name="pump_unsupported">Pump untested: %1$d! Please contact us at discord or github for support</string>
|
<string name="pump_unsupported">Pump untested: %1$d! Please contact us at discord or github for support</string>
|
||||||
<string name="alarm_setting_title">Alarm Settings</string>
|
<string name="alarm_setting_title">Alarm Settings</string>
|
||||||
<string name="alarm_setting_summary">Select your preferred pump alarm settings.</string>
|
<string name="alarm_setting_summary">Select your preferred pump alarm settings.</string>
|
||||||
|
<string name="pump_warning_notification_title">Notification on pump warning</string>
|
||||||
|
<string name="pump_warning_notification_summary">Show notification on non critical pump warnings: low battery, low reservoir (20 units) and expires soon. Recommended to leave enabled when pump alarms are set to silent.</string>
|
||||||
<string name="patch_expiration_title">Patch Expiration</string>
|
<string name="patch_expiration_title">Patch Expiration</string>
|
||||||
<string name="patch_expiration_summary">When enabled, the patch will expire after 3 days, with a grace period of 8 hours after that.</string>
|
<string name="patch_expiration_summary">When enabled, the patch will expire after 3 days, with a grace period of 8 hours after that.</string>
|
||||||
<string name="hourly_max_insulin_title">Hourly Maximum Insulin</string>
|
<string name="hourly_max_insulin_title">Hourly Maximum Insulin</string>
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
android:title="@string/sn_input_title" />
|
android:title="@string/sn_input_title" />
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:defaultValue="false"
|
android:defaultValue="true"
|
||||||
android:key="@string/key_patch_expiration"
|
android:key="@string/key_patch_expiration"
|
||||||
android:title="@string/patch_expiration_title"
|
android:title="@string/patch_expiration_title"
|
||||||
android:summary="@string/patch_expiration_summary" />
|
android:summary="@string/patch_expiration_summary" />
|
||||||
|
@ -27,6 +27,12 @@
|
||||||
android:entries="@array/alarmSettings"
|
android:entries="@array/alarmSettings"
|
||||||
android:entryValues="@array/alarmSettingsValues" />
|
android:entryValues="@array/alarmSettingsValues" />
|
||||||
|
|
||||||
|
<SwitchPreference
|
||||||
|
android:defaultValue="true"
|
||||||
|
android:key="@string/key_pump_warning_notification"
|
||||||
|
android:title="@string/pump_warning_notification_title"
|
||||||
|
android:summary="@string/pump_warning_notification_summary" />
|
||||||
|
|
||||||
<app.aaps.core.validators.ValidatingEditTextPreference
|
<app.aaps.core.validators.ValidatingEditTextPreference
|
||||||
android:defaultValue="25"
|
android:defaultValue="25"
|
||||||
android:inputType="number"
|
android:inputType="number"
|
||||||
|
|
|
@ -7,10 +7,10 @@ import app.aaps.core.interfaces.pump.PumpSync
|
||||||
import app.aaps.core.interfaces.pump.defs.PumpType
|
import app.aaps.core.interfaces.pump.defs.PumpType
|
||||||
import app.aaps.core.interfaces.rx.events.EventOverviewBolusProgress
|
import app.aaps.core.interfaces.rx.events.EventOverviewBolusProgress
|
||||||
import app.aaps.core.interfaces.utils.T
|
import app.aaps.core.interfaces.utils.T
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import info.nightscout.pump.medtrum.comm.enums.BasalType
|
import info.nightscout.pump.medtrum.comm.enums.BasalType
|
||||||
import info.nightscout.pump.medtrum.util.MedtrumSnUtil
|
import info.nightscout.pump.medtrum.util.MedtrumSnUtil
|
||||||
import org.json.JSONObject
|
import org.json.JSONObject
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito
|
||||||
import org.mockito.Mockito.mock
|
import org.mockito.Mockito.mock
|
||||||
|
@ -43,7 +43,7 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
val expectedByteArray = byteArrayOf(7, 0, -96, 2, -16, 96, 2, 104, 33, 2, -32, -31, 1, -64, 3, 2, -20, 36, 2, 100, -123, 2)
|
val expectedByteArray = byteArrayOf(7, 0, -96, 2, -16, 96, 2, 104, 33, 2, -32, -31, 1, -64, 3, 2, -20, 36, 2, 100, -123, 2)
|
||||||
Assertions.assertEquals(expectedByteArray.contentToString(), result?.contentToString())
|
assertThat(result!!.contentToString()).isEqualTo(expectedByteArray.contentToString())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun buildMedtrumProfileArrayGiveProfileWhenValuesTooHighThenReturnNull() {
|
@Test fun buildMedtrumProfileArrayGiveProfileWhenValuesTooHighThenReturnNull() {
|
||||||
|
@ -60,7 +60,7 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
val result = medtrumPump.buildMedtrumProfileArray(profile)
|
val result = medtrumPump.buildMedtrumProfileArray(profile)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertNull(result)
|
assertThat(result).isNull()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun getCurrentHourlyBasalFromMedtrumProfileArrayGivenProfileWhenValuesSetThenReturnCorrectValue() {
|
@Test fun getCurrentHourlyBasalFromMedtrumProfileArrayGivenProfileWhenValuesSetThenReturnCorrectValue() {
|
||||||
|
@ -88,28 +88,28 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
val zonedDateTime0399 = localDate.atTime(localTime0399).atZone(ZoneId.systemDefault())
|
val zonedDateTime0399 = localDate.atTime(localTime0399).atZone(ZoneId.systemDefault())
|
||||||
val time0399 = zonedDateTime0399.toInstant().toEpochMilli()
|
val time0399 = zonedDateTime0399.toInstant().toEpochMilli()
|
||||||
val result = medtrumPump.getHourlyBasalFromMedtrumProfileArray(profileArray!!, time0399)
|
val result = medtrumPump.getHourlyBasalFromMedtrumProfileArray(profileArray!!, time0399)
|
||||||
Assertions.assertEquals(2.1, result, 0.01)
|
assertThat(result).isWithin(0.01).of(2.1)
|
||||||
|
|
||||||
// For 22:30
|
// For 22:30
|
||||||
val localTime2230 = LocalTime.of(22, 30)
|
val localTime2230 = LocalTime.of(22, 30)
|
||||||
val zonedDateTime2230 = localDate.atTime(localTime2230).atZone(ZoneId.systemDefault())
|
val zonedDateTime2230 = localDate.atTime(localTime2230).atZone(ZoneId.systemDefault())
|
||||||
val time2230 = zonedDateTime2230.toInstant().toEpochMilli()
|
val time2230 = zonedDateTime2230.toInstant().toEpochMilli()
|
||||||
val result1 = medtrumPump.getHourlyBasalFromMedtrumProfileArray(profileArray, time2230)
|
val result1 = medtrumPump.getHourlyBasalFromMedtrumProfileArray(profileArray, time2230)
|
||||||
Assertions.assertEquals(1.7, result1, 0.01)
|
assertThat(result1).isWithin(0.01).of(1.7)
|
||||||
|
|
||||||
// For 23:59
|
// For 23:59
|
||||||
val localTime2359 = LocalTime.of(23, 59)
|
val localTime2359 = LocalTime.of(23, 59)
|
||||||
val zonedDateTime2359 = localDate.atTime(localTime2359).atZone(ZoneId.systemDefault())
|
val zonedDateTime2359 = localDate.atTime(localTime2359).atZone(ZoneId.systemDefault())
|
||||||
val time2359 = zonedDateTime2359.toInstant().toEpochMilli()
|
val time2359 = zonedDateTime2359.toInstant().toEpochMilli()
|
||||||
val result2 = medtrumPump.getHourlyBasalFromMedtrumProfileArray(profileArray, time2359)
|
val result2 = medtrumPump.getHourlyBasalFromMedtrumProfileArray(profileArray, time2359)
|
||||||
Assertions.assertEquals(2.0, result2, 0.01)
|
assertThat(result2).isWithin(0.01).of(2.0)
|
||||||
|
|
||||||
// For 00:00
|
// For 00:00
|
||||||
val localTime0000 = LocalTime.of(0, 0)
|
val localTime0000 = LocalTime.of(0, 0)
|
||||||
val zonedDateTime0000 = localDate.atTime(localTime0000).atZone(ZoneId.systemDefault())
|
val zonedDateTime0000 = localDate.atTime(localTime0000).atZone(ZoneId.systemDefault())
|
||||||
val time0000 = zonedDateTime0000.toInstant().toEpochMilli()
|
val time0000 = zonedDateTime0000.toInstant().toEpochMilli()
|
||||||
val result3 = medtrumPump.getHourlyBasalFromMedtrumProfileArray(profileArray, time0000)
|
val result3 = medtrumPump.getHourlyBasalFromMedtrumProfileArray(profileArray, time0000)
|
||||||
Assertions.assertEquals(2.1, result3, 0.01)
|
assertThat(result3).isWithin(0.01).of(2.1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleBolusStatusUpdateWhenCalledExpectNewData() {
|
@Test fun handleBolusStatusUpdateWhenCalledExpectNewData() {
|
||||||
|
@ -124,9 +124,9 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
medtrumPump.handleBolusStatusUpdate(bolusType, bolusCompleted, amount)
|
medtrumPump.handleBolusStatusUpdate(bolusType, bolusCompleted, amount)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(bolusCompleted, medtrumPump.bolusDone)
|
assertThat(medtrumPump.bolusDone).isEqualTo(bolusCompleted)
|
||||||
Assertions.assertEquals(amount, medtrumPump.bolusAmountDeliveredFlow.value, 0.01)
|
assertThat(medtrumPump.bolusAmountDeliveredFlow.value).isWithin(0.01).of(amount)
|
||||||
Assertions.assertEquals(amount, medtrumPump.bolusingTreatment!!.insulin, 0.01)
|
assertThat(medtrumPump.bolusingTreatment!!.insulin).isWithin(0.01).of(amount)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleBasalStatusUpdateWhenBasalTypeIsAbsoluteTempAndTemporaryBasalInfoThenExpectNewData() {
|
@Test fun handleBasalStatusUpdateWhenBasalTypeIsAbsoluteTempAndTemporaryBasalInfoThenExpectNewData() {
|
||||||
|
@ -174,12 +174,12 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(basalType, medtrumPump.lastBasalType)
|
assertThat(medtrumPump.lastBasalType).isEqualTo(basalType)
|
||||||
Assertions.assertEquals(basalRate, medtrumPump.lastBasalRate, 0.01)
|
assertThat(medtrumPump.lastBasalRate).isWithin(0.01).of(basalRate)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.lastBasalSequence)
|
assertThat(medtrumPump.lastBasalSequence).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.currentSequenceNumber)
|
assertThat(medtrumPump.currentSequenceNumber).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalPatchId, medtrumPump.lastBasalPatchId)
|
assertThat(medtrumPump.lastBasalPatchId).isEqualTo(basalPatchId)
|
||||||
Assertions.assertEquals(basalStartTime, medtrumPump.lastBasalStartTime)
|
assertThat(medtrumPump.lastBasalStartTime).isEqualTo(basalStartTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleBasalStatusUpdateWhenBasalTypeIsAbsoluteTempAndSameExpectedTemporaryBasalInfoThenExpectNoPumpSync() {
|
@Test fun handleBasalStatusUpdateWhenBasalTypeIsAbsoluteTempAndSameExpectedTemporaryBasalInfoThenExpectNoPumpSync() {
|
||||||
|
@ -223,12 +223,12 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
)
|
)
|
||||||
|
|
||||||
// Check that other fields in medtrumPump are updated
|
// Check that other fields in medtrumPump are updated
|
||||||
Assertions.assertEquals(basalType, medtrumPump.lastBasalType)
|
assertThat(medtrumPump.lastBasalType).isEqualTo(basalType)
|
||||||
Assertions.assertEquals(basalRate, medtrumPump.lastBasalRate, 0.01)
|
assertThat(medtrumPump.lastBasalRate).isWithin(0.01).of(basalRate)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.lastBasalSequence)
|
assertThat(medtrumPump.lastBasalSequence).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.currentSequenceNumber)
|
assertThat(medtrumPump.currentSequenceNumber).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalPatchId, medtrumPump.lastBasalPatchId)
|
assertThat(medtrumPump.lastBasalPatchId).isEqualTo(basalPatchId)
|
||||||
Assertions.assertEquals(basalStartTime, medtrumPump.lastBasalStartTime)
|
assertThat(medtrumPump.lastBasalStartTime).isEqualTo(basalStartTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleBasalStatusUpdateWhenBasalTypeIsAbsoluteTempAndNoTemporaryBasalInfoThenExpectNewData() {
|
@Test fun handleBasalStatusUpdateWhenBasalTypeIsAbsoluteTempAndNoTemporaryBasalInfoThenExpectNewData() {
|
||||||
|
@ -274,12 +274,12 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(basalType, medtrumPump.lastBasalType)
|
assertThat(medtrumPump.lastBasalType).isEqualTo(basalType)
|
||||||
Assertions.assertEquals(basalRate, medtrumPump.lastBasalRate, 0.01)
|
assertThat(medtrumPump.lastBasalRate).isWithin(0.01).of(basalRate)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.lastBasalSequence)
|
assertThat(medtrumPump.lastBasalSequence).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.currentSequenceNumber)
|
assertThat(medtrumPump.currentSequenceNumber).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalPatchId, medtrumPump.lastBasalPatchId)
|
assertThat(medtrumPump.lastBasalPatchId).isEqualTo(basalPatchId)
|
||||||
Assertions.assertEquals(basalStartTime, medtrumPump.lastBasalStartTime)
|
assertThat(medtrumPump.lastBasalStartTime).isEqualTo(basalStartTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleBasalStatusUpdateWhenBasalTypeIsRelativeTempAndTemporaryBasalInfoThenExpectNewData() {
|
@Test fun handleBasalStatusUpdateWhenBasalTypeIsRelativeTempAndTemporaryBasalInfoThenExpectNewData() {
|
||||||
|
@ -329,12 +329,12 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(basalType, medtrumPump.lastBasalType)
|
assertThat(medtrumPump.lastBasalType).isEqualTo(basalType)
|
||||||
Assertions.assertEquals(basalRate, medtrumPump.lastBasalRate, 0.01)
|
assertThat(medtrumPump.lastBasalRate).isWithin(0.01).of(basalRate)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.lastBasalSequence)
|
assertThat(medtrumPump.lastBasalSequence).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.currentSequenceNumber)
|
assertThat(medtrumPump.currentSequenceNumber).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalPatchId, medtrumPump.lastBasalPatchId)
|
assertThat(medtrumPump.lastBasalPatchId).isEqualTo(basalPatchId)
|
||||||
Assertions.assertEquals(basalStartTime, medtrumPump.lastBasalStartTime)
|
assertThat(medtrumPump.lastBasalStartTime).isEqualTo(basalStartTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleBasalStatusUpdateWhenBasalTypeIsSuspendedThenExpectNewData() {
|
@Test fun handleBasalStatusUpdateWhenBasalTypeIsSuspendedThenExpectNewData() {
|
||||||
|
@ -378,12 +378,12 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(basalType, medtrumPump.lastBasalType)
|
assertThat(medtrumPump.lastBasalType).isEqualTo(basalType)
|
||||||
Assertions.assertEquals(basalRate, medtrumPump.lastBasalRate, 0.01)
|
assertThat(medtrumPump.lastBasalRate).isWithin(0.01).of(basalRate)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.lastBasalSequence)
|
assertThat(medtrumPump.lastBasalSequence).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.currentSequenceNumber)
|
assertThat(medtrumPump.currentSequenceNumber).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalPatchId, medtrumPump.lastBasalPatchId)
|
assertThat(medtrumPump.lastBasalPatchId).isEqualTo(basalPatchId)
|
||||||
Assertions.assertEquals(basalStartTime, medtrumPump.lastBasalStartTime)
|
assertThat(medtrumPump.lastBasalStartTime).isEqualTo(basalStartTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleBasalStatusUpdateWhenBasalTypeIsATypeIsSuspendedAndSameExpectedTemporaryBasalInfoThenExpectNoPumpSync() {
|
@Test fun handleBasalStatusUpdateWhenBasalTypeIsATypeIsSuspendedAndSameExpectedTemporaryBasalInfoThenExpectNoPumpSync() {
|
||||||
|
@ -424,12 +424,12 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
anyOrNull()
|
anyOrNull()
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(basalType, medtrumPump.lastBasalType)
|
assertThat(medtrumPump.lastBasalType).isEqualTo(basalType)
|
||||||
Assertions.assertEquals(basalRate, medtrumPump.lastBasalRate, 0.01)
|
assertThat(medtrumPump.lastBasalRate).isWithin(0.01).of(basalRate)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.lastBasalSequence)
|
assertThat(medtrumPump.lastBasalSequence).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.currentSequenceNumber)
|
assertThat(medtrumPump.currentSequenceNumber).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalPatchId, medtrumPump.lastBasalPatchId)
|
assertThat(medtrumPump.lastBasalPatchId).isEqualTo(basalPatchId)
|
||||||
Assertions.assertEquals(basalStartTime, medtrumPump.lastBasalStartTime)
|
assertThat(medtrumPump.lastBasalStartTime).isEqualTo(basalStartTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleBasalStatusUpdateWhenBasalTypeIsSuspendedAndNewerFakeTBRThenExpectInvalidateAndNewData() {
|
@Test fun handleBasalStatusUpdateWhenBasalTypeIsSuspendedAndNewerFakeTBRThenExpectInvalidateAndNewData() {
|
||||||
|
@ -475,12 +475,12 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(basalType, medtrumPump.lastBasalType)
|
assertThat(medtrumPump.lastBasalType).isEqualTo(basalType)
|
||||||
Assertions.assertEquals(basalRate, medtrumPump.lastBasalRate, 0.01)
|
assertThat(medtrumPump.lastBasalRate).isWithin(0.01).of(basalRate)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.lastBasalSequence)
|
assertThat(medtrumPump.lastBasalSequence).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.currentSequenceNumber)
|
assertThat(medtrumPump.currentSequenceNumber).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalPatchId, medtrumPump.lastBasalPatchId)
|
assertThat(medtrumPump.lastBasalPatchId).isEqualTo(basalPatchId)
|
||||||
Assertions.assertEquals(basalStartTime, medtrumPump.lastBasalStartTime)
|
assertThat(medtrumPump.lastBasalStartTime).isEqualTo(basalStartTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleBasalStatusUpdateWhenBasalTypeIsNoneAndThenExpectFakeTBR() {
|
@Test fun handleBasalStatusUpdateWhenBasalTypeIsNoneAndThenExpectFakeTBR() {
|
||||||
|
@ -520,12 +520,12 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(basalType, medtrumPump.lastBasalType)
|
assertThat(medtrumPump.lastBasalType).isEqualTo(basalType)
|
||||||
Assertions.assertEquals(basalRate, medtrumPump.lastBasalRate, 0.01)
|
assertThat(medtrumPump.lastBasalRate).isWithin(0.01).of(basalRate)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.lastBasalSequence)
|
assertThat(medtrumPump.lastBasalSequence).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.currentSequenceNumber)
|
assertThat(medtrumPump.currentSequenceNumber).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalPatchId, medtrumPump.lastBasalPatchId)
|
assertThat(medtrumPump.lastBasalPatchId).isEqualTo(basalPatchId)
|
||||||
Assertions.assertEquals(basalStartTime, medtrumPump.lastBasalStartTime)
|
assertThat(medtrumPump.lastBasalStartTime).isEqualTo(basalStartTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleBasalStatusUpdateWhenBasalTypeIsStandardAndTempBasalExpectedThenExpectSyncStop() {
|
@Test fun handleBasalStatusUpdateWhenBasalTypeIsStandardAndTempBasalExpectedThenExpectSyncStop() {
|
||||||
|
@ -564,12 +564,12 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(basalType, medtrumPump.lastBasalType)
|
assertThat(medtrumPump.lastBasalType).isEqualTo(basalType)
|
||||||
Assertions.assertEquals(basalRate, medtrumPump.lastBasalRate, 0.01)
|
assertThat(medtrumPump.lastBasalRate).isWithin(0.01).of(basalRate)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.lastBasalSequence)
|
assertThat(medtrumPump.lastBasalSequence).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.currentSequenceNumber)
|
assertThat(medtrumPump.currentSequenceNumber).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalPatchId, medtrumPump.lastBasalPatchId)
|
assertThat(medtrumPump.lastBasalPatchId).isEqualTo(basalPatchId)
|
||||||
Assertions.assertEquals(basalStartTime, medtrumPump.lastBasalStartTime)
|
assertThat(medtrumPump.lastBasalStartTime).isEqualTo(basalStartTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleBasalStatusUpdateWhenBasalTypeIsStandardAndNoTempBasalExpectedThenExpectNoSyncStop() {
|
@Test fun handleBasalStatusUpdateWhenBasalTypeIsStandardAndNoTempBasalExpectedThenExpectNoSyncStop() {
|
||||||
|
@ -605,12 +605,12 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
anyOrNull()
|
anyOrNull()
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(basalType, medtrumPump.lastBasalType)
|
assertThat(medtrumPump.lastBasalType).isEqualTo(basalType)
|
||||||
Assertions.assertEquals(basalRate, medtrumPump.lastBasalRate, 0.01)
|
assertThat(medtrumPump.lastBasalRate).isWithin(0.01).of(basalRate)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.lastBasalSequence)
|
assertThat(medtrumPump.lastBasalSequence).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalSequence, medtrumPump.currentSequenceNumber)
|
assertThat(medtrumPump.currentSequenceNumber).isEqualTo(basalSequence)
|
||||||
Assertions.assertEquals(basalPatchId, medtrumPump.lastBasalPatchId)
|
assertThat(medtrumPump.lastBasalPatchId).isEqualTo(basalPatchId)
|
||||||
Assertions.assertEquals(basalStartTime, medtrumPump.lastBasalStartTime)
|
assertThat(medtrumPump.lastBasalStartTime).isEqualTo(basalStartTime)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleNewPatchCalledWhenCalledExpectNewDataPresent() {
|
@Test fun handleNewPatchCalledWhenCalledExpectNewDataPresent() {
|
||||||
|
@ -626,10 +626,10 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
medtrumPump.handleNewPatch(newPatchId, newSequenceNumber, newStartTime)
|
medtrumPump.handleNewPatch(newPatchId, newSequenceNumber, newStartTime)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(newPatchId, medtrumPump.patchId)
|
assertThat(medtrumPump.patchId).isEqualTo(newPatchId)
|
||||||
Assertions.assertEquals(newSequenceNumber, medtrumPump.currentSequenceNumber)
|
assertThat(medtrumPump.currentSequenceNumber).isEqualTo(newSequenceNumber)
|
||||||
Assertions.assertEquals(newStartTime, medtrumPump.patchStartTime)
|
assertThat(medtrumPump.patchStartTime).isEqualTo(newStartTime)
|
||||||
Assertions.assertEquals(1, medtrumPump.syncedSequenceNumber)
|
assertThat(medtrumPump.syncedSequenceNumber).isEqualTo(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleStopStatusUpdateWhenSequenceThenExpectUpdate() {
|
@Test fun handleStopStatusUpdateWhenSequenceThenExpectUpdate() {
|
||||||
|
@ -644,8 +644,8 @@ class MedtrumPumpTest : MedtrumTestBase() {
|
||||||
medtrumPump.handleStopStatusUpdate(sequence, patchId)
|
medtrumPump.handleStopStatusUpdate(sequence, patchId)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(patchId, medtrumPump.lastStopPatchId)
|
assertThat(medtrumPump.lastStopPatchId).isEqualTo(patchId)
|
||||||
Assertions.assertEquals(sequence, medtrumPump.currentSequenceNumber)
|
assertThat(medtrumPump.currentSequenceNumber).isEqualTo(sequence)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun setFakeTBRIfNotSetWhenNoFakeTBRAlreadyRunningExpectPumpSync() {
|
@Test fun setFakeTBRIfNotSetWhenNoFakeTBRAlreadyRunningExpectPumpSync() {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
package info.nightscout.pump.medtrum.comm
|
package info.nightscout.pump.medtrum.comm
|
||||||
|
|
||||||
import org.junit.jupiter.api.Assertions
|
import com.google.common.truth.Truth.assertThat
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class WriteCommandPacketsTest {
|
class WriteCommandPacketsTest {
|
||||||
|
@ -8,20 +8,20 @@ class WriteCommandPacketsTest {
|
||||||
@Test
|
@Test
|
||||||
fun given14LongCommandExpectOnePacket() {
|
fun given14LongCommandExpectOnePacket() {
|
||||||
val input = byteArrayOf(5, 2, 0, 0, 0, 0, -21, 57, -122, -56)
|
val input = byteArrayOf(5, 2, 0, 0, 0, 0, -21, 57, -122, -56)
|
||||||
val expect = byteArrayOf(14, 5, 0, 0, 2, 0, 0, 0, 0, -21, 57, -122, -56, -93, 0)
|
val expected = byteArrayOf(14, 5, 0, 0, 2, 0, 0, 0, 0, -21, 57, -122, -56, -93, 0)
|
||||||
val sequence = 0
|
val sequence = 0
|
||||||
val cmdPackets = WriteCommandPackets(input, sequence)
|
val cmdPackets = WriteCommandPackets(input, sequence)
|
||||||
val output = cmdPackets.getNextPacket()
|
val output = cmdPackets.getNextPacket()
|
||||||
|
|
||||||
Assertions.assertEquals(expect.contentToString(), output.contentToString())
|
assertThat(output.contentToString()).isEqualTo(expected.contentToString())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun given41LongCommandExpectThreePackets() {
|
fun given41LongCommandExpectThreePackets() {
|
||||||
val input = byteArrayOf(18, 0, 12, 0, 3, 0, 1, 30, 32, 3, 16, 14, 0, 0, 1, 7, 0, -96, 2, -16, 96, 2, 104, 33, 2, -32, -31, 1, -64, 3, 2, -20, 36, 2, 100, -123, 2)
|
val input = byteArrayOf(18, 0, 12, 0, 3, 0, 1, 30, 32, 3, 16, 14, 0, 0, 1, 7, 0, -96, 2, -16, 96, 2, 104, 33, 2, -32, -31, 1, -64, 3, 2, -20, 36, 2, 100, -123, 2)
|
||||||
val expect1 = byteArrayOf(41, 18, 0, 1, 0, 12, 0, 3, 0, 1, 30, 32, 3, 16, 14, 0, 0, 1, 7, -121)
|
val expected1 = byteArrayOf(41, 18, 0, 1, 0, 12, 0, 3, 0, 1, 30, 32, 3, 16, 14, 0, 0, 1, 7, -121)
|
||||||
val expect2 = byteArrayOf(41, 18, 0, 2, 0, -96, 2, -16, 96, 2, 104, 33, 2, -32, -31, 1, -64, 3, 2, -3)
|
val expected2 = byteArrayOf(41, 18, 0, 2, 0, -96, 2, -16, 96, 2, 104, 33, 2, -32, -31, 1, -64, 3, 2, -3)
|
||||||
val expect3 = byteArrayOf(41, 18, 0, 3, -20, 36, 2, 100, -123, 2, -125, -89)
|
val expected3 = byteArrayOf(41, 18, 0, 3, -20, 36, 2, 100, -123, 2, -125, -89)
|
||||||
|
|
||||||
val sequence = 0
|
val sequence = 0
|
||||||
val cmdPackets = WriteCommandPackets(input, sequence)
|
val cmdPackets = WriteCommandPackets(input, sequence)
|
||||||
|
@ -31,10 +31,10 @@ class WriteCommandPacketsTest {
|
||||||
val output4 = cmdPackets.getNextPacket()
|
val output4 = cmdPackets.getNextPacket()
|
||||||
|
|
||||||
|
|
||||||
Assertions.assertEquals(expect1.contentToString(), output1.contentToString())
|
assertThat(output1.contentToString()).isEqualTo(expected1.contentToString())
|
||||||
Assertions.assertEquals(expect2.contentToString(), output2.contentToString())
|
assertThat(output2.contentToString()).isEqualTo(expected2.contentToString())
|
||||||
Assertions.assertEquals(expect3.contentToString(), output3.contentToString())
|
assertThat(output3.contentToString()).isEqualTo(expected3.contentToString())
|
||||||
Assertions.assertNull(output4)
|
assertThat(output4).isNull()
|
||||||
Assertions.assertEquals(true, cmdPackets.allPacketsConsumed())
|
assertThat(cmdPackets.allPacketsConsumed()).isTrue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,10 +2,10 @@ package info.nightscout.pump.medtrum.comm.packets
|
||||||
|
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import info.nightscout.pump.medtrum.MedtrumTestBase
|
import info.nightscout.pump.medtrum.MedtrumTestBase
|
||||||
import info.nightscout.pump.medtrum.comm.enums.AlarmSetting
|
import info.nightscout.pump.medtrum.comm.enums.AlarmSetting
|
||||||
import info.nightscout.pump.medtrum.comm.enums.BasalType
|
import info.nightscout.pump.medtrum.comm.enums.BasalType
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class ActivatePacketTest : MedtrumTestBase() {
|
class ActivatePacketTest : MedtrumTestBase() {
|
||||||
|
@ -38,7 +38,7 @@ class ActivatePacketTest : MedtrumTestBase() {
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
val expectedByteArray = byteArrayOf(18, 0, 12, 1, 6, 0, 0, 30, 32, 3, 16, 14, 0, 0, 1, 3, 16, 14, 0, 0, 1, 2, 12, 12, 12)
|
val expectedByteArray = byteArrayOf(18, 0, 12, 1, 6, 0, 0, 30, 32, 3, 16, 14, 0, 0, 1, 3, 16, 14, 0, 0, 1, 2, 12, 12, 12)
|
||||||
Assertions.assertEquals(expectedByteArray.contentToString(), result.contentToString())
|
assertThat(result.contentToString()).isEqualTo(expectedByteArray.contentToString())
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenPacketWhenValuesSetThenReturnCorrectValues() {
|
@Test fun handleResponseGivenPacketWhenValuesSetThenReturnCorrectValues() {
|
||||||
|
@ -64,15 +64,15 @@ class ActivatePacketTest : MedtrumTestBase() {
|
||||||
val expectedBasalPatchId = 41L
|
val expectedBasalPatchId = 41L
|
||||||
val expectedBasalStart = 1675605528000L
|
val expectedBasalStart = 1675605528000L
|
||||||
|
|
||||||
Assertions.assertEquals(true, result)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertEquals(expectedPatchId, medtrumPump.patchId)
|
assertThat(medtrumPump.patchId).isEqualTo(expectedPatchId)
|
||||||
Assertions.assertEquals(expectedTime, medtrumPump.lastTimeReceivedFromPump)
|
assertThat(medtrumPump.lastTimeReceivedFromPump).isEqualTo(expectedTime)
|
||||||
Assertions.assertEquals(expectedBasalType, medtrumPump.lastBasalType)
|
assertThat(medtrumPump.lastBasalType).isEqualTo(expectedBasalType)
|
||||||
Assertions.assertEquals(expectedBasalRate, medtrumPump.lastBasalRate, 0.01)
|
assertThat(medtrumPump.lastBasalRate).isWithin(0.01).of(expectedBasalRate)
|
||||||
Assertions.assertEquals(expectedBasalSequence, medtrumPump.lastBasalSequence)
|
assertThat(medtrumPump.lastBasalSequence).isEqualTo(expectedBasalSequence)
|
||||||
Assertions.assertEquals(expectedBasalPatchId, medtrumPump.lastBasalPatchId)
|
assertThat(medtrumPump.lastBasalPatchId).isEqualTo(expectedBasalPatchId)
|
||||||
Assertions.assertEquals(expectedBasalStart, medtrumPump.lastBasalStartTime)
|
assertThat(medtrumPump.lastBasalStartTime).isEqualTo(expectedBasalStart)
|
||||||
Assertions.assertEquals(basalProfile, medtrumPump.actualBasalProfile)
|
assertThat(medtrumPump.actualBasalProfile).isEqualTo(basalProfile)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenResponseWhenMessageTooShortThenResultFalse() {
|
@Test fun handleResponseGivenResponseWhenMessageTooShortThenResultFalse() {
|
||||||
|
@ -84,6 +84,6 @@ class ActivatePacketTest : MedtrumTestBase() {
|
||||||
val result = packet.handleResponse(response)
|
val result = packet.handleResponse(response)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertFalse(result)
|
assertThat(result).isFalse()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package info.nightscout.pump.medtrum.comm.packets
|
package info.nightscout.pump.medtrum.comm.packets
|
||||||
|
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.pump.medtrum.MedtrumPump
|
import info.nightscout.pump.medtrum.MedtrumPump
|
||||||
import info.nightscout.pump.medtrum.MedtrumTestBase
|
import info.nightscout.pump.medtrum.MedtrumTestBase
|
||||||
import info.nightscout.pump.medtrum.extension.toByteArray
|
import info.nightscout.pump.medtrum.extension.toByteArray
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class AuthorizePacketTest : MedtrumTestBase() {
|
class AuthorizePacketTest : MedtrumTestBase() {
|
||||||
|
@ -37,8 +37,7 @@ class AuthorizePacketTest : MedtrumTestBase() {
|
||||||
val key = 3364239851
|
val key = 3364239851
|
||||||
val type = 2
|
val type = 2
|
||||||
val expectedByteArray = byteArrayOf(opCode.toByte()) + type.toByte() + medtrumPump.patchSessionToken.toByteArray(4) + key.toByteArray(4)
|
val expectedByteArray = byteArrayOf(opCode.toByte()) + type.toByte() + medtrumPump.patchSessionToken.toByteArray(4) + key.toByteArray(4)
|
||||||
Assertions.assertEquals(10, result.size)
|
assertThat(result).asList().containsExactlyElementsIn(expectedByteArray.toList()).inOrder()
|
||||||
Assertions.assertEquals(expectedByteArray.contentToString(), result.contentToString())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenResponseWhenMessageIsCorrectLengthThenResultTrue() {
|
@Test fun handleResponseGivenResponseWhenMessageIsCorrectLengthThenResultTrue() {
|
||||||
|
@ -57,10 +56,10 @@ class AuthorizePacketTest : MedtrumTestBase() {
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
val swString = "$swVerX.$swVerY.$swVerZ"
|
val swString = "$swVerX.$swVerY.$swVerZ"
|
||||||
Assertions.assertTrue(result)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertFalse(packet.failed)
|
assertThat(packet.failed).isFalse()
|
||||||
Assertions.assertEquals(deviceType, medtrumPump.deviceType)
|
assertThat(medtrumPump.deviceType).isEqualTo(deviceType)
|
||||||
Assertions.assertEquals(swString, medtrumPump.swVersion)
|
assertThat(medtrumPump.swVersion).isEqualTo(swString)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenResponseWhenMessageTooShortThenResultFalse() {
|
@Test fun handleResponseGivenResponseWhenMessageTooShortThenResultFalse() {
|
||||||
|
@ -75,7 +74,7 @@ class AuthorizePacketTest : MedtrumTestBase() {
|
||||||
val result = packet.handleResponse(response)
|
val result = packet.handleResponse(response)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertFalse(result)
|
assertThat(result).isFalse()
|
||||||
Assertions.assertTrue(packet.failed)
|
assertThat(packet.failed).isTrue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
package info.nightscout.pump.medtrum.comm.packets
|
package info.nightscout.pump.medtrum.comm.packets
|
||||||
|
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.pump.medtrum.MedtrumTestBase
|
import info.nightscout.pump.medtrum.MedtrumTestBase
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class CancelBolusPacketTest : MedtrumTestBase() {
|
class CancelBolusPacketTest : MedtrumTestBase() {
|
||||||
|
@ -27,8 +27,6 @@ class CancelBolusPacketTest : MedtrumTestBase() {
|
||||||
val result = packet.getRequest()
|
val result = packet.getRequest()
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
val expectedByteArray = byteArrayOf(opCode.toByte()) + 1.toByte()
|
assertThat(result).asList().containsExactly(opCode.toByte(), 1.toByte()).inOrder()
|
||||||
Assertions.assertEquals(2, result.size)
|
|
||||||
Assertions.assertEquals(expectedByteArray.contentToString(), result.contentToString())
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package info.nightscout.pump.medtrum.comm.packets
|
package info.nightscout.pump.medtrum.comm.packets
|
||||||
|
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.pump.medtrum.MedtrumTestBase
|
import info.nightscout.pump.medtrum.MedtrumTestBase
|
||||||
import info.nightscout.pump.medtrum.comm.enums.BasalType
|
import info.nightscout.pump.medtrum.comm.enums.BasalType
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class CancelTempBasalPacketTest : MedtrumTestBase() {
|
class CancelTempBasalPacketTest : MedtrumTestBase() {
|
||||||
|
@ -30,8 +30,7 @@ class CancelTempBasalPacketTest : MedtrumTestBase() {
|
||||||
val result = packet.getRequest()
|
val result = packet.getRequest()
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(1, result.size)
|
assertThat(result).asList().containsExactly(opCode.toByte())
|
||||||
Assertions.assertEquals(opCode.toByte(), result[0])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenPacketWhenValuesSetThenReturnCorrectValues() {
|
@Test fun handleResponseGivenPacketWhenValuesSetThenReturnCorrectValues() {
|
||||||
|
@ -49,12 +48,12 @@ class CancelTempBasalPacketTest : MedtrumTestBase() {
|
||||||
val expectedStartTime = 1679575392000L
|
val expectedStartTime = 1679575392000L
|
||||||
val expectedPatchId = 146L
|
val expectedPatchId = 146L
|
||||||
|
|
||||||
Assertions.assertTrue(result)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertEquals(expectedBasalType, medtrumPump.lastBasalType)
|
assertThat(medtrumPump.lastBasalType).isEqualTo(expectedBasalType)
|
||||||
Assertions.assertEquals(expectedBasalRate, medtrumPump.lastBasalRate, 0.01)
|
assertThat(medtrumPump.lastBasalRate).isWithin(0.01).of(expectedBasalRate)
|
||||||
Assertions.assertEquals(expectedBasalSequence, medtrumPump.lastBasalSequence)
|
assertThat(medtrumPump.lastBasalSequence).isEqualTo(expectedBasalSequence)
|
||||||
Assertions.assertEquals(expectedStartTime, medtrumPump.lastBasalStartTime)
|
assertThat(medtrumPump.lastBasalStartTime).isEqualTo(expectedStartTime)
|
||||||
Assertions.assertEquals(expectedPatchId, medtrumPump.lastBasalPatchId)
|
assertThat(medtrumPump.lastBasalPatchId).isEqualTo(expectedPatchId)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenResponseWhenMessageTooShortThenResultFalse() {
|
@Test fun handleResponseGivenResponseWhenMessageTooShortThenResultFalse() {
|
||||||
|
@ -66,7 +65,7 @@ class CancelTempBasalPacketTest : MedtrumTestBase() {
|
||||||
val result = packet.handleResponse(response)
|
val result = packet.handleResponse(response)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertFalse(result)
|
assertThat(result).isFalse()
|
||||||
Assertions.assertTrue(packet.failed)
|
assertThat(packet.failed).isTrue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package info.nightscout.pump.medtrum.comm.packets
|
package info.nightscout.pump.medtrum.comm.packets
|
||||||
|
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.pump.medtrum.MedtrumTestBase
|
import info.nightscout.pump.medtrum.MedtrumTestBase
|
||||||
import info.nightscout.pump.medtrum.extension.toInt
|
import info.nightscout.pump.medtrum.extension.toInt
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class ClearPumpAlarmPacketTest : MedtrumTestBase() {
|
class ClearPumpAlarmPacketTest : MedtrumTestBase() {
|
||||||
|
@ -29,8 +29,8 @@ class ClearPumpAlarmPacketTest : MedtrumTestBase() {
|
||||||
val result = packet.getRequest()
|
val result = packet.getRequest()
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(3, result.size)
|
assertThat(result).hasLength(3)
|
||||||
Assertions.assertEquals(opCode.toByte(), result[0])
|
assertThat(result[0]).isEqualTo(opCode.toByte())
|
||||||
Assertions.assertEquals(clearCode, result.copyOfRange(1, 3).toInt())
|
assertThat(result.copyOfRange(1, 3).toInt()).isEqualTo(clearCode)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package info.nightscout.pump.medtrum.comm.packets
|
package info.nightscout.pump.medtrum.comm.packets
|
||||||
|
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.pump.medtrum.MedtrumTestBase
|
import info.nightscout.pump.medtrum.MedtrumTestBase
|
||||||
import info.nightscout.pump.medtrum.extension.toByteArray
|
import info.nightscout.pump.medtrum.extension.toByteArray
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class GetDeviceTypePacketTest : MedtrumTestBase() {
|
class GetDeviceTypePacketTest : MedtrumTestBase() {
|
||||||
|
@ -28,8 +28,7 @@ class GetDeviceTypePacketTest : MedtrumTestBase() {
|
||||||
val result = packet.getRequest()
|
val result = packet.getRequest()
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(1, result.size)
|
assertThat(result).asList().containsExactly(opCode.toByte())
|
||||||
Assertions.assertEquals(opCode.toByte(), result[0])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenResponseWhenMessageIsCorrectLengthThenResultTrue() {
|
@Test fun handleResponseGivenResponseWhenMessageIsCorrectLengthThenResultTrue() {
|
||||||
|
@ -45,10 +44,10 @@ class GetDeviceTypePacketTest : MedtrumTestBase() {
|
||||||
val result = packet.handleResponse(response)
|
val result = packet.handleResponse(response)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(true, result)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertEquals(false, packet.failed)
|
assertThat(packet.failed).isFalse()
|
||||||
Assertions.assertEquals(deviceType, packet.deviceType)
|
assertThat(packet.deviceType).isEqualTo(deviceType)
|
||||||
Assertions.assertEquals(deviceSN, packet.deviceSN)
|
assertThat(packet.deviceSN).isEqualTo(deviceSN)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,9 +64,9 @@ class GetDeviceTypePacketTest : MedtrumTestBase() {
|
||||||
val result = packet.handleResponse(response.sliceArray(0..response.size - 2))
|
val result = packet.handleResponse(response.sliceArray(0..response.size - 2))
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(false, result)
|
assertThat(result).isFalse()
|
||||||
Assertions.assertEquals(true, packet.failed)
|
assertThat(packet.failed).isTrue()
|
||||||
Assertions.assertEquals(0, packet.deviceType)
|
assertThat(packet.deviceType).isEqualTo(0)
|
||||||
Assertions.assertEquals(0, packet.deviceSN)
|
assertThat(packet.deviceSN).isEqualTo(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,10 +4,10 @@ import app.aaps.core.interfaces.pump.DetailedBolusInfo
|
||||||
import app.aaps.core.interfaces.pump.DetailedBolusInfoStorage
|
import app.aaps.core.interfaces.pump.DetailedBolusInfoStorage
|
||||||
import app.aaps.core.interfaces.pump.PumpSync
|
import app.aaps.core.interfaces.pump.PumpSync
|
||||||
import app.aaps.core.interfaces.utils.T
|
import app.aaps.core.interfaces.utils.T
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.pump.medtrum.MedtrumTestBase
|
import info.nightscout.pump.medtrum.MedtrumTestBase
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.mockito.Mock
|
import org.mockito.Mock
|
||||||
import org.mockito.Mockito
|
import org.mockito.Mockito
|
||||||
|
@ -42,7 +42,7 @@ class GetRecordPacketTest : MedtrumTestBase() {
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
val expected = byteArrayOf(99, 4, 0, -110, 0)
|
val expected = byteArrayOf(99, 4, 0, -110, 0)
|
||||||
Assertions.assertEquals(expected.contentToString(), result.contentToString())
|
assertThat(result).asList().containsExactlyElementsIn(expected.toList()).inOrder()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenPacketWhenValuesSetThenReturnCorrectValues() {
|
@Test fun handleResponseGivenPacketWhenValuesSetThenReturnCorrectValues() {
|
||||||
|
@ -54,8 +54,8 @@ class GetRecordPacketTest : MedtrumTestBase() {
|
||||||
val result = packet.handleResponse(data)
|
val result = packet.handleResponse(data)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(true, result)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertEquals(false, packet.failed)
|
assertThat(packet.failed).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenResponseWhenMessageTooShortThenResultFalse() {
|
@Test fun handleResponseGivenResponseWhenMessageTooShortThenResultFalse() {
|
||||||
|
@ -67,8 +67,8 @@ class GetRecordPacketTest : MedtrumTestBase() {
|
||||||
val result = packet.handleResponse(data)
|
val result = packet.handleResponse(data)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(false, result)
|
assertThat(result).isFalse()
|
||||||
Assertions.assertEquals(true, packet.failed)
|
assertThat(packet.failed).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenBolusRecordWhenAndDetailedBolusInfoPresentThenExpectPumpSyncWithTempId() {
|
@Test fun handleResponseGivenBolusRecordWhenAndDetailedBolusInfoPresentThenExpectPumpSyncWithTempId() {
|
||||||
|
@ -100,10 +100,10 @@ class GetRecordPacketTest : MedtrumTestBase() {
|
||||||
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(true, result)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertEquals(false, packet.failed)
|
assertThat(packet.failed).isFalse()
|
||||||
Assertions.assertEquals(timestamp, medtrumPump.lastBolusTime)
|
assertThat(medtrumPump.lastBolusTime).isEqualTo(timestamp)
|
||||||
Assertions.assertEquals(amount, medtrumPump.lastBolusAmount, 0.01)
|
assertThat(medtrumPump.lastBolusAmount).isWithin(0.01).of(amount)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenBolusRecordWhenAndNoDetailedBolusInfoPresentThenExpectPumpSyncWithPumpId() {
|
@Test fun handleResponseGivenBolusRecordWhenAndNoDetailedBolusInfoPresentThenExpectPumpSyncWithPumpId() {
|
||||||
|
@ -129,10 +129,10 @@ class GetRecordPacketTest : MedtrumTestBase() {
|
||||||
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(true, result)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertEquals(false, packet.failed)
|
assertThat(packet.failed).isFalse()
|
||||||
Assertions.assertEquals(timestamp, medtrumPump.lastBolusTime)
|
assertThat(medtrumPump.lastBolusTime).isEqualTo(timestamp)
|
||||||
Assertions.assertEquals(amount, medtrumPump.lastBolusAmount, 0.01)
|
assertThat(medtrumPump.lastBolusAmount).isWithin(0.01).of(amount)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenExtendedBolusRecordThenExpectPumpSyncWithPumpId() {
|
@Test fun handleResponseGivenExtendedBolusRecordThenExpectPumpSyncWithPumpId() {
|
||||||
|
@ -157,8 +157,8 @@ class GetRecordPacketTest : MedtrumTestBase() {
|
||||||
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(true, result)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertEquals(false, packet.failed)
|
assertThat(packet.failed).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenComboBolusRecordWhenAndNoDetailedBolusInfoPresentThenExpectPumpSyncWithPumpId() {
|
@Test fun handleResponseGivenComboBolusRecordWhenAndNoDetailedBolusInfoPresentThenExpectPumpSyncWithPumpId() {
|
||||||
|
@ -195,8 +195,8 @@ class GetRecordPacketTest : MedtrumTestBase() {
|
||||||
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(true, result)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertEquals(false, packet.failed)
|
assertThat(packet.failed).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenBasalRecordWhenAbsoluteTempThenExpectPumpSync() {
|
@Test fun handleResponseGivenBasalRecordWhenAbsoluteTempThenExpectPumpSync() {
|
||||||
|
@ -223,8 +223,8 @@ class GetRecordPacketTest : MedtrumTestBase() {
|
||||||
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(true, result)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertEquals(false, packet.failed)
|
assertThat(packet.failed).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenBasalRecordWhenRelativeTempThenExpectPumpSync() {
|
@Test fun handleResponseGivenBasalRecordWhenRelativeTempThenExpectPumpSync() {
|
||||||
|
@ -251,8 +251,8 @@ class GetRecordPacketTest : MedtrumTestBase() {
|
||||||
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(true, result)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertEquals(false, packet.failed)
|
assertThat(packet.failed).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenBasalRecordWhenSuspendThenExpectPumpSync() {
|
@Test fun handleResponseGivenBasalRecordWhenSuspendThenExpectPumpSync() {
|
||||||
|
@ -279,8 +279,8 @@ class GetRecordPacketTest : MedtrumTestBase() {
|
||||||
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(true, result)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertEquals(false, packet.failed)
|
assertThat(packet.failed).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenBasalRecordWhenStandardAndSuspendEndReasonThenExpectPumpSync() {
|
@Test fun handleResponseGivenBasalRecordWhenStandardAndSuspendEndReasonThenExpectPumpSync() {
|
||||||
|
@ -315,8 +315,8 @@ class GetRecordPacketTest : MedtrumTestBase() {
|
||||||
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(true, result)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertEquals(false, packet.failed)
|
assertThat(packet.failed).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenBasalRecordWhenTempAndSuspendEndReasonThenExpectPumpSync() {
|
@Test fun handleResponseGivenBasalRecordWhenTempAndSuspendEndReasonThenExpectPumpSync() {
|
||||||
|
@ -351,8 +351,8 @@ class GetRecordPacketTest : MedtrumTestBase() {
|
||||||
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(true, result)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertEquals(false, packet.failed)
|
assertThat(packet.failed).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenBasalRecordWhenStandardAndSuspendEndReasonAndNewerExistingTBRThenExpectNoPumpSync() {
|
@Test fun handleResponseGivenBasalRecordWhenStandardAndSuspendEndReasonAndNewerExistingTBRThenExpectNoPumpSync() {
|
||||||
|
@ -391,8 +391,8 @@ class GetRecordPacketTest : MedtrumTestBase() {
|
||||||
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(true, result)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertEquals(false, packet.failed)
|
assertThat(packet.failed).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenTDDRecordThenExpectPumpSync() {
|
@Test fun handleResponseGivenTDDRecordThenExpectPumpSync() {
|
||||||
|
@ -421,7 +421,7 @@ class GetRecordPacketTest : MedtrumTestBase() {
|
||||||
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
pumpSerial = medtrumPump.pumpSN.toString(radix = 16)
|
||||||
)
|
)
|
||||||
|
|
||||||
Assertions.assertEquals(true, result)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertEquals(false, packet.failed)
|
assertThat(packet.failed).isFalse()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
package info.nightscout.pump.medtrum.comm.packets
|
package info.nightscout.pump.medtrum.comm.packets
|
||||||
|
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.pump.medtrum.MedtrumTestBase
|
import info.nightscout.pump.medtrum.MedtrumTestBase
|
||||||
import info.nightscout.pump.medtrum.extension.toByteArray
|
import info.nightscout.pump.medtrum.extension.toByteArray
|
||||||
import info.nightscout.pump.medtrum.util.MedtrumTimeUtil
|
import info.nightscout.pump.medtrum.util.MedtrumTimeUtil
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class GetTimePacketTest : MedtrumTestBase() {
|
class GetTimePacketTest : MedtrumTestBase() {
|
||||||
|
@ -30,8 +30,7 @@ class GetTimePacketTest : MedtrumTestBase() {
|
||||||
val result = packet.getRequest()
|
val result = packet.getRequest()
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(1, result.size)
|
assertThat(result).asList().containsExactly(opCode.toByte())
|
||||||
Assertions.assertEquals(opCode.toByte(), result[0])
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenResponseWhenMessageIsCorrectLengthThenResultTrue() {
|
@Test fun handleResponseGivenResponseWhenMessageIsCorrectLengthThenResultTrue() {
|
||||||
|
@ -46,9 +45,9 @@ class GetTimePacketTest : MedtrumTestBase() {
|
||||||
val result = packet.handleResponse(response)
|
val result = packet.handleResponse(response)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(true, result)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertEquals(false, packet.failed)
|
assertThat(packet.failed).isFalse()
|
||||||
Assertions.assertEquals(MedtrumTimeUtil().convertPumpTimeToSystemTimeMillis(time), medtrumPump.lastTimeReceivedFromPump)
|
assertThat(medtrumPump.lastTimeReceivedFromPump).isEqualTo(MedtrumTimeUtil().convertPumpTimeToSystemTimeMillis(time))
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenResponseWhenMessageTooShortThenResultFalse() {
|
@Test fun handleResponseGivenResponseWhenMessageTooShortThenResultFalse() {
|
||||||
|
@ -63,8 +62,8 @@ class GetTimePacketTest : MedtrumTestBase() {
|
||||||
val result = packet.handleResponse(response.sliceArray(0..response.size - 2))
|
val result = packet.handleResponse(response.sliceArray(0..response.size - 2))
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(false, result)
|
assertThat(result).isFalse()
|
||||||
Assertions.assertEquals(true, packet.failed)
|
assertThat(packet.failed).isTrue()
|
||||||
Assertions.assertEquals(0, medtrumPump.lastTimeReceivedFromPump)
|
assertThat(medtrumPump.lastTimeReceivedFromPump).isEqualTo(0)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
package info.nightscout.pump.medtrum.comm.packets
|
package info.nightscout.pump.medtrum.comm.packets
|
||||||
|
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.pump.medtrum.MedtrumTestBase
|
import info.nightscout.pump.medtrum.MedtrumTestBase
|
||||||
import info.nightscout.pump.medtrum.extension.toByteArray
|
import info.nightscout.pump.medtrum.extension.toByteArray
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class MedtrumPacketTest : MedtrumTestBase() {
|
class MedtrumPacketTest : MedtrumTestBase() {
|
||||||
|
@ -29,8 +29,7 @@ class MedtrumPacketTest : MedtrumTestBase() {
|
||||||
val result = packet.getRequest()
|
val result = packet.getRequest()
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(result.size, 1)
|
assertThat(result).asList().containsExactly(opCode.toByte())
|
||||||
Assertions.assertEquals(result[0], opCode.toByte())
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenResponseWhenOpcodeIsCorrectThenResultTrue() {
|
@Test fun handleResponseGivenResponseWhenOpcodeIsCorrectThenResultTrue() {
|
||||||
|
@ -45,8 +44,8 @@ class MedtrumPacketTest : MedtrumTestBase() {
|
||||||
val result = packet.handleResponse(response)
|
val result = packet.handleResponse(response)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(result, true)
|
assertThat(result).isTrue()
|
||||||
Assertions.assertEquals(packet.failed, false)
|
assertThat(packet.failed).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenResponseWhenOpcodeIsIncorrectThenResultFalse() {
|
@Test fun handleResponseGivenResponseWhenOpcodeIsIncorrectThenResultFalse() {
|
||||||
|
@ -61,8 +60,8 @@ class MedtrumPacketTest : MedtrumTestBase() {
|
||||||
val result = packet.handleResponse(response)
|
val result = packet.handleResponse(response)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(result, false)
|
assertThat(result).isFalse()
|
||||||
Assertions.assertEquals(packet.failed, true)
|
assertThat(packet.failed).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenResponseWhenResponseCodeIsWaitingThenResultFalse() {
|
@Test fun handleResponseGivenResponseWhenResponseCodeIsWaitingThenResultFalse() {
|
||||||
|
@ -77,8 +76,8 @@ class MedtrumPacketTest : MedtrumTestBase() {
|
||||||
val result = packet.handleResponse(response)
|
val result = packet.handleResponse(response)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(result, false)
|
assertThat(result).isFalse()
|
||||||
Assertions.assertEquals(packet.failed, false)
|
assertThat(packet.failed).isFalse()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenResponseWhenResponseCodeIsErrorThenResultFalse() {
|
@Test fun handleResponseGivenResponseWhenResponseCodeIsErrorThenResultFalse() {
|
||||||
|
@ -93,8 +92,8 @@ class MedtrumPacketTest : MedtrumTestBase() {
|
||||||
val result = packet.handleResponse(response)
|
val result = packet.handleResponse(response)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(false, result)
|
assertThat(result).isFalse()
|
||||||
Assertions.assertEquals(true, packet.failed)
|
assertThat(packet.failed).isTrue()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleResponseGivenResponseWhenMessageTooShortThenResultFalse() {
|
@Test fun handleResponseGivenResponseWhenMessageTooShortThenResultFalse() {
|
||||||
|
@ -108,7 +107,7 @@ class MedtrumPacketTest : MedtrumTestBase() {
|
||||||
val result = packet.handleResponse(response)
|
val result = packet.handleResponse(response)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(false, result)
|
assertThat(result).isFalse()
|
||||||
Assertions.assertEquals(true, packet.failed)
|
assertThat(packet.failed).isTrue()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
package info.nightscout.pump.medtrum.comm.packets
|
package info.nightscout.pump.medtrum.comm.packets
|
||||||
|
|
||||||
import app.aaps.core.interfaces.rx.events.EventOverviewBolusProgress
|
import app.aaps.core.interfaces.rx.events.EventOverviewBolusProgress
|
||||||
|
import com.google.common.truth.Truth.assertThat
|
||||||
import dagger.android.AndroidInjector
|
import dagger.android.AndroidInjector
|
||||||
import dagger.android.HasAndroidInjector
|
import dagger.android.HasAndroidInjector
|
||||||
import info.nightscout.pump.medtrum.MedtrumTestBase
|
import info.nightscout.pump.medtrum.MedtrumTestBase
|
||||||
import info.nightscout.pump.medtrum.comm.enums.BasalType
|
import info.nightscout.pump.medtrum.comm.enums.BasalType
|
||||||
import info.nightscout.pump.medtrum.comm.enums.MedtrumPumpState
|
import info.nightscout.pump.medtrum.comm.enums.MedtrumPumpState
|
||||||
import org.junit.jupiter.api.Assertions
|
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
|
|
||||||
class NotificationPacketTest : MedtrumTestBase() {
|
class NotificationPacketTest : MedtrumTestBase() {
|
||||||
|
@ -30,7 +30,7 @@ class NotificationPacketTest : MedtrumTestBase() {
|
||||||
NotificationPacket(packetInjector).handleNotification(byteArrayOf(state))
|
NotificationPacket(packetInjector).handleNotification(byteArrayOf(state))
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(medtrumPump.pumpState, MedtrumPumpState.fromByte(state))
|
assertThat(MedtrumPumpState.fromByte(state)).isEqualTo(medtrumPump.pumpState)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleNotificationGivenBasalDataThenDataSaved() {
|
@Test fun handleNotificationGivenBasalDataThenDataSaved() {
|
||||||
|
@ -41,12 +41,12 @@ class NotificationPacketTest : MedtrumTestBase() {
|
||||||
NotificationPacket(packetInjector).handleNotification(data)
|
NotificationPacket(packetInjector).handleNotification(data)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(BasalType.ABSOLUTE_TEMP, medtrumPump.lastBasalType)
|
assertThat(medtrumPump.lastBasalType).isEqualTo(BasalType.ABSOLUTE_TEMP)
|
||||||
Assertions.assertEquals(0.85, medtrumPump.lastBasalRate, 0.01)
|
assertThat(medtrumPump.lastBasalRate).isWithin(0.01).of(0.85)
|
||||||
Assertions.assertEquals(25, medtrumPump.lastBasalSequence)
|
assertThat(medtrumPump.lastBasalSequence).isEqualTo(25)
|
||||||
Assertions.assertEquals(14, medtrumPump.lastBasalPatchId)
|
assertThat(medtrumPump.lastBasalPatchId).isEqualTo(14)
|
||||||
Assertions.assertEquals(1685126612000, medtrumPump.lastBasalStartTime)
|
assertThat(medtrumPump.lastBasalStartTime).isEqualTo(1685126612000)
|
||||||
Assertions.assertEquals(186.80, medtrumPump.reservoir, 0.01)
|
assertThat(medtrumPump.reservoir).isWithin(0.01).of(186.80)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleNotificationGivenSequenceAndOtherDataThenDataSaved() {
|
@Test fun handleNotificationGivenSequenceAndOtherDataThenDataSaved() {
|
||||||
|
@ -57,7 +57,7 @@ class NotificationPacketTest : MedtrumTestBase() {
|
||||||
NotificationPacket(packetInjector).handleNotification(data)
|
NotificationPacket(packetInjector).handleNotification(data)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(167, medtrumPump.currentSequenceNumber)
|
assertThat(medtrumPump.currentSequenceNumber).isEqualTo(167)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleNotificationGivenBolusInProgressThenDataSaved() {
|
@Test fun handleNotificationGivenBolusInProgressThenDataSaved() {
|
||||||
|
@ -69,9 +69,9 @@ class NotificationPacketTest : MedtrumTestBase() {
|
||||||
NotificationPacket(packetInjector).handleNotification(data)
|
NotificationPacket(packetInjector).handleNotification(data)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(false, medtrumPump.bolusDone)
|
assertThat(medtrumPump.bolusDone).isFalse()
|
||||||
Assertions.assertEquals(0.15, medtrumPump.bolusingTreatment!!.insulin, 0.01)
|
assertThat(medtrumPump.bolusingTreatment!!.insulin).isWithin(0.01).of(0.15)
|
||||||
Assertions.assertEquals(163.5, medtrumPump.reservoir, 0.01)
|
assertThat(medtrumPump.reservoir).isWithin(0.01).of(163.5)
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test fun handleNotificationGivenBolusFinishedThenDataSaved() {
|
@Test fun handleNotificationGivenBolusFinishedThenDataSaved() {
|
||||||
|
@ -83,8 +83,8 @@ class NotificationPacketTest : MedtrumTestBase() {
|
||||||
NotificationPacket(packetInjector).handleNotification(data)
|
NotificationPacket(packetInjector).handleNotification(data)
|
||||||
|
|
||||||
// Expected values
|
// Expected values
|
||||||
Assertions.assertEquals(true, medtrumPump.bolusDone)
|
assertThat(medtrumPump.bolusDone).isTrue()
|
||||||
Assertions.assertEquals(1.65, medtrumPump.bolusingTreatment!!.insulin, 0.01)
|
assertThat(medtrumPump.bolusingTreatment!!.insulin).isWithin(0.01).of(1.65)
|
||||||
Assertions.assertEquals(161.95, medtrumPump.reservoir, 0.01)
|
assertThat(medtrumPump.reservoir).isWithin(0.01).of(161.95)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue