Files
breeze/tests/sync_review_behavior.zi
T
waozi cc9745835f Fix sync and import regressions from the Ziran port; port storage tests to Ziran
Found by running the old storage tests as Ziran behaviour tests against real SQLite: encrypted habit/habit-day/session/list records were serialised without most fields (malformed JSON, so habits could not sync between devices); the remote habit apply SQL was truncated to 2048 bytes; check-in import queries lacked their SELECT prefix. Adds sync round-trip, payload, habit and import tests.
2026-09-28 19:02:49 -03:00

36 lines
999 B
Ziran

#import, file "../src/app/text_buffers.zi";
#import, file "../src/storage/sync_review.zi";
#import "byte_text_linux"
c :: #system_library "c";
free :: (pointer: *void) #foreign c;
#program_export "asset_entry_at"
asset_entry_at :: (index: usize) -> *void {
return null
}
#program_export "asset_entry_total"
asset_entry_total :: () -> usize {
return 0
}
#program_export "app_text_from_cstring"
app_text_from_cstring :: (data: *u8, capacity: s32) -> string {
if data == null || capacity <= 0 { return "" }
length: s32 = 0
while length < capacity && data[length] != cast(u8)0 { length += 1 }
return TextFromBytes(BytesFromPointer(data, cast(u64)length))
}
#program_export
Check :: () -> s32 {
diff: *u8 = null
if storage_sync_review_diff_for_json("{}", 1, *diff) == 0 {
return 1
}
if diff == null { return 2 }
text := AppTextFromCString(diff, 65536)
if text != "No visible differences.\n" { return 3 }
free(cast(*void)diff)
return 0
}