Merge branch 'dev' into kts
This commit is contained in:
commit
f41a62c611
258 changed files with 2196 additions and 3012 deletions
|
@ -9,7 +9,7 @@
|
|||
<string name="delta">Delta</string>
|
||||
<string name="profile_label">Profil</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="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>
|
|
@ -1,2 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
|
@ -1,2 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
|
@ -45,7 +45,7 @@
|
|||
<item>it</item>
|
||||
<item>ko</item>
|
||||
<item>lt</item>
|
||||
<item>no</item>
|
||||
<item>nb_NO</item>
|
||||
<item>pt</item>
|
||||
<item>pt_BR</item>
|
||||
<item>ro</item>
|
||||
|
|
|
@ -12,20 +12,20 @@ buildscript {
|
|||
set("rxkotlin_version", "3.0.1")
|
||||
set("room_version", "2.5.2")
|
||||
set("lifecycle_version", "2.6.2")
|
||||
set("dagger_version", "2.48")
|
||||
set("dagger_version", "2.48.1")
|
||||
set("coroutines_version", "1.7.3")
|
||||
set("activity_version", "1.7.2")
|
||||
set("activity_version", "1.8.0")
|
||||
set("fragmentktx_version", "1.6.1")
|
||||
set("ormLite_version", "4.46")
|
||||
set("gson_version", "2.10.1")
|
||||
set("nav_version", "2.7.3")
|
||||
set("nav_version", "2.7.4")
|
||||
set("appcompat_version", "1.6.1")
|
||||
set("material_version", "1.9.0")
|
||||
set("material_version", "1.10.0")
|
||||
set("gridlayout_version", "1.0.0")
|
||||
set("constraintlayout_version", "2.1.4")
|
||||
set("preferencektx_version", "1.2.1")
|
||||
set("commonscodec_version", "1.16.0")
|
||||
set("guava_version", "32.1.2-jre")
|
||||
set("guava_version", "32.1.3-jre")
|
||||
set("jodatime_version", "2.12.5")
|
||||
set("work_version", "2.8.1")
|
||||
set("tink_version", "1.10.0")
|
||||
|
@ -35,7 +35,7 @@ buildscript {
|
|||
|
||||
set("junit_version", "4.13.2")
|
||||
set("junit_jupiter_version", "5.10.0")
|
||||
set("mockito_version", "5.5.0")
|
||||
set("mockito_version", "5.6.0")
|
||||
set("dexmaker_version", "1.2")
|
||||
set("retrofit2_version", "2.9.0")
|
||||
set("okhttp3_version", "4.11.0")
|
||||
|
@ -74,7 +74,7 @@ buildscript {
|
|||
}
|
||||
|
||||
plugins {
|
||||
id("org.jlleitschuh.gradle.ktlint") version "11.6.0"
|
||||
id("org.jlleitschuh.gradle.ktlint") version "11.6.1"
|
||||
id("org.jetbrains.kotlin.android") version Libs.Kotlin.kotlin apply false
|
||||
}
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ object Libs {
|
|||
|
||||
object Dagger {
|
||||
|
||||
private const val version = "2.48"
|
||||
private const val version = "2.48.1"
|
||||
const val dagger = "com.google.dagger:dagger:$version"
|
||||
const val android = "com.google.dagger:dagger-android:$version"
|
||||
const val androidProcessor = "com.google.dagger:dagger-android-processor:$version"
|
||||
|
@ -68,18 +68,18 @@ object Libs {
|
|||
const val room = "2.5.2"
|
||||
const val lifecycle = "2.6.2"
|
||||
const val coroutines = "1.7.3"
|
||||
const val activity = "1.7.2"
|
||||
const val activity = "1.8.0"
|
||||
const val fragmentktx = "1.6.1"
|
||||
const val ormLite = "4.46"
|
||||
const val gson = "2.10.1"
|
||||
const val nav = "2.7.3"
|
||||
const val material = "1.9.0"
|
||||
const val nav = "2.7.4"
|
||||
const val material = "1.10.0"
|
||||
const val gridlayout = "1.0.0"
|
||||
const val constraintlayout = "2.1.4"
|
||||
const val preferencektx = "1.2.1"
|
||||
const val commonslang3 = "3.13.0"
|
||||
const val commonscodec = "1.16.0"
|
||||
const val guava = "32.1.2-jre"
|
||||
const val guava = "32.1.3-jre"
|
||||
const val work = "2.8.1"
|
||||
const val tink = "1.10.0"
|
||||
const val json = "20230618"
|
||||
|
@ -87,7 +87,7 @@ object Libs {
|
|||
|
||||
const val junit = "4.13.2"
|
||||
const val junit_jupiter = "5.10.0"
|
||||
const val mockito = "5.5.0"
|
||||
const val mockito = "5.6.0"
|
||||
const val dexmaker = "1.2"
|
||||
const val retrofit2 = "2.9.0"
|
||||
const val okhttp3 = "4.11.0"
|
||||
|
|
|
@ -138,6 +138,7 @@ open class Notification {
|
|||
const val PUMP_SETTINGS_FAILED = 84
|
||||
const val PUMP_TIMEZONE_UPDATE_FAILED = 85
|
||||
const val BLUETOOTH_NOT_SUPPORTED = 86
|
||||
const val PUMP_WARNING = 87
|
||||
|
||||
const val USER_MESSAGE = 1000
|
||||
|
||||
|
|
|
@ -238,7 +238,23 @@ enum class JsonKeys(val key: String) {
|
|||
ALLCAPS("allCaps"),
|
||||
DAYNAMEFORMAT("dayNameFormat"),
|
||||
MONTHFORMAT("monthFormat"),
|
||||
BACKGROUND("background")
|
||||
BACKGROUND("background"), // Background image for textView
|
||||
LEFTOFFSET("leftOffset"),
|
||||
TOPOFFSET("topOffset"),
|
||||
ROTATIONOFFSET("rotationOffset"),
|
||||
DYNDATA("dynData"), //Bloc of DynDatas definition, and DynData keyValue within view
|
||||
VALUEKEY("valueKey"), // Indentify which value (default is View Value)
|
||||
MINDATA("minData"), // Min data Value (default defined for each value, note unit mg/dl for all bg, deltas)
|
||||
MAXDATA("maxData"), // Max data idem min data (note all value below min or above max will be considered as equal min or mas)
|
||||
MINVALUE("minValue"), // min returned value (when data value equals minData
|
||||
MAXVALUE("maxValue"), //
|
||||
INVALIDVALUE("invalidValue"),
|
||||
IMAGE("image"),
|
||||
INVALIDIMAGE("invalidImage"),
|
||||
INVALIDCOLOR("invalidColor"),
|
||||
TWINVIEW("twinView"),
|
||||
TOPOFFSETTWINHIDDEN("topOffsetTwinHidden"),
|
||||
LEFTOFFSETTWINHIDDEN("leftOffsetTwinHidden")
|
||||
}
|
||||
|
||||
enum class JsonKeyValues(val key: String) {
|
||||
|
@ -260,7 +276,8 @@ enum class JsonKeyValues(val key: String) {
|
|||
BOLD("bold"),
|
||||
BOLD_ITALIC("bold_italic"),
|
||||
ITALIC("italic"),
|
||||
BGCOLOR("bgColor")
|
||||
BGCOLOR("bgColor"),
|
||||
SGVLEVEL("sgvLevel")
|
||||
}
|
||||
|
||||
class ZipWatchfaceFormat {
|
||||
|
|
|
@ -30,7 +30,7 @@
|
|||
<string name="today">היום</string>
|
||||
<string name="yesterday">אתמול</string>
|
||||
<!-- Rx -->
|
||||
<string name="connecting_for">חיבור אל %1$s</string>
|
||||
<string name="connecting_for">מתחבר במשך %1$d שניות</string>
|
||||
<string name="handshaking">לוחץ יד</string>
|
||||
<string name="connected">מחובר</string>
|
||||
<string name="disconnecting">מתנתק</string>
|
||||
|
|
|
@ -54,7 +54,7 @@
|
|||
<string name="pref_show_basal_rate">Vis basalrate</string>
|
||||
<string name="pref_show_loop_status">Vis loop status</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_ago">Vis tid siden</string>
|
||||
<string name="pref_show_week_number">Vis ukenummer</string>
|
|
@ -457,6 +457,7 @@
|
|||
<string name="cobvsiob">פחמ\' פעילות לעומת אינ\' פעיל</string>
|
||||
<string name="slowabsorptiondetected"><![CDATA[<font color=\'%1$s\'>!!!!!! זוהתה ספיגת פחמימות איטית: %2$d%% מהזמן הצפוי. הערכת כמות הפחמימות הפעילות עלולה להיות ביתר ולכן תיתכן הזרקת אינסולין עודפת !!!!!!</font>]]></string>
|
||||
<string name="partialboluswizard">ספק את חלק זה מתוצאת אשף הבולוס [%]</string>
|
||||
<string name="partialboluswizard_reset_time">סף זמן נתונים ישנים [דק\']</string>
|
||||
<string name="bolus_constraint_applied_warn">מגבלת בולוס יושמה: %1$.2f עד %2$.2f יח\'</string>
|
||||
<string name="bolus_recorded_only">בולוס רשום בלבד (לא מוזרק על ידי המשאבה)</string>
|
||||
<string name="advisoralarm">הפעל התראה כשצריכים לאכול</string>
|
||||
|
@ -586,7 +587,22 @@
|
|||
<string name="cleanup_db_confirm_sync">האם ברצונכם לנקות את מסד הנתונים?\nשינויים הנמצאים במעקב ונתונים היסטוריים הישנים מ-3 חודשים יימחקו.\nפעולה זו תזרז משמעותית את מהירות הסינכרון המלא.</string>
|
||||
<string name="cleared_entries">רשומות שנמחקו</string>
|
||||
<!-- Weekday-->
|
||||
<string name="weekday_sunday_short">א׳</string>
|
||||
<string name="weekday_saturday_short">ש\'</string>
|
||||
<string name="weekday_friday_short">ו׳</string>
|
||||
<string name="weekday_thursday_short">ה\'</string>
|
||||
<string name="weekday_wednesday_short">ד\'</string>
|
||||
<string name="weekday_tuesday_short">ג\'</string>
|
||||
<string name="weekday_monday_short">ב\'</string>
|
||||
<!-- WeekdayPicker -->
|
||||
<string name="monday_short">ב\'</string>
|
||||
<string name="tuesday_short">ג\'</string>
|
||||
<string name="wednesday_short">ד\'</string>
|
||||
<string name="thursday_short">ה\'</string>
|
||||
<string name="friday_short">ו\'</string>
|
||||
<string name="saturday_short">ש\'</string>
|
||||
<string name="sunday_short">א\'</string>
|
||||
<!-- DecimalFormatterImpl -->
|
||||
<string name="format_insulin_units1">%1$.1f יח\'</string>
|
||||
<string name="format_insulin_units">%1$.2f יח\'</string>
|
||||
</resources>
|
||||
|
|
|
@ -7,7 +7,7 @@
|
|||
<string name="invalid_input">Ugyldige verdier</string>
|
||||
<string name="bolus_delivering">Leverer %1$.2f E</string>
|
||||
<string name="constraint_applied">Begrensning benyttet!</string>
|
||||
<string name="tempbasals_iobtotal_label_string">Total IOB:</string>
|
||||
<string name="tempbasals_iobtotal_label_string">Totalt IOB:</string>
|
||||
<string name="tt_label">TT</string>
|
||||
<string name="pump_unreachable">Pumpe er utilgjengelig</string>
|
||||
<string name="insulin_unit_shortname">E</string>
|
||||
|
@ -64,7 +64,7 @@
|
|||
<string name="carbs">Karbo</string>
|
||||
<string name="invalid_profile">Ugyldig profil!</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="units_label">Enheter</string>
|
||||
<string name="dia_label">DIA</string>
|
||||
|
@ -73,7 +73,7 @@
|
|||
<string name="basal_label">Basal</string>
|
||||
<string name="target_label">Målverdi</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="basal_long_label">Basalrate</string>
|
||||
<string name="target_long_label">Blodsukkermål</string>
|
||||
|
@ -136,7 +136,7 @@
|
|||
<string name="a11y_low">lavt</string>
|
||||
<string name="average">Gjennomsnitt</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="activate_profile">Aktiver profil</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="overview_treatment_label">Behandling</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="treatments_wizard_cob_label">COB</string>
|
||||
<string name="bolus_iob_label">Bolus IOB</string>
|
||||
|
@ -155,7 +155,7 @@
|
|||
<string name="login">Login</string>
|
||||
<string name="prime_fill">Prime/fylling</string>
|
||||
<string name="overview_insulin_label">Insulin</string>
|
||||
<string name="stoptemptarget">Avbryt temp target</string>
|
||||
<string name="stoptemptarget">Avbryt midlertidig mål</string>
|
||||
<string name="closedloop">Lukket Loop</string>
|
||||
<string name="openloop">Åpen Loop</string>
|
||||
<string name="lowglucosesuspend">Stopp ved lavt BS</string>
|
||||
|
@ -220,10 +220,10 @@
|
|||
<string name="careportal_carbscorrection">Karbo-korreksjon</string>
|
||||
<string name="careportal_openapsoffline">OpenAPS Offline</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_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_sensor">Sensor</string>
|
||||
<string name="manual">Manuell</string>
|
||||
|
@ -231,7 +231,7 @@
|
|||
<string name="eatingsoon">Spise snart</string>
|
||||
<string name="hypo">Hypo</string>
|
||||
<string name="activity">Aktivitet</string>
|
||||
<string name="wear">Wear</string>
|
||||
<string name="wear">Klokke</string>
|
||||
<string name="automation">Automatisering</string>
|
||||
<string name="custom">Egendefinert</string>
|
||||
<string name="loop">Loop</string>
|
||||
|
@ -453,10 +453,10 @@
|
|||
<string name="info">INFO</string>
|
||||
<!-- BolusWizard -->
|
||||
<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="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="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>
|
||||
|
@ -478,7 +478,7 @@
|
|||
<string name="wizard_explain_tt">TempT: %1$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="quickwizard">Hurtigveiviser</string>
|
||||
<string name="quickwizard">Hurtigknapp</string>
|
||||
<!-- Preferences-->
|
||||
<string name="child">Barn</string>
|
||||
<string name="teenage">Tenåring</string>
|
||||
|
@ -486,8 +486,8 @@
|
|||
<string name="resistant_adult">Insulinresistent voksen</string>
|
||||
<string name="pregnant">Graviditet</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_carbs_title">Maks tillat karbo [g]</string>
|
||||
<string name="max_bolus_title">Maks tillatt bolus [U]</string>
|
||||
<string name="max_carbs_title">Maks tillatt karbohydrater [g]</string>
|
||||
<string name="patient_type">Pasienttype</string>
|
||||
<!-- Protection-->
|
||||
<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)))
|
||||
|
||||
if (deleteTrackedChanges) {
|
||||
removed.add(Pair("GlucoseValue", database.glucoseValueDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("TherapyEvent", database.therapyEventDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("TemporaryBasal", database.temporaryBasalDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("Bolus", database.bolusDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("ExtendedBolus", database.extendedBolusDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("MultiWaveBolus", database.multiwaveBolusLinkDao.deleteTrackedChanges()))
|
||||
// keep TDD removed.add(Pair("TotalDailyDose", database.totalDailyDoseDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("Carbs", database.carbsDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("TemporaryTarget", database.temporaryTargetDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("ApsResultLink", database.apsResultLinkDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("BolusCalculatorResult", database.bolusCalculatorResultDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("EffectiveProfileSwitch", database.effectiveProfileSwitchDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("ProfileSwitch", database.profileSwitchDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("ApsResult", database.apsResultDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("CHANGES GlucoseValue", database.glucoseValueDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("CHANGES TherapyEvent", database.therapyEventDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("CHANGES TemporaryBasal", database.temporaryBasalDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("CHANGES Bolus", database.bolusDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("CHANGES ExtendedBolus", database.extendedBolusDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("CHANGES MultiWaveBolus", database.multiwaveBolusLinkDao.deleteTrackedChanges()))
|
||||
// keep TDD removed.add(Pair("CHANGES TotalDailyDose", database.totalDailyDoseDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("CHANGES Carbs", database.carbsDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("CHANGES TemporaryTarget", database.temporaryTargetDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("CHANGES ApsResultLink", database.apsResultLinkDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("CHANGES BolusCalculatorResult", database.bolusCalculatorResultDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("CHANGES EffectiveProfileSwitch", database.effectiveProfileSwitchDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("CHANGES ProfileSwitch", database.profileSwitchDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("CHANGES ApsResult", database.apsResultDao.deleteTrackedChanges()))
|
||||
// keep food database.foodDao.deleteHistory()
|
||||
removed.add(Pair("OfflineEvent", database.offlineEventDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("HeartRate", database.heartRateDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("CHANGES OfflineEvent", database.offlineEventDao.deleteTrackedChanges()))
|
||||
removed.add(Pair("CHANGES HeartRate", database.heartRateDao.deleteTrackedChanges()))
|
||||
}
|
||||
val ret = StringBuilder()
|
||||
removed
|
||||
|
|
|
@ -179,7 +179,7 @@ class ProfileFunctionImpl @Inject constructor(
|
|||
override fun createProfileSwitch(durationInMinutes: Int, percentage: Int, timeShiftInHours: Int): Boolean {
|
||||
val profile = repository.getPermanentProfileSwitch(dateUtil.now()) ?: return false
|
||||
val profileStore = activePlugin.activeProfileSource.profile ?: return false
|
||||
val ps = buildProfileSwitch(profileStore, profile.profileName, durationInMinutes, percentage, 0, dateUtil.now()) ?: return false
|
||||
val ps = buildProfileSwitch(profileStore, profile.profileName, durationInMinutes, percentage, timeShiftInHours, dateUtil.now()) ?: return false
|
||||
val validity = ProfileSealed.PS(ps).isValid(
|
||||
rh.gs(app.aaps.core.ui.R.string.careportal_profileswitch),
|
||||
activePlugin.activePump,
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
<string name="smb_disabled_in_preferences">SMB מושבת בהעדפות</string>
|
||||
<string name="uam_disabled_in_preferences">UAM מושבת בהעדפות</string>
|
||||
<string name="autosens_disabled_in_preferences">Autosens מושבת בהעדפות</string>
|
||||
<string name="autosens_disabled_in_dyn_isf">אוטוסנס כבוי ברגישות דינאמית</string>
|
||||
<!-- Verify if needed in safety-->
|
||||
<string name="limiting_iob">הגבלת IOB ל-%1$.1f יח\' בגלל %2$s</string>
|
||||
<string name="maxvalueinpreferences">ערך מקסימלי בהעדפות</string>
|
||||
|
@ -114,4 +115,5 @@
|
|||
<string name="loop_smb_set_by_pump_label">SMB מוגדר באמצעות משאבה</string>
|
||||
<string name="loop_open_mode_min_change">מינימום לבקשה לשינוי [%]</string>
|
||||
<string name="loop_open_mode_min_change_summary" formatted="false">\"לולאה פתוחה\" תציג בקשת שינוי חדשה רק אם השינוי גדול מערך זה ב-%. ערך ברירת המחדל הוא 20%</string>
|
||||
<string name="fallback_smb_no_tdd">חוזר ל-SMB, אין מספיק נתוני מינון יומי.</string>
|
||||
</resources>
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
<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="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-->
|
||||
<string name="limiting_iob">Ribojamas AIO iki %1$.1f V dėl %2$s</string>
|
||||
<string name="maxvalueinpreferences">Maksimali reikšmė nustatymuose</string>
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
<string name="smb_disabled_in_preferences">Супер микро болюс SMB отключен в настройках</string>
|
||||
<string name="uam_disabled_in_preferences">Непредвиденный прием пищи UAM отключен в настройках</string>
|
||||
<string name="autosens_disabled_in_preferences">Автоматический подбор чувствительности Autosens отключен в настройках</string>
|
||||
<string name="autosens_disabled_in_dyn_isf">Autosens отключён в DynISF</string>
|
||||
<!-- Verify if needed in safety-->
|
||||
<string name="limiting_iob">Ограничение активного инсулина IOB до %1$.1f ед. из-за %2$s</string>
|
||||
<string name="maxvalueinpreferences">максимальное значение в настройках</string>
|
||||
|
|
|
@ -83,6 +83,7 @@
|
|||
<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="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-->
|
||||
<string name="limiting_iob">IOB obmedzený na %1$.1f JI: %2$s</string>
|
||||
<string name="maxvalueinpreferences">maximálna hodnota v nastaveniach</string>
|
||||
|
|
|
@ -113,7 +113,7 @@
|
|||
<string name="add_automation">Legg til regel</string>
|
||||
<string name="stop_processing">Stopp prosessering</string>
|
||||
<!-- Reminders-->
|
||||
<string name="time_to_eat">Nå må du spise!\nBruk bolusveiviser 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_eat">Nå må du spise!\nBruk boluskalkulator 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>
|
||||
</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.TriggerDummy
|
||||
import app.aaps.shared.tests.TestBase
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mock
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class AutomationEventTest : TestBase() {
|
||||
|
||||
|
@ -40,8 +41,7 @@ class AutomationEventTest : TestBase() {
|
|||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun testCloneEvent() {
|
||||
@Test fun testCloneEvent() {
|
||||
// create test object
|
||||
val event = AutomationEventObject(injector)
|
||||
event.title = "Test"
|
||||
|
@ -51,33 +51,32 @@ class AutomationEventTest : TestBase() {
|
|||
// export to json
|
||||
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}"
|
||||
Assertions.assertEquals(eventJsonExpected, event.toJSON())
|
||||
JSONAssert.assertEquals(eventJsonExpected, event.toJSON(), true)
|
||||
|
||||
// clone
|
||||
val clone = AutomationEventObject(injector).fromJSON(eventJsonExpected, 1)
|
||||
|
||||
// check title
|
||||
Assertions.assertEquals(event.title, clone.title)
|
||||
assertThat(clone.title).isEqualTo(event.title)
|
||||
|
||||
// check trigger
|
||||
Assertions.assertNotNull(clone.trigger)
|
||||
Assertions.assertFalse(event.trigger === clone.trigger) // not the same object reference
|
||||
Assertions.assertEquals(event.trigger.javaClass, clone.trigger.javaClass)
|
||||
Assertions.assertEquals(event.trigger.toJSON(), clone.trigger.toJSON())
|
||||
assertThat(clone.trigger).isNotNull()
|
||||
assertThat(event.trigger).isNotSameInstanceAs(clone.trigger)
|
||||
assertThat(event.trigger.javaClass).isNotInstanceOf(clone.trigger.javaClass)
|
||||
JSONAssert.assertEquals(event.trigger.toJSON(), clone.trigger.toJSON(), true)
|
||||
|
||||
// check action
|
||||
Assertions.assertEquals(1, clone.actions.size)
|
||||
Assertions.assertFalse(event.actions === clone.actions) // not the same object reference
|
||||
Assertions.assertEquals(clone.toJSON(), clone.toJSON())
|
||||
assertThat(clone.actions).hasSize(1)
|
||||
assertThat(event.actions).isNotSameInstanceAs(clone.actions)
|
||||
JSONAssert.assertEquals(clone.toJSON(), clone.toJSON(), true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun hasStopProcessing() {
|
||||
@Test fun hasStopProcessing() {
|
||||
val event = AutomationEventObject(injector)
|
||||
event.title = "Test"
|
||||
event.trigger = TriggerDummy(injector).instantiate(JSONObject(TriggerConnectorTest().oneItem)) as TriggerConnector
|
||||
Assertions.assertFalse(event.hasStopProcessing())
|
||||
assertThat(event.hasStopProcessing()).isFalse()
|
||||
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.shared.impl.utils.DateUtilImpl
|
||||
import app.aaps.shared.tests.TestBase
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.ArgumentMatchers.anyInt
|
||||
|
@ -63,10 +63,10 @@ class BolusTimerImplTest : TestBase() {
|
|||
|
||||
@Test
|
||||
fun doTest() {
|
||||
Assertions.assertEquals(0, automationPlugin.size())
|
||||
assertThat(automationPlugin.size()).isEqualTo(0)
|
||||
automationPlugin.scheduleAutomationEventBolusReminder()
|
||||
Assertions.assertEquals(1, automationPlugin.size())
|
||||
assertThat(automationPlugin.size()).isEqualTo(1)
|
||||
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.shared.impl.utils.DateUtilImpl
|
||||
import app.aaps.shared.tests.TestBase
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.ArgumentMatchers.any
|
||||
|
@ -52,27 +52,24 @@ class CarbTimerImplTest : TestBase() {
|
|||
|
||||
private lateinit var automationPlugin: AutomationPlugin
|
||||
|
||||
@BeforeEach
|
||||
fun init() {
|
||||
@BeforeEach fun init() {
|
||||
Mockito.`when`(rh.gs(anyInt())).thenReturn("")
|
||||
Mockito.`when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL)
|
||||
dateUtil = DateUtilImpl(context)
|
||||
timerUtil = TimerUtil(context)
|
||||
automationPlugin = AutomationPlugin(
|
||||
injector, rh, context, sp, fabricPrivacy, loop, rxBus, constraintChecker, aapsLogger, aapsSchedulers, config, locationServiceHelper, dateUtil,
|
||||
activePlugin, timerUtil
|
||||
injector, rh, context, sp, fabricPrivacy, loop, rxBus, constraintChecker, aapsLogger, aapsSchedulers, config, locationServiceHelper, dateUtil, activePlugin, timerUtil
|
||||
)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun doTest() {
|
||||
Assertions.assertEquals(0, automationPlugin.size())
|
||||
@Test fun doTest() {
|
||||
assertThat(automationPlugin.size()).isEqualTo(0)
|
||||
automationPlugin.scheduleAutomationEventEatReminder()
|
||||
Assertions.assertEquals(1, automationPlugin.size())
|
||||
assertThat(automationPlugin.size()).isEqualTo(1)
|
||||
automationPlugin.removeAutomationEventEatReminder()
|
||||
Assertions.assertEquals(0, automationPlugin.size())
|
||||
assertThat(automationPlugin.size()).isEqualTo(0)
|
||||
|
||||
automationPlugin.scheduleTimeToEatReminder(1)
|
||||
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.TriggerDummy
|
||||
import app.aaps.shared.tests.TestBase
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class ComposeTriggerTest : TestBase() {
|
||||
|
||||
var injector: HasAndroidInjector = HasAndroidInjector { AndroidInjector { } }
|
||||
val injector: HasAndroidInjector = HasAndroidInjector { AndroidInjector { } }
|
||||
|
||||
@Test fun testTriggerList() {
|
||||
val root = TriggerConnector(injector)
|
||||
|
@ -23,16 +23,11 @@ class ComposeTriggerTest : TestBase() {
|
|||
root.list.add(t1)
|
||||
val t2: Trigger = TriggerDummy(injector)
|
||||
root.list.add(t2)
|
||||
Assertions.assertEquals(3, root.size())
|
||||
Assertions.assertEquals(t0, root.list[0])
|
||||
Assertions.assertEquals(t1, root.list[1])
|
||||
Assertions.assertEquals(t2, root.list[2])
|
||||
assertThat(root.list).containsExactly(t0, t1, t2).inOrder()
|
||||
|
||||
// remove a trigger
|
||||
root.list.remove(t1)
|
||||
Assertions.assertEquals(2, root.size())
|
||||
Assertions.assertEquals(t0, root.list[0])
|
||||
Assertions.assertEquals(t2, root.list[1])
|
||||
assertThat(root.list).containsExactly(t0, t2).inOrder()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -44,6 +39,6 @@ class ComposeTriggerTest : TestBase() {
|
|||
t[i] = TriggerDummy(injector)
|
||||
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.ui.TimerUtil
|
||||
import app.aaps.shared.tests.TestBase
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.ArgumentMatchers
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class ActionAlarmTest : TestBase() {
|
||||
|
||||
|
@ -54,39 +55,39 @@ class ActionAlarmTest : TestBase() {
|
|||
}
|
||||
|
||||
@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() {
|
||||
sut.text = InputString("Asd")
|
||||
Assertions.assertEquals("Alarm: %s", sut.shortDescription())
|
||||
assertThat(sut.shortDescription()).isEqualTo("Alarm: %s")
|
||||
}
|
||||
|
||||
@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() {
|
||||
sut.text = InputString("Asd")
|
||||
sut.doAction(object : Callback() {
|
||||
override fun run() {
|
||||
Assertions.assertTrue(result.success)
|
||||
assertThat(result.success).isTrue()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@Test fun hasDialogTest() {
|
||||
Assertions.assertTrue(sut.hasDialog())
|
||||
assertThat(sut.hasDialog()).isTrue()
|
||||
}
|
||||
|
||||
@Test fun toJSONTest() {
|
||||
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() {
|
||||
sut.text = InputString("Asd")
|
||||
sut.fromJSON("{\"text\":\"Asd\"}")
|
||||
Assertions.assertEquals("Asd", sut.text.value)
|
||||
sut.fromJSON("""{"text":"Asd"}""")
|
||||
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.InputString
|
||||
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.Test
|
||||
import org.mockito.ArgumentMatchers
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class ActionCarePortalEventTest : ActionsTestBase() {
|
||||
|
||||
|
@ -35,41 +36,42 @@ class ActionCarePortalEventTest : ActionsTestBase() {
|
|||
}
|
||||
|
||||
@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() {
|
||||
Assertions.assertEquals("Note : Asd", sut.shortDescription())
|
||||
assertThat(sut.shortDescription()).isEqualTo("Note : Asd")
|
||||
}
|
||||
|
||||
@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() {
|
||||
sut.doAction(object : Callback() {
|
||||
override fun run() {
|
||||
Assertions.assertTrue(result.success)
|
||||
assertThat(result.success).isTrue()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@Test fun hasDialogTest() {
|
||||
Assertions.assertTrue(sut.hasDialog())
|
||||
assertThat(sut.hasDialog()).isTrue()
|
||||
}
|
||||
|
||||
@Test fun toJSONTest() {
|
||||
Assertions.assertEquals(
|
||||
"{\"data\":{\"note\":\"Asd\",\"cpEvent\":\"NOTE\",\"durationInMinutes\":5},\"type\":\"ActionCarePortalEvent\"}",
|
||||
sut.toJSON()
|
||||
JSONAssert.assertEquals(
|
||||
"""{"data":{"note":"Asd","cpEvent":"NOTE","durationInMinutes":5},"type":"ActionCarePortalEvent"}""",
|
||||
sut.toJSON(),
|
||||
true,
|
||||
)
|
||||
}
|
||||
|
||||
@Test fun fromJSONTest() {
|
||||
sut.note = InputString("Asd")
|
||||
sut.fromJSON("{\"note\":\"Asd\",\"cpEvent\":\"NOTE\",\"durationInMinutes\":5}")
|
||||
Assertions.assertEquals("Asd", sut.note.value)
|
||||
Assertions.assertEquals(5, sut.duration.value)
|
||||
Assertions.assertEquals(InputCarePortalMenu.EventType.NOTE, sut.cpEvent.value)
|
||||
sut.fromJSON("""{"note":"Asd","cpEvent":"NOTE","durationInMinutes":5}""")
|
||||
assertThat(sut.note.value).isEqualTo("Asd")
|
||||
assertThat(sut.duration.value).isEqualTo(5)
|
||||
assertThat(sut.cpEvent.value).isEqualTo(InputCarePortalMenu.EventType.NOTE)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,20 +1,20 @@
|
|||
package app.aaps.plugins.automation.actions
|
||||
|
||||
import kotlin.test.assertIs
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class ActionDummyTest : ActionsTestBase() {
|
||||
|
||||
@Test
|
||||
fun instantiateTest() {
|
||||
var action: Action? = ActionDummy(injector).instantiate(JSONObject("{\"type\":\"info.nightscout.androidaps.plugins.general.automation.actions.ActionDummy\"}"))
|
||||
Assertions.assertTrue(action is ActionDummy)
|
||||
var action: Action? = ActionDummy(injector).instantiate(JSONObject("""{"type":"info.nightscout.androidaps.plugins.general.automation.actions.ActionDummy"}"""))
|
||||
assertIs<ActionDummy>(action)
|
||||
|
||||
action = ActionDummy(injector).instantiate(JSONObject("{\"type\":\"app.aaps.plugins.automation.actions.ActionDummy\"}"))
|
||||
Assertions.assertTrue(action is ActionDummy)
|
||||
action = ActionDummy(injector).instantiate(JSONObject("""{"type":"app.aaps.plugins.automation.actions.ActionDummy"}"""))
|
||||
assertIs<ActionDummy>(action)
|
||||
|
||||
action = ActionDummy(injector).instantiate(JSONObject("{\"type\":\"ActionDummy\"}"))
|
||||
Assertions.assertTrue(action is ActionDummy)
|
||||
action = ActionDummy(injector).instantiate(JSONObject("""{"type":"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.queue.Callback
|
||||
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.Test
|
||||
import org.mockito.ArgumentMatchers.eq
|
||||
|
@ -27,17 +27,17 @@ class ActionLoopDisableTest : ActionsTestBase() {
|
|||
|
||||
@Test
|
||||
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
|
||||
fun shortDescriptionTest() {
|
||||
Assertions.assertEquals("Disable loop", sut.shortDescription())
|
||||
assertThat(sut.shortDescription()).isEqualTo("Disable loop")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconTest() {
|
||||
Assertions.assertEquals(R.drawable.ic_stop_24dp, sut.icon())
|
||||
assertThat(sut.icon()).isEqualTo(R.drawable.ic_stop_24dp)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -60,4 +60,4 @@ class ActionLoopDisableTest : ActionsTestBase() {
|
|||
Mockito.verify(configBuilder, Mockito.times(1)).storeSettings("ActionLoopDisable")
|
||||
Mockito.verify(commandQueue, Mockito.times(1)).cancelTempBasal(eq(true), anyObject())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package app.aaps.plugins.automation.actions
|
|||
import app.aaps.core.interfaces.plugin.PluginType
|
||||
import app.aaps.core.interfaces.queue.Callback
|
||||
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.Test
|
||||
import org.mockito.Mockito
|
||||
|
@ -24,15 +24,15 @@ class ActionLoopEnableTest : ActionsTestBase() {
|
|||
}
|
||||
|
||||
@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() {
|
||||
Assertions.assertEquals("Enable loop", sut.shortDescription())
|
||||
assertThat(sut.shortDescription()).isEqualTo("Enable loop")
|
||||
}
|
||||
|
||||
@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() {
|
||||
|
@ -52,4 +52,4 @@ class ActionLoopEnableTest : ActionsTestBase() {
|
|||
Mockito.verify(loopPlugin, Mockito.times(1)).setPluginEnabled(PluginType.LOOP, true)
|
||||
Mockito.verify(configBuilder, Mockito.times(1)).storeSettings("ActionLoopEnable")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,7 @@ import app.aaps.database.impl.transactions.CancelCurrentOfflineEventIfAnyTransac
|
|||
import app.aaps.database.impl.transactions.Transaction
|
||||
import app.aaps.plugins.automation.R
|
||||
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.Test
|
||||
import org.mockito.Mockito.`when`
|
||||
|
@ -25,15 +25,15 @@ class ActionLoopResumeTest : ActionsTestBase() {
|
|||
}
|
||||
|
||||
@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() {
|
||||
Assertions.assertEquals("Resume loop", sut.shortDescription())
|
||||
assertThat(sut.shortDescription()).isEqualTo("Resume loop")
|
||||
}
|
||||
|
||||
@Test fun iconTest() {
|
||||
Assertions.assertEquals(R.drawable.ic_replay_24dp, sut.icon())
|
||||
assertThat(sut.icon()).isEqualTo(R.drawable.ic_replay_24dp)
|
||||
}
|
||||
|
||||
@Test fun doActionTest() {
|
||||
|
@ -64,4 +64,4 @@ class ActionLoopResumeTest : ActionsTestBase() {
|
|||
})
|
||||
//Mockito.verify(loopPlugin, Mockito.times(1)).suspendTo(0)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package app.aaps.plugins.automation.actions
|
|||
import app.aaps.core.interfaces.queue.Callback
|
||||
import app.aaps.plugins.automation.R
|
||||
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.Test
|
||||
import org.mockito.Mockito
|
||||
|
@ -24,16 +24,16 @@ class ActionLoopSuspendTest : ActionsTestBase() {
|
|||
}
|
||||
|
||||
@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() {
|
||||
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() {
|
||||
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() {
|
||||
|
@ -57,11 +57,11 @@ class ActionLoopSuspendTest : ActionsTestBase() {
|
|||
a.minutes = InputDuration(20, InputDuration.TimeUnit.MINUTES)
|
||||
val b = ActionLoopSuspend(injector)
|
||||
b.apply(a)
|
||||
Assertions.assertEquals(20, b.minutes.getMinutes().toLong())
|
||||
assertThat(b.minutes.getMinutes().toLong()).isEqualTo(20)
|
||||
}
|
||||
|
||||
@Test fun hasDialogTest() {
|
||||
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.HasAndroidInjector
|
||||
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.Test
|
||||
import org.mockito.ArgumentMatchers
|
||||
import org.mockito.Mock
|
||||
import org.mockito.Mockito
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class ActionNotificationTest : TestBase() {
|
||||
|
||||
|
@ -60,22 +61,22 @@ class ActionNotificationTest : TestBase() {
|
|||
}
|
||||
|
||||
@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() {
|
||||
sut.text = InputString("Asd")
|
||||
Assertions.assertEquals("Notification: %s", sut.shortDescription())
|
||||
assertThat(sut.shortDescription()).isEqualTo("Notification: %s")
|
||||
}
|
||||
|
||||
@Test fun iconTest() {
|
||||
Assertions.assertEquals(R.drawable.ic_notifications, sut.icon())
|
||||
assertThat(sut.icon()).isEqualTo(R.drawable.ic_notifications)
|
||||
}
|
||||
|
||||
@Test fun doActionTest() {
|
||||
sut.doAction(object : Callback() {
|
||||
override fun run() {
|
||||
Assertions.assertTrue(result.success)
|
||||
assertThat(result.success).isTrue()
|
||||
}
|
||||
})
|
||||
Mockito.verify(rxBusMocked, Mockito.times(2)).send(anyObject())
|
||||
|
@ -83,20 +84,21 @@ class ActionNotificationTest : TestBase() {
|
|||
}
|
||||
|
||||
@Test fun hasDialogTest() {
|
||||
Assertions.assertTrue(sut.hasDialog())
|
||||
assertThat(sut.hasDialog())
|
||||
}
|
||||
|
||||
@Test fun toJSONTest() {
|
||||
sut.text = InputString("Asd")
|
||||
Assertions.assertEquals(
|
||||
"{\"data\":{\"text\":\"Asd\"},\"type\":\"ActionNotification\"}",
|
||||
sut.toJSON()
|
||||
JSONAssert.assertEquals(
|
||||
"""{"data":{"text":"Asd"},"type":"ActionNotification"}""",
|
||||
sut.toJSON(),
|
||||
true,
|
||||
)
|
||||
}
|
||||
|
||||
@Test fun fromJSONTest() {
|
||||
sut.text = InputString("Asd")
|
||||
sut.fromJSON("{\"text\":\"Asd\"}")
|
||||
Assertions.assertEquals("Asd", sut.text.value)
|
||||
sut.fromJSON("""{"text":"Asd"}""")
|
||||
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.elements.InputDuration
|
||||
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.Test
|
||||
import org.mockito.Mockito
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class ActionProfileSwitchPercentTest : ActionsTestBase() {
|
||||
|
||||
|
@ -24,17 +25,17 @@ class ActionProfileSwitchPercentTest : ActionsTestBase() {
|
|||
}
|
||||
|
||||
@Test fun friendlyNameTest() {
|
||||
Assertions.assertEquals(R.string.profilepercentage, sut.friendlyName())
|
||||
assertThat(sut.friendlyName()).isEqualTo(R.string.profilepercentage)
|
||||
}
|
||||
|
||||
@Test fun shortDescriptionTest() {
|
||||
sut.pct = InputPercent(100.0)
|
||||
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() {
|
||||
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() {
|
||||
|
@ -43,25 +44,25 @@ class ActionProfileSwitchPercentTest : ActionsTestBase() {
|
|||
sut.duration = InputDuration(30, InputDuration.TimeUnit.MINUTES)
|
||||
sut.doAction(object : Callback() {
|
||||
override fun run() {
|
||||
Assertions.assertTrue(result.success)
|
||||
assertThat(result.success).isTrue()
|
||||
}
|
||||
})
|
||||
Mockito.verify(profileFunction, Mockito.times(1)).createProfileSwitch(30, 110, 0)
|
||||
}
|
||||
|
||||
@Test fun hasDialogTest() {
|
||||
Assertions.assertTrue(sut.hasDialog())
|
||||
assertThat(sut.hasDialog()).isTrue()
|
||||
}
|
||||
|
||||
@Test fun toJSONTest() {
|
||||
sut.pct = InputPercent(100.0)
|
||||
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() {
|
||||
sut.fromJSON("{\"percentage\":100,\"durationInMinutes\":30}")
|
||||
Assertions.assertEquals(100.0, sut.pct.value, 0.001)
|
||||
Assertions.assertEquals(30.0, sut.duration.getMinutes().toDouble(), 0.001)
|
||||
sut.fromJSON("""{"percentage":100,"durationInMinutes":30}""")
|
||||
assertThat(sut.pct.value).isWithin(0.001).of(100.0)
|
||||
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.plugins.automation.R
|
||||
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.Test
|
||||
import org.mockito.ArgumentMatchers.anyLong
|
||||
|
@ -11,13 +11,14 @@ import org.mockito.Mockito
|
|||
import org.mockito.Mockito.anyInt
|
||||
import org.mockito.Mockito.anyString
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
private const val STRING_JSON = """{"data":{"profileToSwitchTo":"Test"},"type":"ActionProfileSwitch"}"""
|
||||
|
||||
class ActionProfileSwitchTest : ActionsTestBase() {
|
||||
|
||||
private lateinit var sut: ActionProfileSwitch
|
||||
|
||||
private val stringJson = "{\"data\":{\"profileToSwitchTo\":\"Test\"},\"type\":\"ActionProfileSwitch\"}"
|
||||
|
||||
@BeforeEach fun setUp() {
|
||||
`when`(rh.gs(R.string.profilename)).thenReturn("Change profile to")
|
||||
`when`(rh.gs(R.string.changengetoprofilename)).thenReturn("Change profile to %s")
|
||||
|
@ -30,11 +31,11 @@ class ActionProfileSwitchTest : ActionsTestBase() {
|
|||
}
|
||||
|
||||
@Test fun friendlyName() {
|
||||
Assertions.assertEquals(R.string.profilename, sut.friendlyName())
|
||||
assertThat(sut.friendlyName()).isEqualTo(R.string.profilename)
|
||||
}
|
||||
|
||||
@Test fun shortDescriptionTest() {
|
||||
Assertions.assertEquals("Change profile to ", sut.shortDescription())
|
||||
assertThat(sut.shortDescription()).isEqualTo("Change profile to ")
|
||||
}
|
||||
|
||||
@Test fun doAction() {
|
||||
|
@ -43,7 +44,7 @@ class ActionProfileSwitchTest : ActionsTestBase() {
|
|||
sut.inputProfileName = InputProfileName(rh, activePlugin, "")
|
||||
sut.doAction(object : Callback() {
|
||||
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.doAction(object : Callback() {
|
||||
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.doAction(object : Callback() {
|
||||
override fun run() {
|
||||
Assertions.assertTrue(result.success)
|
||||
Assertions.assertEquals("Already set", result.comment)
|
||||
assertThat(result.success).isTrue()
|
||||
assertThat(result.comment).isEqualTo("Already set")
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -72,8 +73,8 @@ class ActionProfileSwitchTest : ActionsTestBase() {
|
|||
sut.inputProfileName = InputProfileName(rh, activePlugin, "Test")
|
||||
sut.doAction(object : Callback() {
|
||||
override fun run() {
|
||||
Assertions.assertFalse(result.success)
|
||||
Assertions.assertEquals("not exists", result.comment)
|
||||
assertThat(result.success).isFalse()
|
||||
assertThat(result.comment).isEqualTo("not exists")
|
||||
}
|
||||
})
|
||||
|
||||
|
@ -83,29 +84,28 @@ class ActionProfileSwitchTest : ActionsTestBase() {
|
|||
sut.inputProfileName = InputProfileName(rh, activePlugin, TESTPROFILENAME)
|
||||
sut.doAction(object : Callback() {
|
||||
override fun run() {
|
||||
Assertions.assertTrue(result.success)
|
||||
Assertions.assertEquals("OK", result.comment)
|
||||
assertThat(result.success).isTrue()
|
||||
assertThat(result.comment).isEqualTo("OK")
|
||||
}
|
||||
})
|
||||
Mockito.verify(profileFunction, Mockito.times(1)).createProfileSwitch(anyObject(), anyString(), anyInt(), anyInt(), anyInt(), anyLong())
|
||||
}
|
||||
|
||||
@Test fun hasDialogTest() {
|
||||
Assertions.assertTrue(sut.hasDialog())
|
||||
assertThat(sut.hasDialog()).isTrue()
|
||||
}
|
||||
|
||||
@Test fun toJSONTest() {
|
||||
sut.inputProfileName = InputProfileName(rh, activePlugin, "Test")
|
||||
Assertions.assertEquals(stringJson, sut.toJSON())
|
||||
JSONAssert.assertEquals(STRING_JSON, sut.toJSON(), true)
|
||||
}
|
||||
|
||||
@Test fun fromJSONTest() {
|
||||
val data = "{\"profileToSwitchTo\":\"Test\"}"
|
||||
sut.fromJSON(data)
|
||||
Assertions.assertEquals("Test", sut.inputProfileName.value)
|
||||
sut.fromJSON("""{"profileToSwitchTo":"Test"}""")
|
||||
assertThat(sut.inputProfileName.value).isEqualTo("Test")
|
||||
}
|
||||
|
||||
@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.plugins.automation.R
|
||||
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.Test
|
||||
import org.mockito.ArgumentMatchers.anyString
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class ActionSendSMSTest : ActionsTestBase() {
|
||||
|
||||
|
@ -23,15 +24,15 @@ class ActionSendSMSTest : ActionsTestBase() {
|
|||
}
|
||||
|
||||
@Test fun friendlyNameTest() {
|
||||
Assertions.assertEquals(R.string.sendsmsactiondescription, sut.friendlyName())
|
||||
assertThat(sut.friendlyName()).isEqualTo(R.string.sendsmsactiondescription)
|
||||
}
|
||||
|
||||
@Test fun shortDescriptionTest() {
|
||||
Assertions.assertEquals("Send SMS: ", sut.shortDescription())
|
||||
assertThat(sut.shortDescription()).isEqualTo("Send SMS: ")
|
||||
}
|
||||
|
||||
@Test fun iconTest() {
|
||||
Assertions.assertEquals(R.drawable.ic_notifications, sut.icon())
|
||||
assertThat(sut.icon()).isEqualTo(R.drawable.ic_notifications)
|
||||
}
|
||||
|
||||
@Test fun doActionTest() {
|
||||
|
@ -39,22 +40,22 @@ class ActionSendSMSTest : ActionsTestBase() {
|
|||
sut.text = InputString("Asd")
|
||||
sut.doAction(object : Callback() {
|
||||
override fun run() {
|
||||
Assertions.assertTrue(result.success)
|
||||
assertThat(result.success).isTrue()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
@Test fun hasDialogTest() {
|
||||
Assertions.assertTrue(sut.hasDialog())
|
||||
assertThat(sut.hasDialog()).isTrue()
|
||||
}
|
||||
|
||||
@Test fun toJSONTest() {
|
||||
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() {
|
||||
sut.fromJSON("{\"text\":\"Asd\"}")
|
||||
Assertions.assertEquals("Asd", sut.text.value)
|
||||
sut.fromJSON("""{"text":"Asd"}""")
|
||||
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.InputTempTarget
|
||||
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.Test
|
||||
import org.mockito.Mockito
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class ActionStartTempTargetTest : ActionsTestBase() {
|
||||
|
||||
|
@ -27,18 +28,18 @@ class ActionStartTempTargetTest : ActionsTestBase() {
|
|||
}
|
||||
|
||||
@Test fun friendlyNameTest() {
|
||||
Assertions.assertEquals(R.string.starttemptarget, sut.friendlyName())
|
||||
assertThat(sut.friendlyName()).isEqualTo(R.string.starttemptarget)
|
||||
}
|
||||
|
||||
@Test fun shortDescriptionTest() {
|
||||
sut.value = InputTempTarget(profileFunction)
|
||||
sut.value.value = 100.0
|
||||
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() {
|
||||
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() {
|
||||
|
@ -78,27 +79,27 @@ class ActionStartTempTargetTest : ActionsTestBase() {
|
|||
|
||||
sut.doAction(object : Callback() {
|
||||
override fun run() {
|
||||
Assertions.assertTrue(result.success)
|
||||
assertThat(result.success).isTrue()
|
||||
}
|
||||
})
|
||||
Mockito.verify(repository, Mockito.times(1)).runTransactionForResult(anyObject<Transaction<InsertAndCancelCurrentTemporaryTargetTransaction.TransactionResult>>())
|
||||
}
|
||||
|
||||
@Test fun hasDialogTest() {
|
||||
Assertions.assertTrue(sut.hasDialog())
|
||||
assertThat(sut.hasDialog()).isTrue()
|
||||
}
|
||||
|
||||
@Test fun toJSONTest() {
|
||||
sut.value = InputTempTarget(profileFunction)
|
||||
sut.value.value = 100.0
|
||||
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() {
|
||||
sut.fromJSON("{\"value\":100,\"durationInMinutes\":30,\"units\":\"mg/dl\"}")
|
||||
Assertions.assertEquals(GlucoseUnit.MGDL, sut.value.units)
|
||||
Assertions.assertEquals(100.0, sut.value.value, 0.001)
|
||||
Assertions.assertEquals(30.0, sut.duration.getMinutes().toDouble(), 0.001)
|
||||
sut.fromJSON("""{"value":100,"durationInMinutes":30,"units":"mg/dl"}""")
|
||||
assertThat(sut.value.units).isEqualTo(GlucoseUnit.MGDL)
|
||||
assertThat(sut.value.value).isWithin(0.001).of(100.0)
|
||||
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.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.Test
|
||||
import org.mockito.Mockito.`when`
|
||||
|
@ -20,25 +20,25 @@ class ActionStopProcessingTest : ActionsTestBase() {
|
|||
|
||||
@Test
|
||||
fun friendlyNameTest() {
|
||||
Assertions.assertEquals(R.string.stop_processing, sut.friendlyName())
|
||||
assertThat(sut.friendlyName()).isEqualTo(R.string.stop_processing)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun shortDescriptionTest() {
|
||||
Assertions.assertEquals("Stop processing", sut.shortDescription())
|
||||
assertThat(sut.shortDescription()).isEqualTo("Stop processing")
|
||||
}
|
||||
|
||||
@Test
|
||||
fun iconTest() {
|
||||
Assertions.assertEquals(R.drawable.ic_stop_24dp, sut.icon())
|
||||
assertThat(sut.icon()).isEqualTo(R.drawable.ic_stop_24dp)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun doActionTest() {
|
||||
sut.doAction(object : Callback() {
|
||||
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.plugins.automation.R
|
||||
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.Test
|
||||
import org.mockito.Mockito
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class ActionStopTempTargetTest : ActionsTestBase() {
|
||||
|
||||
|
@ -24,15 +25,15 @@ class ActionStopTempTargetTest : ActionsTestBase() {
|
|||
}
|
||||
|
||||
@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() {
|
||||
Assertions.assertEquals("Stop temp target", sut.shortDescription())
|
||||
assertThat(sut.shortDescription()).isEqualTo("Stop temp target")
|
||||
}
|
||||
|
||||
@Test fun iconTest() {
|
||||
Assertions.assertEquals(R.drawable.ic_stop_24dp, sut.icon())
|
||||
assertThat(sut.icon()).isEqualTo(R.drawable.ic_stop_24dp)
|
||||
}
|
||||
|
||||
@Test fun doActionTest() {
|
||||
|
@ -52,22 +53,22 @@ class ActionStopTempTargetTest : ActionsTestBase() {
|
|||
|
||||
sut.doAction(object : Callback() {
|
||||
override fun run() {
|
||||
Assertions.assertTrue(result.success)
|
||||
assertThat(result.success).isTrue()
|
||||
}
|
||||
})
|
||||
Mockito.verify(repository, Mockito.times(1)).runTransactionForResult((anyObject<Transaction<CancelCurrentTemporaryTargetIfAnyTransaction.TransactionResult>>()))
|
||||
}
|
||||
|
||||
@Test fun hasDialogTest() {
|
||||
Assertions.assertFalse(sut.hasDialog())
|
||||
assertThat(sut.hasDialog()).isFalse()
|
||||
}
|
||||
|
||||
@Test fun toJSONTest() {
|
||||
Assertions.assertEquals("{\"type\":\"ActionStopTempTarget\"}", sut.toJSON())
|
||||
JSONAssert.assertEquals("""{"type":"ActionStopTempTarget"}""", sut.toJSON(), true)
|
||||
}
|
||||
|
||||
@Test fun fromJSONTest() {
|
||||
sut.fromJSON("{\"reason\":\"Test\"}")
|
||||
Assertions.assertNotNull(sut)
|
||||
sut.fromJSON("""{"reason":"Test"}""")
|
||||
assertThat(sut).isNotNull()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
package app.aaps.plugins.automation.elements
|
||||
|
||||
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
|
||||
|
||||
class ComparatorConnectTest : TriggerTestBase() {
|
||||
|
||||
@Test fun labelsTest() {
|
||||
Assertions.assertEquals(2, ComparatorConnect.Compare.labels(rh).size)
|
||||
assertThat(ComparatorConnect.Compare.labels(rh)).hasSize(2)
|
||||
}
|
||||
|
||||
@Test fun setValueTest() {
|
||||
val c = ComparatorConnect(rh)
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
class ComparatorExistsTest : TriggerTestBase() {
|
||||
|
||||
@Test fun labelsTest() {
|
||||
Assertions.assertEquals(2, ComparatorExists.Compare.labels(rh).size)
|
||||
assertThat(ComparatorExists.Compare.labels(rh)).hasSize(2)
|
||||
}
|
||||
|
||||
@Test fun setValueTest() {
|
||||
val c = ComparatorExists(rh)
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
class ComparatorTest : TriggerTestBase() {
|
||||
|
||||
@Test
|
||||
fun checkTest() {
|
||||
Assertions.assertTrue(Comparator.Compare.IS_EQUAL.check(1, 1))
|
||||
Assertions.assertTrue(Comparator.Compare.IS_LESSER.check(1, 2))
|
||||
Assertions.assertTrue(Comparator.Compare.IS_EQUAL_OR_LESSER.check(1, 2))
|
||||
Assertions.assertTrue(Comparator.Compare.IS_EQUAL_OR_LESSER.check(2, 2))
|
||||
Assertions.assertTrue(Comparator.Compare.IS_GREATER.check(2, 1))
|
||||
Assertions.assertTrue(Comparator.Compare.IS_EQUAL_OR_GREATER.check(2, 1))
|
||||
Assertions.assertTrue(Comparator.Compare.IS_EQUAL_OR_GREATER.check(2, 2))
|
||||
Assertions.assertFalse(Comparator.Compare.IS_LESSER.check(2, 1))
|
||||
Assertions.assertFalse(Comparator.Compare.IS_EQUAL_OR_LESSER.check(2, 1))
|
||||
Assertions.assertFalse(Comparator.Compare.IS_GREATER.check(1, 2))
|
||||
Assertions.assertFalse(Comparator.Compare.IS_EQUAL_OR_GREATER.check(1, 2))
|
||||
// Assertions.assertTrue(Comparator.Compare.IS_NOT_AVAILABLE.check<Int?>(1, null))
|
||||
assertThat(Comparator.Compare.IS_EQUAL.check(1, 1)).isTrue()
|
||||
assertThat(Comparator.Compare.IS_LESSER.check(1, 2)).isTrue()
|
||||
assertThat(Comparator.Compare.IS_EQUAL_OR_LESSER.check(1, 2)).isTrue()
|
||||
assertThat(Comparator.Compare.IS_EQUAL_OR_LESSER.check(2, 2)).isTrue()
|
||||
assertThat(Comparator.Compare.IS_GREATER.check(2, 1)).isTrue()
|
||||
assertThat(Comparator.Compare.IS_EQUAL_OR_GREATER.check(2, 1)).isTrue()
|
||||
assertThat(Comparator.Compare.IS_EQUAL_OR_GREATER.check(2, 2)).isTrue()
|
||||
assertThat(Comparator.Compare.IS_LESSER.check(2, 1)).isFalse()
|
||||
assertThat(Comparator.Compare.IS_EQUAL_OR_LESSER.check(2, 1)).isFalse()
|
||||
assertThat(Comparator.Compare.IS_GREATER.check(1, 2)).isFalse()
|
||||
assertThat(Comparator.Compare.IS_EQUAL_OR_GREATER.check(1, 2)).isFalse()
|
||||
// assertThat(Comparator.Compare.IS_NOT_AVAILABLE.check<Int?>(1, null)).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun labelsTest() {
|
||||
Assertions.assertEquals(6, Comparator.Compare.labels(rh).size)
|
||||
assertThat(Comparator.Compare.labels(rh)).hasSize(6)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun setValueTest() {
|
||||
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.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.Test
|
||||
import org.mockito.Mockito.`when`
|
||||
|
@ -12,16 +12,16 @@ class InputBgTest : TriggerTestBase() {
|
|||
@Test
|
||||
fun setValueTest() {
|
||||
var i: InputBg = InputBg(profileFunction).setUnits(GlucoseUnit.MMOL).setValue(5.0)
|
||||
Assertions.assertEquals(5.0, i.value, 0.01)
|
||||
Assertions.assertEquals(InputBg.MMOL_MIN, i.minValue, 0.01)
|
||||
assertThat(i.value).isWithin(0.01).of(5.0)
|
||||
assertThat(i.minValue).isWithin(0.01).of(InputBg.MMOL_MIN)
|
||||
i = InputBg(profileFunction).setValue(100.0).setUnits(GlucoseUnit.MGDL)
|
||||
Assertions.assertEquals(100.0, i.value, 0.01)
|
||||
Assertions.assertEquals(InputBg.MGDL_MIN, i.minValue, 0.01)
|
||||
Assertions.assertEquals(GlucoseUnit.MGDL, i.units)
|
||||
assertThat(i.value).isWithin(0.01).of(100.0)
|
||||
assertThat(i.minValue).isWithin(0.01).of(InputBg.MGDL_MIN)
|
||||
assertThat(i.units).isEqualTo(GlucoseUnit.MGDL)
|
||||
}
|
||||
|
||||
@BeforeEach
|
||||
fun prepare() {
|
||||
`when`(profileFunction.getUnits()).thenReturn(GlucoseUnit.MGDL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
package app.aaps.plugins.automation.elements
|
||||
|
||||
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
|
||||
|
||||
class InputCarePortalEventTest : TriggerTestBase() {
|
||||
|
||||
@Test
|
||||
fun labelsTest() {
|
||||
Assertions.assertEquals(4, InputCarePortalMenu.EventType.labels(rh).size)
|
||||
assertThat(InputCarePortalMenu.EventType.labels(rh)).hasSize(4)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun setValueTest() {
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
class InputDurationTest : TriggerTestBase() {
|
||||
|
||||
@Test fun setValueTest() {
|
||||
var i = InputDuration(5, InputDuration.TimeUnit.MINUTES)
|
||||
Assertions.assertEquals(5, i.value)
|
||||
Assertions.assertEquals(InputDuration.TimeUnit.MINUTES, i.unit)
|
||||
assertThat(i.value).isEqualTo(5)
|
||||
assertThat(i.unit).isEqualTo(InputDuration.TimeUnit.MINUTES)
|
||||
i = InputDuration(5, InputDuration.TimeUnit.HOURS)
|
||||
Assertions.assertEquals(5, i.value)
|
||||
Assertions.assertEquals(InputDuration.TimeUnit.HOURS, i.unit)
|
||||
Assertions.assertEquals(5 * 60, i.getMinutes())
|
||||
assertThat(i.value).isEqualTo(5)
|
||||
assertThat(i.unit).isEqualTo(InputDuration.TimeUnit.HOURS)
|
||||
assertThat(i.getMinutes()).isEqualTo(5 * 60)
|
||||
i.setMinutes(60)
|
||||
Assertions.assertEquals(1, i.value)
|
||||
assertThat(i.value).isEqualTo(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package app.aaps.plugins.automation.elements
|
||||
|
||||
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
|
||||
|
||||
class InputInsulinTest : TriggerTestBase() {
|
||||
|
@ -9,6 +9,6 @@ class InputInsulinTest : TriggerTestBase() {
|
|||
@Test fun setValueTest() {
|
||||
val i = InputInsulin()
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
class InputPercentTest : TriggerTestBase() {
|
||||
|
@ -9,6 +9,6 @@ class InputPercentTest : TriggerTestBase() {
|
|||
@Test fun setValueTest() {
|
||||
val i = InputPercent()
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
class InputProfileNameTest : TriggerTestBase() {
|
||||
|
||||
@Test fun setValue() {
|
||||
val inputProfileName = InputProfileName(rh, activePlugin, "Test")
|
||||
Assertions.assertEquals("Test", inputProfileName.value)
|
||||
assertThat(inputProfileName.value).isEqualTo("Test")
|
||||
inputProfileName.value = "Test2"
|
||||
Assertions.assertEquals("Test2", inputProfileName.value)
|
||||
assertThat(inputProfileName.value).isEqualTo("Test2")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package app.aaps.plugins.automation.elements
|
||||
|
||||
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
|
||||
|
||||
class InputStringTest : TriggerTestBase() {
|
||||
|
@ -9,6 +9,6 @@ class InputStringTest : TriggerTestBase() {
|
|||
@Test fun setValueTest() {
|
||||
val i = InputString()
|
||||
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.plugins.automation.triggers.TriggerTestBase
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class InputTempTargetTest : TriggerTestBase() {
|
||||
|
@ -11,10 +11,10 @@ class InputTempTargetTest : TriggerTestBase() {
|
|||
val i = InputTempTarget(profileFunction)
|
||||
i.units = GlucoseUnit.MMOL
|
||||
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.value = 100.0
|
||||
Assertions.assertEquals(100.0, i.value, 0.01)
|
||||
Assertions.assertEquals(GlucoseUnit.MGDL, i.units)
|
||||
assertThat(i.value).isWithin(0.01).of(100.0)
|
||||
assertThat(i.units).isEqualTo(GlucoseUnit.MGDL)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
package app.aaps.plugins.automation.elements
|
||||
|
||||
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 kotlin.test.assertIs
|
||||
|
||||
class LabelWithElementTest : TriggerTestBase() {
|
||||
|
||||
@Test
|
||||
fun constructorTest() {
|
||||
val l = LabelWithElement(rh, "A", "B", InputInsulin())
|
||||
Assertions.assertEquals("A", l.textPre)
|
||||
Assertions.assertEquals("B", l.textPost)
|
||||
Assertions.assertEquals(InputInsulin::class.java, l.element!!.javaClass)
|
||||
assertThat(l.textPre).isEqualTo("A")
|
||||
assertThat(l.textPost).isEqualTo("B")
|
||||
assertIs<InputInsulin>(l.element)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,7 +3,7 @@ package app.aaps.plugins.automation.elements
|
|||
import app.aaps.shared.tests.TestBase
|
||||
import dagger.android.AndroidInjector
|
||||
import dagger.android.HasAndroidInjector
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class LayoutBuilderTest : TestBase() {
|
||||
|
@ -14,15 +14,15 @@ class LayoutBuilderTest : TestBase() {
|
|||
val layoutBuilder = LayoutBuilder()
|
||||
val inputInsulin = InputInsulin()
|
||||
layoutBuilder.add(inputInsulin)
|
||||
Assertions.assertEquals(1, layoutBuilder.mElements.size)
|
||||
assertThat(layoutBuilder.mElements).hasSize(1)
|
||||
}
|
||||
|
||||
@Test fun addConditionalTest() {
|
||||
val layoutBuilder = LayoutBuilder()
|
||||
val inputInsulin = InputInsulin()
|
||||
layoutBuilder.maybeAdd(inputInsulin, true)
|
||||
Assertions.assertEquals(1, layoutBuilder.mElements.size)
|
||||
assertThat(layoutBuilder.mElements).hasSize(1)
|
||||
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.TriggerTestBase
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mockito.`when`
|
||||
|
||||
|
@ -10,9 +10,9 @@ class StaticLabelTest : TriggerTestBase() {
|
|||
|
||||
@Test fun constructor() {
|
||||
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")
|
||||
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 com.google.common.truth.Truth.assertThat
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.ArgumentMatchers
|
||||
import org.mockito.Mockito
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class TriggerAutosensValueTest : TriggerTestBase() {
|
||||
|
||||
|
@ -20,53 +20,53 @@ class TriggerAutosensValueTest : TriggerTestBase() {
|
|||
var t = TriggerAutosensValue(injector)
|
||||
t.autosens.value = 110.0
|
||||
t.comparator.value = Comparator.Compare.IS_EQUAL
|
||||
Assertions.assertEquals(110.0, t.autosens.value, 0.01)
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t.comparator.value)
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.autosens.value).isWithin(0.01).of(110.0)
|
||||
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
t = TriggerAutosensValue(injector)
|
||||
t.autosens.value = 100.0
|
||||
t.comparator.value = Comparator.Compare.IS_EQUAL
|
||||
Assertions.assertEquals(100.0, t.autosens.value, 0.01)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.autosens.value).isWithin(0.01).of(100.0)
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
t = TriggerAutosensValue(injector)
|
||||
t.autosens.value = 50.0
|
||||
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_GREATER
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
t = TriggerAutosensValue(injector)
|
||||
t.autosens.value = 310.0
|
||||
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
t = TriggerAutosensValue(injector)
|
||||
t.autosens.value = 420.0
|
||||
t.comparator.value = Comparator.Compare.IS_EQUAL
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
t = TriggerAutosensValue(injector)
|
||||
t.autosens.value = 390.0
|
||||
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
t = TriggerAutosensValue(injector)
|
||||
t.autosens.value = 390.0
|
||||
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_GREATER
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
t = TriggerAutosensValue(injector)
|
||||
t.autosens.value = 20.0
|
||||
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_GREATER
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
t = TriggerAutosensValue(injector)
|
||||
t.autosens.value = 390.0
|
||||
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))
|
||||
t = TriggerAutosensValue(injector)
|
||||
t.autosens.value = 80.0
|
||||
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
|
||||
`when`(autosensDataStore.getLastAutosensData(anyObject(), anyObject(), anyObject())).thenReturn(null)
|
||||
t = TriggerAutosensValue(injector)
|
||||
t.comparator.value = Comparator.Compare.IS_NOT_AVAILABLE
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -75,8 +75,8 @@ class TriggerAutosensValueTest : TriggerTestBase() {
|
|||
t.autosens.value = 213.0
|
||||
t.comparator.value = Comparator.Compare.IS_EQUAL_OR_LESSER
|
||||
val t1 = t.duplicate() as TriggerAutosensValue
|
||||
Assertions.assertEquals(213.0, t1.autosens.value, 0.01)
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
|
||||
assertThat(t1.autosens.value).isWithin(0.01).of(213.0)
|
||||
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||
}
|
||||
|
||||
private var asJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"value\":410},\"type\":\"TriggerAutosensValue\"}"
|
||||
|
@ -86,7 +86,7 @@ class TriggerAutosensValueTest : TriggerTestBase() {
|
|||
val t = TriggerAutosensValue(injector)
|
||||
t.autosens.value = 410.0
|
||||
t.comparator.value = Comparator.Compare.IS_EQUAL
|
||||
Assertions.assertEquals(asJson, t.toJSON())
|
||||
JSONAssert.assertEquals(asJson, t.toJSON(), true)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -95,15 +95,13 @@ class TriggerAutosensValueTest : TriggerTestBase() {
|
|||
t.autosens.value = 410.0
|
||||
t.comparator.value = Comparator.Compare.IS_EQUAL
|
||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerAutosensValue
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
|
||||
Assertions.assertEquals(410.0, t2.autosens.value, 0.01)
|
||||
assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||
assertThat(t2.autosens.value).isWithin(0.01).of(410.0)
|
||||
}
|
||||
|
||||
@Test fun iconTest() {
|
||||
assertThat(TriggerAutosensValue(injector).icon().get()).isEqualTo(R.drawable.ic_as)
|
||||
}
|
||||
|
||||
private fun generateAutosensData(): AutosensDataObject {
|
||||
return AutosensDataObject(injector)
|
||||
}
|
||||
}
|
||||
private fun generateAutosensData() = AutosensDataObject(injector)
|
||||
}
|
||||
|
|
|
@ -3,8 +3,8 @@ package app.aaps.plugins.automation.triggers
|
|||
import app.aaps.plugins.automation.elements.ComparatorConnect
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class TriggerBTDeviceTest : TriggerTestBase() {
|
||||
|
||||
|
@ -19,14 +19,14 @@ class TriggerBTDeviceTest : TriggerTestBase() {
|
|||
@Test fun toJSON() {
|
||||
val t = TriggerBTDevice(injector)
|
||||
t.btDevice.value = someName
|
||||
Assertions.assertEquals(btJson, t.toJSON())
|
||||
JSONAssert.assertEquals(btJson, t.toJSON(), true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun fromJSON() {
|
||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(btJson)) as TriggerBTDevice
|
||||
Assertions.assertEquals(ComparatorConnect.Compare.ON_CONNECT, t2.comparator.value)
|
||||
Assertions.assertEquals("Headset", t2.btDevice.value)
|
||||
assertThat(t2.comparator.value).isEqualTo(ComparatorConnect.Compare.ON_CONNECT)
|
||||
assertThat(t2.btDevice.value).isEqualTo("Headset")
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -40,7 +40,7 @@ class TriggerBTDeviceTest : TriggerTestBase() {
|
|||
it.btDevice.value = someName
|
||||
}
|
||||
val t1 = t.duplicate() as TriggerBTDevice
|
||||
Assertions.assertEquals("Headset", t1.btDevice.value)
|
||||
Assertions.assertEquals(ComparatorConnect.Compare.ON_DISCONNECT, t.comparator.value)
|
||||
assertThat(t1.btDevice.value).isEqualTo("Headset")
|
||||
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 com.google.common.truth.Truth.assertThat
|
||||
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.Test
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class TriggerBgTest : TriggerTestBase() {
|
||||
|
||||
|
@ -22,37 +23,37 @@ class TriggerBgTest : TriggerTestBase() {
|
|||
fun shouldRunTest() {
|
||||
`when`(autosensDataStore.getBucketedDataTableCopy()).thenReturn(generateOneCurrentRecordBgData())
|
||||
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)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
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)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
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)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
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)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
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())
|
||||
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)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun copyConstructorTest() {
|
||||
val t: TriggerBg = TriggerBg(injector).setUnits(GlucoseUnit.MGDL).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||
val t1 = t.duplicate() as TriggerBg
|
||||
Assertions.assertEquals(213.0, t1.bg.value, 0.01)
|
||||
Assertions.assertEquals(GlucoseUnit.MGDL, t1.bg.units)
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
|
||||
assertThat(t1.bg.value).isWithin(0.01).of(213.0)
|
||||
assertThat(t1.bg.units).isEqualTo(GlucoseUnit.MGDL)
|
||||
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\"}"
|
||||
|
@ -60,16 +61,16 @@ class TriggerBgTest : TriggerTestBase() {
|
|||
@Test
|
||||
fun toJSONTest() {
|
||||
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
|
||||
fun fromJSONTest() {
|
||||
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
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
|
||||
Assertions.assertEquals(4.1, t2.bg.value, 0.01)
|
||||
Assertions.assertEquals(GlucoseUnit.MMOL, t2.bg.units)
|
||||
assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||
assertThat(t2.bg.value).isWithin(0.01).of(4.1)
|
||||
assertThat(t2.bg.units).isEqualTo(GlucoseUnit.MMOL)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -82,4 +83,4 @@ class TriggerBgTest : TriggerTestBase() {
|
|||
list.add(InMemoryGlucoseValue(value = 214.0, timestamp = now - 1, trendArrow = GlucoseValue.TrendArrow.FLAT, sourceSensor = GlucoseValue.SourceSensor.UNKNOWN))
|
||||
return list
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,9 +7,9 @@ import com.google.common.truth.Truth.assertThat
|
|||
import io.reactivex.rxjava3.core.Single
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
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
|
||||
var t = TriggerBolusAgo(injector).setValue(110).comparator(Comparator.Compare.IS_EQUAL)
|
||||
Assertions.assertEquals(110, t.minutesAgo.value)
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t.comparator.value)
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.minutesAgo.value).isEqualTo(110)
|
||||
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
t = TriggerBolusAgo(injector).setValue(10).comparator(Comparator.Compare.IS_EQUAL)
|
||||
Assertions.assertEquals(10, t.minutesAgo.value)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.minutesAgo.value).isEqualTo(10)
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
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)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
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)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
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)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
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
|
||||
`when`(repository.getLastBolusRecordOfTypeWrapped(Bolus.Type.NORMAL)).thenReturn(
|
||||
Single.just(
|
||||
|
@ -62,30 +62,30 @@ class TriggerBolusAgoTest : TriggerTestBase() {
|
|||
)
|
||||
)
|
||||
t = TriggerBolusAgo(injector).comparator(Comparator.Compare.IS_NOT_AVAILABLE)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
}
|
||||
|
||||
@Test fun copyConstructorTest() {
|
||||
val t: TriggerBolusAgo = TriggerBolusAgo(injector).setValue(213).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||
val t1 = t.duplicate() as TriggerBolusAgo
|
||||
Assertions.assertEquals(213, t1.minutesAgo.value)
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
|
||||
assertThat(t1.minutesAgo.value).isEqualTo(213)
|
||||
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||
}
|
||||
|
||||
private var lbJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"minutesAgo\":410},\"type\":\"TriggerBolusAgo\"}"
|
||||
@Test fun toJSONTest() {
|
||||
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() {
|
||||
val t: TriggerBolusAgo = TriggerBolusAgo(injector).setValue(410).comparator(Comparator.Compare.IS_EQUAL)
|
||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerBolusAgo
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
|
||||
Assertions.assertEquals(410, t2.minutesAgo.value)
|
||||
assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||
assertThat(t2.minutesAgo.value).isEqualTo(410)
|
||||
}
|
||||
|
||||
@Test fun iconTest() {
|
||||
assertThat(TriggerBolusAgo(injector).icon().get()).isEqualTo(app.aaps.core.main.R.drawable.ic_bolus)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,11 +4,11 @@ import app.aaps.core.interfaces.iob.CobInfo
|
|||
import app.aaps.plugins.automation.elements.Comparator
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.ArgumentMatchers
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class TriggerCOBTest : TriggerTestBase() {
|
||||
|
||||
|
@ -20,44 +20,44 @@ class TriggerCOBTest : TriggerTestBase() {
|
|||
// COB value is 6
|
||||
`when`(iobCobCalculator.getCobInfo("AutomationTriggerCOB")).thenReturn(CobInfo(0, 6.0, 2.0))
|
||||
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)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
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)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
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)
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
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)
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
}
|
||||
|
||||
@Test fun copyConstructorTest() {
|
||||
val t: TriggerCOB = TriggerCOB(injector).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||
Assertions.assertEquals(213.0, t.cob.value, 0.01)
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
|
||||
assertThat(t.cob.value).isWithin(0.01).of(213.0)
|
||||
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||
}
|
||||
|
||||
private var bgJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"carbs\":4},\"type\":\"TriggerCOB\"}"
|
||||
@Test fun toJSONTest() {
|
||||
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
|
||||
fun fromJSONTest() {
|
||||
val t: TriggerCOB = TriggerCOB(injector).setValue(4.0).comparator(Comparator.Compare.IS_EQUAL)
|
||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerCOB
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
|
||||
Assertions.assertEquals(4.0, t2.cob.value, 0.01)
|
||||
assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||
assertThat(t2.cob.value).isWithin(0.01).of(4.0)
|
||||
}
|
||||
|
||||
@Test fun iconTest() {
|
||||
assertThat(TriggerCOB(injector).icon().get()).isEqualTo(app.aaps.core.main.R.drawable.ic_cp_bolus_carbs)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
package app.aaps.plugins.automation.triggers
|
||||
|
||||
import kotlin.test.assertIs
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
|
||||
class TriggerDummyTest : TriggerTestBase() {
|
||||
|
@ -9,13 +9,13 @@ class TriggerDummyTest : TriggerTestBase() {
|
|||
@Test
|
||||
fun instantiateTest() {
|
||||
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\"}"))
|
||||
Assertions.assertTrue(trigger is TriggerDummy)
|
||||
assertIs<TriggerDummy>(trigger)
|
||||
|
||||
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.plugins.automation.R
|
||||
import app.aaps.plugins.automation.elements.Comparator
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import io.reactivex.rxjava3.core.Single
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mockito.verify
|
||||
import org.mockito.Mockito.verifyNoMoreInteractions
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class TriggerHeartRateTest : TriggerTestBase() {
|
||||
|
||||
@Test
|
||||
fun friendlyName() {
|
||||
Assertions.assertEquals(R.string.triggerHeartRate, TriggerHeartRate(injector).friendlyName())
|
||||
assertThat(TriggerHeartRate(injector).friendlyName()).isEqualTo(R.string.triggerHeartRate)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -23,7 +24,7 @@ class TriggerHeartRateTest : TriggerTestBase() {
|
|||
val t = TriggerHeartRate(injector)
|
||||
`when`(rh.gs(Comparator.Compare.IS_EQUAL_OR_GREATER.stringRes)).thenReturn(">")
|
||||
`when`(rh.gs(R.string.triggerHeartRateDesc, ">", 80.0)).thenReturn("test")
|
||||
Assertions.assertEquals("test", t.friendlyDescription())
|
||||
assertThat(t.friendlyDescription()).isEqualTo("test")
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -33,16 +34,16 @@ class TriggerHeartRateTest : TriggerTestBase() {
|
|||
comparator.value = Comparator.Compare.IS_GREATER
|
||||
}
|
||||
val dup = t.duplicate() as TriggerHeartRate
|
||||
Assertions.assertNotSame(t, dup)
|
||||
Assertions.assertEquals(100.0, dup.heartRate.value, 0.01)
|
||||
Assertions.assertEquals(Comparator.Compare.IS_GREATER, dup.comparator.value)
|
||||
assertThat(dup).isNotSameInstanceAs(t)
|
||||
assertThat(dup.heartRate.value).isWithin(0.01).of(100.0)
|
||||
assertThat(dup.comparator.value).isEqualTo(Comparator.Compare.IS_GREATER)
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
fun shouldRunNotAvailable() {
|
||||
val t = TriggerHeartRate(injector).apply { comparator.value = Comparator.Compare.IS_NOT_AVAILABLE }
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
verifyNoMoreInteractions(repository)
|
||||
}
|
||||
|
||||
|
@ -53,7 +54,7 @@ class TriggerHeartRateTest : TriggerTestBase() {
|
|||
comparator.value = Comparator.Compare.IS_GREATER
|
||||
}
|
||||
`when`(repository.getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)).thenReturn(Single.just(emptyList()))
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
verify(repository).getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)
|
||||
verifyNoMoreInteractions(repository)
|
||||
}
|
||||
|
@ -69,7 +70,7 @@ class TriggerHeartRateTest : TriggerTestBase() {
|
|||
HeartRate(duration = 300_000, timestamp = now, beatsPerMinute = 60.0, device = "test"),
|
||||
)
|
||||
`when`(repository.getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)).thenReturn(Single.just(hrs))
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
verify(repository).getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)
|
||||
verifyNoMoreInteractions(repository)
|
||||
}
|
||||
|
@ -84,7 +85,7 @@ class TriggerHeartRateTest : TriggerTestBase() {
|
|||
HeartRate(duration = 300_000, timestamp = now, beatsPerMinute = 120.0, device = "test"),
|
||||
)
|
||||
`when`(repository.getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)).thenReturn(Single.just(hrs))
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
verify(repository).getHeartRatesFromTime(now - t.averageHeartRateDurationMillis)
|
||||
verifyNoMoreInteractions(repository)
|
||||
}
|
||||
|
@ -95,9 +96,9 @@ class TriggerHeartRateTest : TriggerTestBase() {
|
|||
heartRate.value = 100.0
|
||||
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
|
||||
|
@ -107,7 +108,7 @@ class TriggerHeartRateTest : TriggerTestBase() {
|
|||
"""{"data":{"comparator":"IS_GREATER","heartRate":100},"type":"TriggerHeartRate"}"""
|
||||
)
|
||||
) as TriggerHeartRate
|
||||
Assertions.assertEquals(Comparator.Compare.IS_GREATER, t.comparator.value)
|
||||
Assertions.assertEquals(100.0, t.heartRate.value, 0.01)
|
||||
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_GREATER)
|
||||
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 com.google.common.truth.Truth.assertThat
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.ArgumentMatchers
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class TriggerIobTest : TriggerTestBase() {
|
||||
|
||||
|
@ -20,43 +20,43 @@ class TriggerIobTest : TriggerTestBase() {
|
|||
@Test fun shouldRunTest() {
|
||||
`when`(iobCobCalculator.calculateFromTreatmentsAndTemps(ArgumentMatchers.anyLong(), anyObject())).thenReturn(generateIobRecordData())
|
||||
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)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
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)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
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)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
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)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
t = TriggerIob(injector).setValue(0.9).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
}
|
||||
|
||||
@Test fun copyConstructorTest() {
|
||||
val t: TriggerIob = TriggerIob(injector).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||
Assertions.assertEquals(213.0, t.insulin.value, 0.01)
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
|
||||
assertThat(t.insulin.value).isWithin(0.01).of(213.0)
|
||||
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||
}
|
||||
|
||||
private var bgJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"insulin\":4.1},\"type\":\"TriggerIob\"}"
|
||||
@Test fun toJSONTest() {
|
||||
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
|
||||
fun fromJSONTest() {
|
||||
val t: TriggerIob = TriggerIob(injector).setValue(4.1).comparator(Comparator.Compare.IS_EQUAL)
|
||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerIob
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
|
||||
Assertions.assertEquals(4.1, t2.insulin.value, 0.01)
|
||||
assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||
assertThat(t2.insulin.value).isWithin(0.01).of(4.1)
|
||||
}
|
||||
|
||||
@Test fun iconTest() {
|
||||
|
@ -68,4 +68,4 @@ class TriggerIobTest : TriggerTestBase() {
|
|||
iobTotal.iob = 1.0
|
||||
return iobTotal
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import app.aaps.plugins.automation.elements.InputLocationMode
|
|||
import com.google.common.truth.Truth.assertThat
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mockito.`when`
|
||||
|
@ -24,10 +23,10 @@ class TriggerLocationTest : TriggerTestBase() {
|
|||
t.distance.setValue(2.0)
|
||||
t.modeSelected.value = InputLocationMode.Mode.INSIDE
|
||||
val t1 = t.duplicate() as TriggerLocation
|
||||
Assertions.assertEquals(213.0, t1.latitude.value, 0.01)
|
||||
Assertions.assertEquals(212.0, t1.longitude.value, 0.01)
|
||||
Assertions.assertEquals(2.0, t1.distance.value, 0.01)
|
||||
Assertions.assertEquals(InputLocationMode.Mode.INSIDE, t1.modeSelected.value)
|
||||
assertThat(t1.latitude.value).isWithin(0.01).of(213.0)
|
||||
assertThat(t1.longitude.value).isWithin(0.01).of(212.0)
|
||||
assertThat(t1.distance.value).isWithin(0.01).of(2.0)
|
||||
assertThat(t1.modeSelected.value).isEqualTo(InputLocationMode.Mode.INSIDE)
|
||||
}
|
||||
|
||||
@Test fun shouldRunTest() {
|
||||
|
@ -37,12 +36,12 @@ class TriggerLocationTest : TriggerTestBase() {
|
|||
t.distance.setValue(2.0)
|
||||
// t.modeSelected.setValue(InputLocationMode.Mode.OUTSIDE);
|
||||
`when`(locationDataContainer.lastLocation).thenReturn(null)
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
`when`(locationDataContainer.lastLocation).thenReturn(mockedLocation())
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
t = TriggerLocation(injector)
|
||||
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
|
||||
t = TriggerLocation(injector)
|
||||
|
@ -51,9 +50,9 @@ class TriggerLocationTest : TriggerTestBase() {
|
|||
`when`(locationDataContainer.lastLocation).thenReturn(null)
|
||||
`when`(locationDataContainer.lastLocation).thenReturn(mockedLocationOut())
|
||||
t.modeSelected.value = InputLocationMode.Mode.GOING_IN
|
||||
Assertions.assertEquals(t.lastMode, InputLocationMode.Mode.OUTSIDE)
|
||||
Assertions.assertEquals(t.currentMode(5.0), InputLocationMode.Mode.INSIDE)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(InputLocationMode.Mode.OUTSIDE).isEqualTo(t.lastMode)
|
||||
assertThat(InputLocationMode.Mode.INSIDE).isEqualTo(t.currentMode(5.0))
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
|
||||
//Test of GOING_OUT - last mode should be INSIDE, and current mode should be OUTSIDE
|
||||
// Currently unavailable due to problems with Location mocking
|
||||
|
@ -67,7 +66,7 @@ class TriggerLocationTest : TriggerTestBase() {
|
|||
t.distance.setValue(2.0)
|
||||
t.modeSelected.value = InputLocationMode.Mode.OUTSIDE
|
||||
// t.modeSelected = t.modeSelected.value
|
||||
Assertions.assertEquals(locationJson, t.toJSON())
|
||||
assertThat(t.toJSON()).isEqualTo(locationJson)
|
||||
}
|
||||
|
||||
@Test @Throws(JSONException::class) fun fromJSONTest() {
|
||||
|
@ -77,18 +76,18 @@ class TriggerLocationTest : TriggerTestBase() {
|
|||
t.distance.setValue(2.0)
|
||||
t.modeSelected.value = InputLocationMode.Mode.INSIDE
|
||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerLocation
|
||||
Assertions.assertEquals(t.latitude.value, t2.latitude.value, 0.01)
|
||||
Assertions.assertEquals(t.longitude.value, t2.longitude.value, 0.01)
|
||||
Assertions.assertEquals(t.distance.value, t2.distance.value, 0.01)
|
||||
Assertions.assertEquals(t.modeSelected.value, t2.modeSelected.value)
|
||||
assertThat(t2.latitude.value).isWithin(0.01).of(t.latitude.value)
|
||||
assertThat(t2.longitude.value).isWithin(0.01).of(t.longitude.value)
|
||||
assertThat(t2.distance.value).isWithin(0.01).of(t.distance.value)
|
||||
assertThat(t2.modeSelected.value).isEqualTo(t.modeSelected.value)
|
||||
}
|
||||
|
||||
@Test fun friendlyNameTest() {
|
||||
Assertions.assertEquals(R.string.location, TriggerLocation(injector).friendlyName())
|
||||
assertThat(TriggerLocation(injector).friendlyName()).isEqualTo(R.string.location)
|
||||
}
|
||||
|
||||
@Test fun friendlyDescriptionTest() {
|
||||
Assertions.assertEquals(null, TriggerLocation(injector).friendlyDescription()) //not mocked }
|
||||
assertThat(TriggerLocation(injector).friendlyDescription()).isNull() //not mocked }
|
||||
}
|
||||
|
||||
@Test fun iconTest() {
|
||||
|
@ -110,4 +109,4 @@ class TriggerLocationTest : TriggerTestBase() {
|
|||
newLocation.accuracy = 1f
|
||||
return newLocation
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,10 +4,10 @@ import app.aaps.plugins.automation.R
|
|||
import app.aaps.plugins.automation.elements.Comparator
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class TriggerProfilePercentTest : TriggerTestBase() {
|
||||
|
||||
|
@ -17,43 +17,43 @@ class TriggerProfilePercentTest : TriggerTestBase() {
|
|||
|
||||
@Test fun shouldRunTest() {
|
||||
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)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
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)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
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)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
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)
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
t = TriggerProfilePercent(injector).setValue(90.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
}
|
||||
|
||||
@Test fun copyConstructorTest() {
|
||||
val t: TriggerProfilePercent = TriggerProfilePercent(injector).setValue(213.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||
val t1 = t.duplicate() as TriggerProfilePercent
|
||||
Assertions.assertEquals(213.0, t1.pct.value, 0.01)
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
|
||||
assertThat( t1.pct.value).isWithin(0.01).of(213.0)
|
||||
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||
}
|
||||
|
||||
private val bgJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"percentage\":110},\"type\":\"TriggerProfilePercent\"}"
|
||||
@Test fun toJSONTest() {
|
||||
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() {
|
||||
val t: TriggerProfilePercent = TriggerProfilePercent(injector).setValue(120.0).comparator(Comparator.Compare.IS_EQUAL)
|
||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerProfilePercent
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
|
||||
Assertions.assertEquals(120.0, t2.pct.value, 0.01)
|
||||
assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||
assertThat(t2.pct.value).isWithin(0.01).of(120.0)
|
||||
}
|
||||
|
||||
@Test fun iconTest() {
|
||||
|
@ -61,6 +61,6 @@ class TriggerProfilePercentTest : TriggerTestBase() {
|
|||
}
|
||||
|
||||
@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 com.google.common.truth.Truth.assertThat
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class TriggerPumpLastConnectionTest : TriggerTestBase() {
|
||||
|
||||
|
@ -14,42 +14,42 @@ class TriggerPumpLastConnectionTest : TriggerTestBase() {
|
|||
fun shouldRunTest() {
|
||||
// System.currentTimeMillis() is always 0
|
||||
// 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
|
||||
var t = TriggerPumpLastConnection(injector).setValue(110).comparator(Comparator.Compare.IS_EQUAL)
|
||||
Assertions.assertEquals(110, t.minutesAgo.value)
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t.comparator.value)
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.minutesAgo.value).isEqualTo(110)
|
||||
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
t = TriggerPumpLastConnection(injector).setValue(10).comparator(Comparator.Compare.IS_EQUAL)
|
||||
Assertions.assertEquals(10, t.minutesAgo.value)
|
||||
Assertions.assertFalse(t.shouldRun()) // 0 == 10 -> FALSE
|
||||
assertThat(t.minutesAgo.value).isEqualTo(10)
|
||||
assertThat(t.shouldRun()).isFalse() // 0 == 10 -> FALSE
|
||||
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)
|
||||
Assertions.assertFalse(t.shouldRun()) // 310 <= 0 -> FALSE
|
||||
assertThat(t.shouldRun()).isFalse() // 310 <= 0 -> FALSE
|
||||
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() {
|
||||
val t: TriggerPumpLastConnection = TriggerPumpLastConnection(injector).setValue(213).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||
val t1 = t.duplicate() as TriggerPumpLastConnection
|
||||
Assertions.assertEquals(213, t1.minutesAgo.value)
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
|
||||
assertThat(t1.minutesAgo.value).isEqualTo(213)
|
||||
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||
}
|
||||
|
||||
private var lbJson = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"minutesAgo\":410},\"type\":\"TriggerPumpLastConnection\"}"
|
||||
@Test fun toJSONTest() {
|
||||
val t: TriggerPumpLastConnection = TriggerPumpLastConnection(injector).setValue(410).comparator(Comparator.Compare.IS_EQUAL)
|
||||
Assertions.assertEquals(lbJson, t.toJSON())
|
||||
JSONAssert.assertEquals(lbJson, t.toJSON(), true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun fromJSONTest() {
|
||||
val t: TriggerPumpLastConnection = TriggerPumpLastConnection(injector).setValue(410).comparator(Comparator.Compare.IS_EQUAL)
|
||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerPumpLastConnection
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
|
||||
Assertions.assertEquals(410, t2.minutesAgo.value)
|
||||
assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||
assertThat(t2.minutesAgo.value).isEqualTo(410)
|
||||
}
|
||||
|
||||
@Test fun iconTest() {
|
||||
|
@ -57,6 +57,6 @@ class TriggerPumpLastConnectionTest : TriggerTestBase() {
|
|||
}
|
||||
|
||||
@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.T
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mockito
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class TriggerRecurringTimeTest : TriggerTestBase() {
|
||||
|
||||
|
@ -19,12 +20,12 @@ class TriggerRecurringTimeTest : TriggerTestBase() {
|
|||
|
||||
var t: TriggerRecurringTime = TriggerRecurringTime(injector).time(89)
|
||||
t.days.setAll(true)
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
|
||||
// scheduled 1 min before
|
||||
t = TriggerRecurringTime(injector).time(94)
|
||||
t.days.setAll(true)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
}
|
||||
|
||||
private var timeJson =
|
||||
|
@ -33,13 +34,13 @@ class TriggerRecurringTimeTest : TriggerTestBase() {
|
|||
@Test
|
||||
fun toJSONTest() {
|
||||
val t = TriggerRecurringTime(injector).time(4444)
|
||||
Assertions.assertEquals(timeJson, t.toJSON())
|
||||
JSONAssert.assertEquals(timeJson, t.toJSON(), true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun fromJSONTest() {
|
||||
val t = TriggerRecurringTime(injector).time(4444)
|
||||
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 com.google.common.truth.Truth.assertThat
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class TriggerTempTargetTest : TriggerTestBase() {
|
||||
|
||||
|
@ -13,36 +13,36 @@ class TriggerTempTargetTest : TriggerTestBase() {
|
|||
@Test fun shouldRunTest() {
|
||||
`when`(repository.getTemporaryTargetActiveAt(anyObject())).thenReturn(null)
|
||||
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)
|
||||
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))
|
||||
t = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.NOT_EXISTS)
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
t = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.EXISTS)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
}
|
||||
*/
|
||||
@Test fun copyConstructorTest() {
|
||||
val t: TriggerTempTarget = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.NOT_EXISTS)
|
||||
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\"}"
|
||||
@Test fun toJSONTest() {
|
||||
val t: TriggerTempTarget = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.EXISTS)
|
||||
Assertions.assertEquals(ttJson, t.toJSON())
|
||||
JSONAssert.assertEquals(ttJson, t.toJSON(), true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun fromJSONTest() {
|
||||
val t: TriggerTempTarget = TriggerTempTarget(injector).comparator(ComparatorExists.Compare.NOT_EXISTS)
|
||||
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() {
|
||||
assertThat(TriggerTempTarget(injector).icon().get()).isEqualTo(R.drawable.ic_keyboard_tab)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -8,10 +8,10 @@ import app.aaps.plugins.automation.elements.Comparator
|
|||
import com.google.common.truth.Truth.assertThat
|
||||
import io.reactivex.rxjava3.core.Single
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
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)
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
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)
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
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)
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
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)
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
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)
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
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()))
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun copyConstructorTest() {
|
||||
val t: TriggerTempTargetValue = TriggerTempTargetValue(injector).setUnits(GlucoseUnit.MGDL).setValue(140.0).comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||
val t1 = t.duplicate() as TriggerTempTargetValue
|
||||
Assertions.assertEquals(140.0, t1.ttValue.value, 0.01)
|
||||
Assertions.assertEquals(GlucoseUnit.MGDL, t1.ttValue.units)
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
|
||||
assertThat(t1.ttValue.value).isWithin(0.01).of(140.0)
|
||||
assertThat(t1.ttValue.units).isEqualTo(GlucoseUnit.MGDL)
|
||||
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\"}"
|
||||
|
@ -74,16 +74,16 @@ class TriggerTempTargetValueTest : TriggerTestBase() {
|
|||
@Test
|
||||
fun toJSONTest() {
|
||||
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
|
||||
fun fromJSONTest() {
|
||||
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
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
|
||||
Assertions.assertEquals(7.7, t2.ttValue.value, 0.01)
|
||||
Assertions.assertEquals(GlucoseUnit.MMOL, t2.ttValue.units)
|
||||
assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||
assertThat(t2.ttValue.value).isWithin(0.01).of(7.7)
|
||||
assertThat(t2.ttValue.units).isEqualTo(GlucoseUnit.MMOL)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
|
@ -4,10 +4,10 @@ import app.aaps.core.interfaces.utils.MidnightTime
|
|||
import app.aaps.plugins.automation.R
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.BeforeEach
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class TriggerTimeRangeTest : TriggerTestBase() {
|
||||
|
||||
|
@ -25,47 +25,47 @@ class TriggerTimeRangeTest : TriggerTestBase() {
|
|||
fun shouldRunTest() {
|
||||
// range starts 1 min in the future
|
||||
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
|
||||
t = TriggerTimeRange(injector).period((now - 30).toInt(), (now + 30).toInt())
|
||||
Assertions.assertEquals(true, t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
|
||||
// Period is all day long
|
||||
t = TriggerTimeRange(injector).period(1, 1440)
|
||||
Assertions.assertEquals(true, t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
}
|
||||
|
||||
@Test
|
||||
fun toJSONTest() {
|
||||
val t: TriggerTimeRange = TriggerTimeRange(injector).period((now - 1).toInt(), (now + 30).toInt())
|
||||
Assertions.assertEquals(timeJson, t.toJSON())
|
||||
JSONAssert.assertEquals(timeJson, t.toJSON(), true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun fromJSONTest() {
|
||||
val t: TriggerTimeRange = TriggerTimeRange(injector).period(120, 180)
|
||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerTimeRange
|
||||
Assertions.assertEquals((now - 1).toInt(), t2.period(753, 360).range.start)
|
||||
Assertions.assertEquals(360, t2.period(753, 360).range.end)
|
||||
assertThat(t2.period(753, 360).range.start).isEqualTo((now - 1).toInt())
|
||||
assertThat(t2.period(753, 360).range.end).isEqualTo(360)
|
||||
}
|
||||
|
||||
@Test fun copyConstructorTest() {
|
||||
val t = TriggerTimeRange(injector)
|
||||
t.period(now.toInt(), (now + 30).toInt())
|
||||
val t1 = t.duplicate() as TriggerTimeRange
|
||||
Assertions.assertEquals(now.toInt(), t1.range.start)
|
||||
assertThat(t1.range.start).isEqualTo(now.toInt())
|
||||
}
|
||||
|
||||
@Test fun friendlyNameTest() {
|
||||
Assertions.assertEquals(R.string.time_range, TriggerTimeRange(injector).friendlyName())
|
||||
assertThat(TriggerTimeRange(injector).friendlyName()).isEqualTo(R.string.time_range)
|
||||
}
|
||||
|
||||
@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() {
|
||||
assertThat(TriggerTimeRange(injector).icon().get()).isEqualTo(app.aaps.core.main.R.drawable.ic_access_alarm_24dp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -4,9 +4,9 @@ import app.aaps.core.interfaces.utils.T
|
|||
import app.aaps.plugins.automation.R
|
||||
import com.google.common.truth.Truth.assertThat
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mockito
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class TriggerTimeTest : TriggerTestBase() {
|
||||
|
||||
|
@ -19,11 +19,11 @@ class TriggerTimeTest : TriggerTestBase() {
|
|||
|
||||
// scheduled 1 min before
|
||||
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
|
||||
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\"}"
|
||||
|
@ -31,14 +31,14 @@ class TriggerTimeTest : TriggerTestBase() {
|
|||
@Test
|
||||
fun toJSONTest() {
|
||||
val t: TriggerTime = TriggerTime(injector).runAt(now - T.mins(1).msecs())
|
||||
Assertions.assertEquals(timeJson, t.toJSON())
|
||||
JSONAssert.assertEquals(timeJson, t.toJSON(), true)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun fromJSONTest() {
|
||||
val t: TriggerTime = TriggerTime(injector).runAt(now - T.mins(1).msecs())
|
||||
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
|
||||
|
@ -46,22 +46,22 @@ class TriggerTimeTest : TriggerTestBase() {
|
|||
val t = TriggerTime(injector)
|
||||
t.runAt(now)
|
||||
val t1 = t.duplicate() as TriggerTime
|
||||
Assertions.assertEquals(now, t1.time.value)
|
||||
assertThat(t1.time.value).isEqualTo(now)
|
||||
}
|
||||
|
||||
@Test
|
||||
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
|
||||
fun friendlyDescriptionTest() {
|
||||
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
|
||||
fun iconTest() {
|
||||
assertThat(TriggerTime(injector).icon().get()).isEqualTo(app.aaps.core.main.R.drawable.ic_access_alarm_24dp)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,9 +6,9 @@ import app.aaps.plugins.automation.elements.Comparator
|
|||
import com.google.common.truth.Truth.assertThat
|
||||
import org.json.JSONException
|
||||
import org.json.JSONObject
|
||||
import org.junit.jupiter.api.Assertions
|
||||
import org.junit.jupiter.api.Test
|
||||
import org.mockito.Mockito.`when`
|
||||
import org.skyscreamer.jsonassert.JSONAssert
|
||||
|
||||
class TriggerWifiSsidTest : TriggerTestBase() {
|
||||
|
||||
|
@ -17,40 +17,40 @@ class TriggerWifiSsidTest : TriggerTestBase() {
|
|||
`when`(receiverStatusStore.lastNetworkEvent).thenReturn(e)
|
||||
var t: TriggerWifiSsid = TriggerWifiSsid(injector).setValue("aSSID 1").comparator(Comparator.Compare.IS_EQUAL)
|
||||
e.wifiConnected = false
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
e.wifiConnected = true
|
||||
e.ssid = "otherSSID"
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
e.wifiConnected = true
|
||||
e.ssid = "aSSID 1"
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
t = TriggerWifiSsid(injector).setValue("aSSID 1").comparator(Comparator.Compare.IS_NOT_AVAILABLE)
|
||||
e.wifiConnected = false
|
||||
Assertions.assertTrue(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isTrue()
|
||||
|
||||
// no network data
|
||||
`when`(receiverStatusStore.lastNetworkEvent).thenReturn(null)
|
||||
Assertions.assertFalse(t.shouldRun())
|
||||
assertThat(t.shouldRun()).isFalse()
|
||||
}
|
||||
|
||||
@Test fun copyConstructorTest() {
|
||||
val t: TriggerWifiSsid = TriggerWifiSsid(injector).setValue("aSSID").comparator(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||
val t1 = t.duplicate() as TriggerWifiSsid
|
||||
Assertions.assertEquals("aSSID", t1.ssid.value)
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL_OR_LESSER, t.comparator.value)
|
||||
assertThat(t1.ssid.value).isEqualTo("aSSID")
|
||||
assertThat(t.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL_OR_LESSER)
|
||||
}
|
||||
|
||||
var json = "{\"data\":{\"comparator\":\"IS_EQUAL\",\"ssid\":\"aSSID\"},\"type\":\"TriggerWifiSsid\"}"
|
||||
@Test fun toJSONTest() {
|
||||
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() {
|
||||
val t: TriggerWifiSsid = TriggerWifiSsid(injector).setValue("aSSID").comparator(Comparator.Compare.IS_EQUAL)
|
||||
val t2 = TriggerDummy(injector).instantiate(JSONObject(t.toJSON())) as TriggerWifiSsid
|
||||
Assertions.assertEquals(Comparator.Compare.IS_EQUAL, t2.comparator.value)
|
||||
Assertions.assertEquals("aSSID", t2.ssid.value)
|
||||
assertThat(t2.comparator.value).isEqualTo(Comparator.Compare.IS_EQUAL)
|
||||
assertThat(t2.ssid.value).isEqualTo("aSSID")
|
||||
}
|
||||
|
||||
@Test fun iconTest() {
|
||||
|
@ -58,10 +58,10 @@ class TriggerWifiSsidTest : TriggerTestBase() {
|
|||
}
|
||||
|
||||
@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() {
|
||||
Assertions.assertEquals(null, TriggerWifiSsid(injector).friendlyDescription()) //not mocked
|
||||
assertThat(TriggerWifiSsid(injector).friendlyDescription()).isNull() //not mocked
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
BIN
plugins/configuration/src/main/assets/Cockpit.zip
Normal file
BIN
plugins/configuration/src/main/assets/Cockpit.zip
Normal file
Binary file not shown.
Binary file not shown.
BIN
plugins/configuration/src/main/assets/SteamPunk mgdl.zip
Normal file
BIN
plugins/configuration/src/main/assets/SteamPunk mgdl.zip
Normal file
Binary file not shown.
BIN
plugins/configuration/src/main/assets/SteamPunk mmol.zip
Normal file
BIN
plugins/configuration/src/main/assets/SteamPunk mmol.zip
Normal file
Binary file not shown.
|
@ -56,7 +56,7 @@ class CustomWatchfaceImportListActivity : TranslatedDaggerAppCompatActivity() {
|
|||
supportActionBar?.setDisplayShowTitleEnabled(true)
|
||||
|
||||
binding.recyclerview.layoutManager = LinearLayoutManager(this)
|
||||
binding.recyclerview.adapter = RecyclerViewAdapter(prefFileListProvider.listCustomWatchfaceFiles())
|
||||
binding.recyclerview.adapter = RecyclerViewAdapter(prefFileListProvider.listCustomWatchfaceFiles().sortedBy { it.metadata[CWF_NAME] })
|
||||
}
|
||||
|
||||
inner class RecyclerViewAdapter internal constructor(private var customWatchfaceFileList: List<CwfData>) : RecyclerView.Adapter<RecyclerViewAdapter.CwfFileViewHolder>() {
|
||||
|
|
|
@ -157,4 +157,14 @@
|
|||
<!-- Permissions -->
|
||||
<string name="alert_dialog_storage_permission_text">נא לאתחל את הסמרטפון שלכם או הפעילו מחדש את אפלקציית AndroidAPS בהגדרות המערכת \nאחרת AndroidAPS לא יוכל לבצע רישום (חשוב לעקוב ולוודא כי האלגוריתמים פועלים כראוי)!</string>
|
||||
<!-- Maintenance -->
|
||||
<string name="metadata_label_format">פורמט הקובץ</string>
|
||||
<string name="metadata_label_created_at">נוצר ב-</string>
|
||||
<string name="metadata_label_aaps_version">גרסת AAPS</string>
|
||||
<string name="metadata_label_aaps_flavour">גרסת בנייה</string>
|
||||
<string name="metadata_label_device_name">מייצא את שם מכשיר המטופל\\ת</string>
|
||||
<string name="metadata_label_device_model">מייצא את דגם המכשיר</string>
|
||||
<string name="metadata_label_encryption">הצפנת קבצים</string>
|
||||
<string name="metadata_format_new">פורמט הצפנה חדש</string>
|
||||
<string name="metadata_format_debug">פורמט דיבאג חדש (בלתי מוצפן)</string>
|
||||
<string name="metadata_format_other">פורמט ייצוא לא ידוע</string>
|
||||
</resources>
|
||||
|
|
|
@ -45,8 +45,8 @@
|
|||
<string name="startobjective">Start første læringsmål</string>
|
||||
<string name="setupwizard_pump_riley_link_status">RileyLink status:</string>
|
||||
<string name="readstatus">Les status</string>
|
||||
<string name="data_choices">Data valg</string>
|
||||
<string name="fabric_upload">Innlesing av fabrikkinstillinger</string>
|
||||
<string name="data_choices">Datavalg</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="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>
|
||||
|
@ -81,7 +81,7 @@
|
|||
<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="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-->
|
||||
<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>
|
|
@ -10,6 +10,7 @@
|
|||
<string name="old_version">גרסה ישנה</string>
|
||||
<string name="very_old_version">גרסה ישנה מאוד</string>
|
||||
<string name="application_expired">תוקף האפליקציה פג</string>
|
||||
<string name="new_version_warning">בדיקה לגרסא חדשה של המערכת לא בוצעה מזה לפחות %1$d ימים! שנמוך למצב \'השהיה עקב ערך סוכר נמוך\' תתבצע לאחר %2$d ימים והלולאה תושבת אחרי %3$d ימים. חברו את המכשיר לרשת האינטרנט!</string>
|
||||
<string name="running_invalid_version">זיהינו שאתם משתמשים בגרסה שאינה בתוקף. הלולאה מושבתת!</string>
|
||||
<string name="versionavailable">גרסה %1$s זמינה</string>
|
||||
<string name="version_expire">תוקפה של גרסה %1$s תפוג ב-%2$s</string>
|
||||
|
@ -47,4 +48,6 @@
|
|||
<string name="doyouwantresetstart">האם ברצונכם לאפס את התחלת המשימה? אתם עלולים לאבד את התקדמותכם במשימה.</string>
|
||||
<string name="objectives_next_button">הבא</string>
|
||||
<string name="objectives_previous_button">הקודם</string>
|
||||
<string name="objectives_button_unfinish">ביטול השלמה</string>
|
||||
<string name="objectives_button_unstart">ביטול התחלה</string>
|
||||
</resources>
|
||||
|
|
|
@ -148,6 +148,7 @@
|
|||
<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_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_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>
|
||||
|
|
|
@ -190,20 +190,20 @@
|
|||
<string name="ic_different">IK vil være forskjellig hvis du regner en skive brød som 10g eller 12g.</string>
|
||||
<string name="ic_meaning">IK faktor betyr: Hvor mange brødenheter som dekkes av 1E insulin?</string>
|
||||
<string name="ic_hint1">https://wiki.aaps.app/en/latest/Getting-Started/FAQ.html#insulin-to-carb-ratio-ic-g-u</string>
|
||||
<string name="profileswitch_label">Profil bytte</string>
|
||||
<string name="profileswitch_label">Profilbytte</string>
|
||||
<string name="profileswitch_pctwillchange">Når du spesifiserer et profilbytte på 90%, hvilke svar er korrekte?</string>
|
||||
<string name="profileswitch_basallower">Basaldoser vil være 10% lavere.</string>
|
||||
<string name="profileswitch_isfhigher">ISF verdien vil være 10% høyere.</string>
|
||||
<string name="profileswitch_iclower">Verdien av KH ratio vil være 10 % lavere.</string>
|
||||
<string name="profileswitch_unchanged">ISF og KH ratio er uendret.</string>
|
||||
<string name="profileswitch_hint1" formatted="false">https://wiki.aaps.app/en/latest/Usage/Profiles.html#profile-switch</string>
|
||||
<string name="profileswitch2_label">Profil bytte</string>
|
||||
<string name="profileswitch2_label">Profilbytte</string>
|
||||
<string name="profileswitch2_pctwillchange">Når du spesifiserer et profilbytte på 120%, hvilke svar er korrekte?</string>
|
||||
<string name="profileswitch2_bghigher">Blodsukkermålet vil være 20% høyere.</string>
|
||||
<string name="profileswitch2_basalhigher">Basaldoser vil være 20% høyere.</string>
|
||||
<string name="profileswitch2_bgunchanged">Blodsukkermålet vil være uforandret.</string>
|
||||
<string name="profileswitch2_isfhigher">ISF vil være 20% høyere.</string>
|
||||
<string name="profileswitchtime_label">Profil bytte</string>
|
||||
<string name="profileswitchtime_label">Profilbytte</string>
|
||||
<string name="profileswitchtime_iwant">Hvis du står opp 2 timer tidligere enn vanlig, hvordan forteller du AndroidAPS om endringen i døgnrytmen din?</string>
|
||||
<string name="profileswitchtime_2">Gjør et profilbytte med en tidsforskyvning på 2</string>
|
||||
<string name="profileswitchtime__2">Gjør et profilbytte med en tidsforskyvning på -2</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_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_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_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>
|
||||
|
@ -42,7 +42,7 @@
|
|||
<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_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_useloop">Vis innholdet i Loop plugin</string>
|
||||
<string name="objectives_usescale">Test skaleringsfunksjonen ved et langt trykk på BS grafen</string>
|
|
@ -45,7 +45,7 @@
|
|||
<string name="closedmodeenabled">Lukket loop aktivert</string>
|
||||
<string name="objectives_shortname">MÅL</string>
|
||||
<string name="description_objectives">Opplæringsprogram</string>
|
||||
<string name="doyouwantresetstart">Ønsker du å starte læringsmåletpå nytt? Du vil miste fullførte trinn.</string>
|
||||
<string name="doyouwantresetstart">Ønsker du å starte læringsmålet på nytt? Du vil miste fullførte trinn.</string>
|
||||
<string name="objectives_next_button">Neste</string>
|
||||
<string name="objectives_previous_button">Forrige</string>
|
||||
<string name="objectives_button_unfinish">Nullstille ferdig-status</string>
|
|
@ -148,6 +148,7 @@
|
|||
<string name="cob3_longer">Установка профиля на 150% увеличит расчетное время усвоения углеводов</string>
|
||||
<string name="cob3_shorter">Установка профиля на 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_hightemp">Высокая ВБС не будет применяться, если уровень сахара в крови ниже целевого.</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_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="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_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>
|
||||
|
|
|
@ -495,11 +495,12 @@ class DataHandlerMobile @Inject constructor(
|
|||
val message = rh.gs(R.string.quick_wizard_message, quickWizardEntry.buttonText(), wizard.calculatedTotalInsulin, quickWizardEntry.carbs()) +
|
||||
"\n_____________\n" + wizard.explainShort()
|
||||
|
||||
lastBolusWizard = wizard
|
||||
rxBus.send(
|
||||
EventMobileToWear(
|
||||
EventData.ConfirmAction(
|
||||
rh.gs(app.aaps.core.ui.R.string.confirm).uppercase(), message,
|
||||
returnCommand = EventData.ActionBolusConfirmed(insulinAfterConstraints, carbsAfterConstraints)
|
||||
returnCommand = EventData.ActionWizardConfirmed(wizard.timeStamp)
|
||||
)
|
||||
)
|
||||
)
|
||||
|
|
|
@ -351,4 +351,5 @@
|
|||
<string name="until">עד</string>
|
||||
<string name="default_range">טווח ברירת מחדל</string>
|
||||
<string name="target">מטרה</string>
|
||||
<string name="rate_duration">מינון: %1$.2f יח\'\\שעה (%2$.2f%%) \nמשך: %3$d דק\'</string>
|
||||
</resources>
|
||||
|
|
|
@ -137,10 +137,10 @@
|
|||
<string name="delete_current_profile">Slette gjeldende profil?</string>
|
||||
<string name="units_colon">Enheter:</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_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="invalid_profile_not_accepted">Ugyldig profil %1$s ikke akseptert fra NS</string>
|
||||
<string name="view">Visning</string>
|
||||
|
@ -157,7 +157,7 @@
|
|||
<string name="actions">Handlinger</string>
|
||||
<string name="description_actions">Hurtigknapper for rask tilgang til ofte brukte funksjoner</string>
|
||||
<string name="actions_shortname">ACT</string>
|
||||
<string name="tempbasal_button">MidlBasal</string>
|
||||
<string name="tempbasal_button">Midlertidig basal</string>
|
||||
<string name="extended_bolus_button">Forlenget bolus</string>
|
||||
<string name="extended_bolus_cancel_button">Avbryt forlenget bolus</string>
|
||||
<string name="tools">Verktøy</string>
|
||||
|
@ -170,8 +170,8 @@
|
|||
<string name="cannula">Kanyle</string>
|
||||
<string name="ebstopsloop">Bruk av forlenget bolusfunksjon vil deaktivere lukket loop i perioden med forlenget bolus. Vil du virkelig dette?</string>
|
||||
<string name="statuslights_cannula_age">kanyle alder</string>
|
||||
<string name="statuslights_patch_pump_age">patch pumpe alder</string>
|
||||
<string name="patch_pump">Patch pumpe</string>
|
||||
<string name="statuslights_patch_pump_age">pumpealder</string>
|
||||
<string name="patch_pump">Pumpe</string>
|
||||
<!-- Overview -->
|
||||
<string name="show_statuslights">Vis statusindikatorer på hjem-skjermen</string>
|
||||
<string name="statuslights_cage_warning">Terskel for advarsel om alder på slangesett [h]</string>
|
||||
|
@ -212,26 +212,26 @@
|
|||
<string name="openaps">OpenAPS</string>
|
||||
<string name="uploader">Opplaster</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_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="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="firstinsulinincrement">Første økning hurtigknapp for insulin</string>
|
||||
<string name="secondinsulinincrement">Andre økning hurtigknapp for insulin</string>
|
||||
<string name="thirdinsulinincrement">Tredje økning hurtigknapp for insulin</string>
|
||||
<string name="firstcarbsincrement">Første økning hurtigknapp for karbohydrater</string>
|
||||
<string name="secondcarbsincrement">Andre økning hurtigknapp for karbohydrater</string>
|
||||
<string name="thirdcarbsincrement">Tredje økning hurtigknapp for karbohydrater</string>
|
||||
<string name="firstinsulinincrement">Første økning knapp for insulin</string>
|
||||
<string name="secondinsulinincrement">Andre økning knapp for insulin</string>
|
||||
<string name="thirdinsulinincrement">Tredje økning knapp for insulin</string>
|
||||
<string name="firstcarbsincrement">Første økning knapp for karbohydrater</string>
|
||||
<string name="secondcarbsincrement">Andre økning knapp for karbohydrater</string>
|
||||
<string name="thirdcarbsincrement">Tredje økning knapp for karbohydrater</string>
|
||||
<string name="cgm">CGM</string>
|
||||
<string name="default_temptargets">Standard midl. mål</string>
|
||||
<string name="eatingsoon_duration">spise snart varighet</string>
|
||||
<string name="eatingsoon_target">spise snart målverdi</string>
|
||||
<string name="activity_duration">varighet for aktivitet</string>
|
||||
<string name="activity_target">målverdi ved aktivitet</string>
|
||||
<string name="hypo_duration">hypo varighet</string>
|
||||
<string name="hypo_target">hypo målverdi</string>
|
||||
<string name="default_temptargets">Standard midlertidig mål</string>
|
||||
<string name="eatingsoon_duration">Spise snart varighet (min)</string>
|
||||
<string name="eatingsoon_target">Spise snart målverdi</string>
|
||||
<string name="activity_duration">Aktivitet varighet (min)</string>
|
||||
<string name="activity_target">Aktivitet målverdi</string>
|
||||
<string name="hypo_duration">Hypo varighet (min)</string>
|
||||
<string name="hypo_target">Hypo målverdi</string>
|
||||
<string name="fill_bolus_title">Standardverdier for påfyll/prime</string>
|
||||
<string name="button1">Knapp 1</string>
|
||||
<string name="button2">Knapp 2</string>
|
||||
|
@ -241,23 +241,23 @@
|
|||
<string name="low_mark">Lav verdi</string>
|
||||
<string name="high_mark">Høy verdi</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="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_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">Aktiver bolusveileder</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_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_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>
|
||||
<!-- OverviewMenu-->
|
||||
<string name="overview_show_predictions">Prognoser</string>
|
||||
<string name="overview_show_treatments">Behandlinger</string>
|
||||
<string name="overview_show_heartRate">Puls</string>
|
||||
<string name="overview_show_deviation_slope">Avvikskurve</string>
|
||||
<string name="overview_show_activity">Aktivitet</string>
|
||||
<string name="overview_show_bgi">Blodsukkerpåvirkning</string>
|
||||
<string name="overview_show_activity">Insulinaktivitet</string>
|
||||
<string name="overview_show_bgi">BS-påvirkning (BGI)</string>
|
||||
<string name="overview_show_sensitivity">Sensitivitet</string>
|
||||
<string name="overview_show_deviations">Avvik</string>
|
||||
<string name="overview_show_cob">Aktive KH (COB)</string>
|
||||
|
@ -266,7 +266,7 @@
|
|||
<string name="overview_show_abs_insulin">Absolutt insulinmengde</string>
|
||||
<string name="prediction_shortname">PROGN</string>
|
||||
<string name="basal_shortname">BAS</string>
|
||||
<string name="deviation_shortname">DEV</string>
|
||||
<string name="deviation_shortname">AVVIK</string>
|
||||
<string name="activity_shortname">AKT</string>
|
||||
<string name="bgi_shortname">-BGI</string>
|
||||
<string name="abs_insulin_shortname">ABS</string>
|
||||
|
@ -274,7 +274,7 @@
|
|||
<string name="treatments_shortname">BEH</string>
|
||||
<string name="heartRate_shortname">HR</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>
|
||||
<!-- Skins -->
|
||||
<string name="classic_description">Opprinnelig visningstema</string>
|
||||
|
@ -291,9 +291,9 @@
|
|||
<string name="no_watch_connected">(Ingen klokke tilkoblet)</string>
|
||||
<string name="pump_status">Pumpestatus</string>
|
||||
<string name="loop_status">Loopstatus</string>
|
||||
<string name="wizard_result">Kalkulator hurtigveiviser:\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_message">Hurtigveiviser: %1$s\ninsulin: %2$.2fE\nKarbo: %3$dg</string>
|
||||
<string name="wizard_result">Boluskalkulator:\nInsulin: %1$.2fE\nKarbo: %2$dg</string>
|
||||
<string name="quick_wizard_not_available">Den valgte hurtigknappen er ikke lenger tilgjengelig, oppdater klokkeflis</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_cancel_message">Avbryt gjeldende midl. mål?</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="wearcontrol_title">Kontroller fra klokke</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_notifysmb_title">Varsle ved SMB</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="hour_short">t</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="no_profile">Ingen profil valgt</string>
|
||||
<string name="aps_only">Bare bruk i APS-modus!</string>
|
|
@ -2,7 +2,7 @@
|
|||
<resources>
|
||||
<string name="smoothing_shortname">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="description_avg_smoothing">"Gjennomsnittlig utjevnings-algoritme, nyeste verdi påvirkes ikke"</string>
|
||||
<string name="no_smoothing_name">Ingen utjevning</string>
|
|
@ -34,6 +34,5 @@
|
|||
<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="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="direction">retning</string>
|
||||
</resources>
|
|
@ -4,6 +4,9 @@ import app.aaps.core.interfaces.logging.AAPSLogger
|
|||
import app.aaps.core.interfaces.logging.LTag
|
||||
import app.aaps.core.interfaces.plugin.ActivePlugin
|
||||
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.sync.DataSyncSelector
|
||||
import app.aaps.core.interfaces.sync.DataSyncSelectorXdrip
|
||||
|
@ -25,7 +28,8 @@ class DataSyncSelectorXdripImpl @Inject constructor(
|
|||
private val profileFunction: ProfileFunction,
|
||||
private val activePlugin: ActivePlugin,
|
||||
private val xdripBroadcast: Lazy<XDripBroadcast>,
|
||||
private val appRepository: AppRepository
|
||||
private val appRepository: AppRepository,
|
||||
private val rxBus: RxBus
|
||||
) : DataSyncSelectorXdrip {
|
||||
|
||||
class QueueCounter(
|
||||
|
@ -72,7 +76,17 @@ class DataSyncSelectorXdripImpl @Inject constructor(
|
|||
|
||||
override fun queueSize(): Long = queueCounter.size()
|
||||
|
||||
private var running = false
|
||||
private val sync = Any()
|
||||
|
||||
override suspend fun doUpload() {
|
||||
synchronized(sync) {
|
||||
if (running) {
|
||||
rxBus.send(EventXdripNewLog("RUN", "Already running"))
|
||||
return
|
||||
}
|
||||
running = true
|
||||
}
|
||||
if (isEnabled) {
|
||||
processChangedGlucoseValues()
|
||||
processChangedBoluses()
|
||||
|
@ -96,6 +110,7 @@ class DataSyncSelectorXdripImpl @Inject constructor(
|
|||
// not supported at the moment
|
||||
//processChangedProfileStore()
|
||||
}
|
||||
running = false
|
||||
}
|
||||
|
||||
override fun resetToNextFullSync() {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue