Replace the remaining .kry and C application sources with Ziran modules, move vendored dependencies to their current pointers, and add Ziran tests for the ported hosts and policies.
32 lines
823 B
Ziran
32 lines
823 B
Ziran
#import, file "../src/storage/session_mood.zi";
|
|
#import "c_string"
|
|
#import "byte_text_linux"
|
|
|
|
saved: bool;
|
|
checkin: SessionMoodCheckin;
|
|
|
|
#program_export
|
|
data_save_session_checkin :: (path: *u8, value: *SessionMoodCheckin) -> s32 {
|
|
saved = TextFromCString(path) == "session-1"
|
|
checkin = value.*
|
|
return ifx saved then 1 else 0
|
|
}
|
|
|
|
#program_export
|
|
main :: () -> s32 {
|
|
path: [32]u8
|
|
if !CopyCString("session-1", path[:]) {
|
|
return 1
|
|
}
|
|
if SaveSessionMood(null, 3) != 0 || SaveSessionMood(*path[0], 0) != 0 {
|
|
return 2
|
|
}
|
|
if SaveSessionMood(*path[0], 4) != 1 || !saved ||
|
|
checkin.mood_after != 4 || checkin.mood_before != 0 ||
|
|
checkin.energy != 0 || checkin.stress != 0 ||
|
|
checkin.note[0] != 0 || checkin.tags[0] != 0 {
|
|
return 3
|
|
}
|
|
return 0
|
|
}
|