Bring the tests up to date with today's app

Astral Projection runs 40 minutes, habits store their coin level, package
modules are generated under their package prefix, and the Elist link test
names the modules the cells now use. Tests that load apps without Radio's
playback get silent stand-ins.
This commit is contained in:
waozi committed 2026-10-19 20:22:15 -03:00
1 parent 9d56ac9a98
commit be56541465
10 files changed
+74 -6

No files matched your search

+2 -2
View File
@@ -13,7 +13,7 @@ course = json.loads((folder / 'session.json').read_text())
config = json.loads((ROOT / 'design/astral-projection/narration.json').read_text())
keys = [cue['key'] for cue in course['cues']]
assert keys == speech.narration_keys(config)
assert course['schema'] == 1 and course['duration'] == 900
assert course['schema'] == 1 and course['duration'] == 2400
assert course['cues'][0]['second'] == 0
times = [cue['second'] for cue in course['cues']] + [course['duration']]
assert all(a < b for a, b in zip(times, times[1:]))
@@ -34,4 +34,4 @@ if receipt_path.is_file():
code, key = name.split('/')
index = keys.index(key)
assert clip['seconds'] + 1 < times[index + 1] - times[index], name
print('All eight guidance cues have complete translations in all 12 locales')
print(f'All {len(keys)} guidance cues of the 40-minute session have complete translations in all 12 locales')
+5
View File
@@ -21,6 +21,11 @@ bool IsAudioDeviceReady(void)
return ready;
}
// Radio's background playback is not part of a cue's first frame.
void BackgroundAudioInterrupt(void)
{
}
void CloseAudioDevice(void)
{
ready = false;
+36
View File
@@ -0,0 +1,36 @@
// Radio's background playback for tests that load node apps without
// app/background_audio.zi: nothing plays.
#program_export "BackgroundAudioStart"
StubBackgroundAudioStart :: (owner: s32, url: string) -> bool {
unused owner
unused url
return false
}
#program_export "BackgroundAudioStop"
StubBackgroundAudioStop :: (owner: s32) {
unused owner
}
#program_export "BackgroundAudioVolume"
StubBackgroundAudioVolume :: (owner: s32, percent: s32) -> bool {
unused owner
unused percent
return false
}
#program_export "BackgroundAudioState"
StubBackgroundAudioState :: (owner: s32) -> s32 {
unused owner
return 0
}
#program_export "BackgroundAudioActive"
StubBackgroundAudioActive :: () -> bool {
return false
}
#program_export "BackgroundAudioInterrupt"
StubBackgroundAudioInterrupt :: () {
}
+6
View File
@@ -90,6 +90,12 @@ String storage_get_setting_text(String key)
return (String){0};
}
bool storage_setting_present(String key)
{
(void)key;
return false;
}
void *sqlite3_db_mutex(void *database)
{
(void)database;
+10 -1
View File
@@ -18,6 +18,15 @@ USER_ID = "a" * 64
NONCE = "c" * 64
def GeneratedSource(generated, name):
"""A generated C file; package modules carry their package's prefix."""
path = generated / name
if path.exists():
return path
prefixed = sorted(path.parent.glob("p" + "[0-9a-f]" * 16 + "_" + path.name))
return prefixed[0] if len(prefixed) == 1 else path
class Handler(BaseHTTPRequestHandler):
friends_requests = 0
registrations = 0
@@ -137,7 +146,7 @@ with tempfile.TemporaryDirectory(prefix="inbe-daochi-native-") as temporary:
f"-I{ROOT / 'build/packages/ziran/include'}", f"-I{generated}",
f"-I{generated / 'storage'}",
str(ROOT / "tests/daochi_native_zi_test.c"),
*(str(generated / source) for source in sources),
*(str(GeneratedSource(generated, source)) for source in sources),
"-l:libcurl.so.4", "-o", str(executable),
], check=True)
server = ThreadingHTTPServer(("127.0.0.1", 0), Handler)
+4 -1
View File
@@ -4,6 +4,7 @@
from pathlib import Path
import argparse
import os
import re
import subprocess
import tempfile
@@ -29,8 +30,10 @@ with tempfile.TemporaryDirectory(prefix="inbe-device-key-") as temporary:
], check=True)
names = {"device_key_store.c", "device_key.c", "crypto.c",
"keys.c", "byte_text_linux.c", "Oqs.c", "update_transport.c"}
# Package modules are generated under their package's prefix,
# such as p0123456789abcdef_Oqs.c.
sources = sorted(str(path) for path in generated.rglob("*.c")
if path.name in names)
if path.name in names or re.sub(r"^p[0-9a-f]{16}_", "", path.name) in names)
monocypher = ROOT / "build/packages/monocypher/src"
subprocess.run([
args.emcc if args.wasm else os.environ.get("CC", "cc"), "-std=c11", "-O0", "-Wall", "-Wextra",
+6 -1
View File
@@ -38,7 +38,12 @@ mkdir -p "$work/c"
"$work/c/sun_salutation_inventory.c" \
"$work/c/lists_visibility.c" "$work/c/bundle_host.c" \
"$work/c/hosted_values.c" "$work/c/widget_host.c" "$work/c/hosted_app.c" \
"$root/build/ziran-toolchain/libziran.a" -lm \
"$work/c/bundle_preload.c" "$work/c/thread_linux.c" "$work/c/catalog.c" \
"$work/c/app_context_host.c" "$work/c/achievement_packages.c" \
"$work/c/achievements.c" "$work/c/bundle_names.c" "$work/c/date_parse.c" \
"$work/c/diary_wire.c" "$work/c/widget_codec.c" \
"$work/c/achievement_records.c" "$work/c/number_text.c" "$work/c/text_buffer.c" \
"$root/build/ziran-toolchain/libziran.a" -lm -lpthread \
-o "$work/test"
env -u DISPLAY -u WAYLAND_DISPLAY "$work/test" "$root/build/inbe.zib"
echo "Inbe elist screen Ziran/native test passed"
+1
View File
@@ -16,6 +16,7 @@
#import, file "../src/core/types.zi";
#import, file "../src/screens/habits/edit.zi";
#import, file "cells_test_fixture.zi";
#import, file "background_audio_stub.zi";
using HabitSyncMode;
+1
View File
@@ -18,6 +18,7 @@
#import, file "../src/practices/session_results.zi";
#import, file "../src/practices/meditation/meditation_practice.zi";
#import, file "../src/practices/meditation/meditation_session.zi";
#import, file "background_audio_stub.zi";
c :: #system_library "c";
pause_microseconds :: (microseconds: u32) -> s32 #foreign c "usleep";
+3 -1
View File
@@ -62,7 +62,9 @@ db.executescript(
span INTEGER NOT NULL DEFAULT 0,
span_goal INTEGER NOT NULL DEFAULT 0,
span_low INTEGER NOT NULL DEFAULT 0,
span_high INTEGER NOT NULL DEFAULT 0);
span_high INTEGER NOT NULL DEFAULT 0,
difficulty INTEGER NOT NULL DEFAULT 0,
coins_from INTEGER NOT NULL DEFAULT 0);
CREATE TABLE habit_entries(
id TEXT PRIMARY KEY, user_id TEXT, habit_id TEXT, local_date INTEGER,
started_at INTEGER, ended_at INTEGER, answers TEXT,