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.
48 lines
1.5 KiB
Ziran
48 lines
1.5 KiB
Ziran
#import, file "../src/practices/meditation/meditation_timing.zi";
|
|
|
|
#program_export
|
|
Answer :: () -> s32 {
|
|
step := AdvanceMeditationTime(60, 0, 1500)
|
|
if step.remaining_seconds != 59 || step.remainder_ms != 500 ||
|
|
step.elapsed_seconds != 1 || step.completed {
|
|
return -1
|
|
}
|
|
|
|
step = AdvanceMeditationTime(step.remaining_seconds, step.remainder_ms, 499)
|
|
if step.remaining_seconds != 59 || step.remainder_ms != 999 ||
|
|
step.elapsed_seconds != 0 || step.completed {
|
|
return -2
|
|
}
|
|
|
|
step = AdvanceMeditationTime(step.remaining_seconds, step.remainder_ms, 1)
|
|
if step.remaining_seconds != 58 || step.remainder_ms != 0 ||
|
|
step.elapsed_seconds != 1 || step.completed {
|
|
return -3
|
|
}
|
|
|
|
step = AdvanceMeditationTime(59, 0, 59000)
|
|
if step.remaining_seconds != 0 || step.remainder_ms != 0 ||
|
|
step.elapsed_seconds != 59 || !step.completed {
|
|
return -4
|
|
}
|
|
|
|
step = AdvanceMeditationTime(5, 250, 750)
|
|
if step.remaining_seconds != 4 || step.remainder_ms != 0 ||
|
|
step.elapsed_seconds != 1 || step.completed {
|
|
return -5
|
|
}
|
|
|
|
step = AdvanceMeditationTime(2, 0, 2147483647)
|
|
if step.remaining_seconds != 0 || step.remainder_ms != 647 ||
|
|
step.elapsed_seconds != 2147483 || !step.completed {
|
|
return -6
|
|
}
|
|
|
|
step = AdvanceMeditationTime(10, 900, 0)
|
|
if step.remaining_seconds != 10 || step.remainder_ms != 900 ||
|
|
step.elapsed_seconds != 0 || step.completed {
|
|
return -7
|
|
}
|
|
return 42
|
|
}
|