Files
breeze/tests/lumi_engine_behavior.zi
waozi dc1d003cd8 Merge pending Breeze work: Photos as its own app, Opus voice packs, 2.1.63 notes
Photos downloads from Apps instead of shipping in Breeze, practice and
guide voice clips move to Ogg Opus, dependencies update (Ziran, Kryon,
Apps, Arcade, practices), and the 2.1.63 version and store notes are
prepared. The Practice tab note is translated in every locale.
2026-11-06 21:58:14 -03:00

177 lines
7.7 KiB
Ziran

#import, file "../apps/lumi/engine.zi";
#import, file "../apps/lumi/regex.zi";
#import, file "../src/apps/lumi_types.zi";
#import, file "../src/app/route_types.zi";
using AppNavRoute;
#program_export
Answer :: () -> s32 {
commands := LumiCommands.{.add = "Añadir tarea", .complete = "Completar tarea",
.reopen = "Reabrir tarea", .lists = "Abrir Listas", .habits = "Abrir Hábitos",
.practices = "Abrir Prácticas", .diary = "Abrir Diario",
.complete_habit = "Completar hábito", .start_whm = "Iniciar WHM",
.write_diary = "Escribir en el Diario"}
reports: [15]string = .["fix the lag in Lumi", "/feedback Lists should have a checkmark", "Feedback: switching apps freezes",
"Suggestion: add reminders", "Feature request: widget for habits", "The app should remember my sidebar order",
"I wish the app had offline voice input", "Lumi should format bold text", "/suggest make practice easier to find",
"App idea: let me export my habits", "Bug: the cursor jumps to the beginning",
"Bug report: I cannot type while Lumi answers", "There is a bug in Lists",
"There's a bug in Lumi", "I found a bug when correcting text"]
for report: reports {
feedback := LumiIntent(report, commands)
if feedback.kind != LUMI_REPORT_FEEDBACK || feedback.title != report ||
!LumiActionAvailable(feedback, 0) {
return 43
}
}
if LumiIntent("/feedbackX wrong", commands).kind != 0 {
return 44
}
if LumiIntent("/suggestX wrong", commands).kind != 0 ||
LumiIntent("suggest a breathing practice", commands).kind != 0 ||
LumiIntent("I wish I felt better today", commands).kind != 0 {
return 45
}
diary_report := LumiIntent("write to my diary: suggestion: improve my sleep", commands)
if diary_report.kind != LUMI_WRITE_DIARY || diary_report.title != "suggestion: improve my sleep" {
return 46
}
action := LumiIntent(" /todo Comprar té ", commands)
if action.kind != LUMI_ADD_TODO || action.title != "Comprar té" {
return 1
}
action = LumiIntent("Completar tarea Comprar té", commands)
if action.kind != LUMI_COMPLETE_TODO || action.title != "Comprar té" {
return 2
}
action = LumiIntent("/reopen 水を飲む", commands)
if action.kind != LUMI_REOPEN_TODO || action.title != "水を飲む" {
return 3
}
action = LumiIntent("Abrir Hábitos", commands)
if action.kind != LUMI_OPEN || action.route != APP_NAV_ROUTE_HABITS {
return 4
}
action = LumiIntent("/lists", commands)
if action.kind != LUMI_OPEN || action.route != APP_NAV_ROUTE_ELIST {
return 5
}
if LumiIntent("/todo", commands).kind != 0 || LumiIntent("/todo ", commands).kind != 0 ||
LumiIntent("delete everything", commands).kind != 0 || LumiIntent("/todoX wrong", commands).kind != 0 {
return 6
}
if !LumiStarts("Drink Water", "drink w") || LumiEqual("Drink Water", "drink") ||
!LumiEqual("Drink Water", "DRINK WATER") || LumiStarts("Tea", "Tea time") {
return 7
}
action = LumiIntent("ADD TODO Walk", commands)
if action.kind != LUMI_ADD_TODO || action.title != "Walk" {
return 8
}
action = LumiIntent("START WHM", commands)
if action.kind != LUMI_START_PRACTICE || action.practice != 0 ||
!LumiActionAvailable(action, LUMI_PRACTICES) || LumiActionAvailable(action, LUMI_HABITS) {
return 9
}
action = LumiIntent("Iniciar WHM", commands)
if action.kind != LUMI_START_PRACTICE || action.practice != 0 {
return 10
}
action = LumiIntent("Completar hábito Beber agua", commands)
if action.kind != LUMI_COMPLETE_HABIT || action.title != "Beber agua" ||
!LumiActionAvailable(action, LUMI_HABITS) || LumiActionAvailable(action, LUMI_LISTS) {
return 11
}
if LumiActionAvailable(LumiIntent("/todo Walk", commands), LUMI_HABITS | LUMI_PRACTICES) ||
LumiActionAvailable(LumiIntent("/lists", commands), LUMI_DIARY) ||
LumiIntent("start whm then delete all", commands).kind != 0 {
return 12
}
practice_inputs: [5]string = .["start whm", "start meditation", "start sun salutation", "start breathing patterns",
"start tai chi"]
for index: cast(s32)0..cast(s32)4 {
action = LumiIntent(practice_inputs[index], commands)
if action.kind != LUMI_START_PRACTICE || action.practice != index {
return 20 + index
}
}
action = LumiIntent(" START meditaiton ", commands)
if action.kind != LUMI_START_PRACTICE || action.practice != 1 {
return 30
}
action = LumiIntent("strat meditation!", commands)
if action.kind != LUMI_START_PRACTICE || action.practice != 1 {
return 31
}
action = LumiIntent("cmplete habit", commands)
if action.kind != LUMI_COMPLETE_HABIT || action.title.count != 0 {
return 32
}
if !LumiEqual("HÁBITOS", "hábitos") || !LumiStarts("ПРИВЫЧКА", "прив") ||
LumiIntent("start meditaiton delete everything", commands).kind != 0 {
return 33
}
if !LumiSuggests("Complete habit", "cmplete hab") ||
!LumiSuggests("Start meditation", "START medi") ||
LumiSuggests("Start meditation", "stop medi") {
return 34
}
if !RegexMatch("^start\\s+meditation[.!?]*$", "START\tmeditation!") ||
RegexMatch("^start\\s+meditation$", "start meditation then delete") {
return 35
}
action = LumiIntent("/theme forest", commands)
if action.kind != LUMI_SET_THEME || action.title != "forest" || !LumiActionAvailable(action, 0) {
return 36
}
action = LumiIntent("dark mode", commands)
if action.kind != LUMI_SET_MODE || action.route != 2 || !LumiActionAvailable(action, 0) {
return 37
}
action = LumiIntent("/settings", commands)
if action.kind != LUMI_OPEN || action.route != APP_NAV_ROUTE_SETTINGS || !LumiActionAvailable(action, 0) {
return 38
}
if LumiIntent("dark mode then delete all", commands).kind != 0 {
return 39
}
diary_inputs: [4]string = .["write this to my diary: A calm morning\nThen a walk",
"write to my diary A calm morning\nThen a walk",
"/journal: A calm morning\nThen a walk",
"Escribir en el Diario:\nA calm morning\nThen a walk"]
for input: diary_inputs {
action = LumiIntent(input, commands)
if action.kind != LUMI_WRITE_DIARY || action.title != "A calm morning\nThen a walk" ||
!LumiActionAvailable(action, LUMI_DIARY) || LumiActionAvailable(action, LUMI_LISTS) {
return 40
}
}
action = LumiIntent("write this to my diary:", commands)
if action.kind != LUMI_WRITE_DIARY || action.title.count != 0 {
return 41
}
action = LumiIntent("/diary", commands)
if action.kind != LUMI_OPEN || action.route != APP_NAV_ROUTE_DIARY {
return 43
}
action = LumiIntent("/progress retention 30", commands)
if action.kind != LUMI_SHOW_PROGRESS || action.practice != LUMI_PROGRESS_RETENTION ||
action.route != 30 || !LumiActionAvailable(action, LUMI_PRACTICES) || LumiActionAvailable(action, LUMI_HABITS) {
return 44
}
if LumiIntent("/progress habits 31", commands).practice != LUMI_PROGRESS_HABITS ||
LumiIntent("/progress meditation 0", commands).kind != 0 ||
LumiIntent("/progress sessions 32", commands).kind != 0 ||
LumiIntent("/progress sessions 7 delete", commands).kind != 0 ||
LumiIntent("show my progress", commands).kind != LUMI_SHOW_PROGRESS ||
LumiIntent("/donate", commands).kind != 0 || LumiIntent("show donation links", commands).kind != 0 {
return 45
}
commands.progress = "Mostrar progreso"
if LumiIntent("Mostrar progreso", commands).kind != LUMI_SHOW_PROGRESS {
return 46
}
return 42
}