1
0
Fork 0
forked from AbleOS/ableos
ableos/sysdata/programs/test/src/tests/stn/formatters.hb
2024-12-17 13:50:04 +00:00

29 lines
776 B
Plaintext

.{formatters: .{format, format_args, DEFAULT_OPTS}, log, memory, math} := @use("stn");
.{Color} := @use("lib:render")
Thingy := struct {
a: uint,
b: int,
c: SubThingy,
}
SubThingy := struct {
a: f32,
b: bool,
}
test := fn(): uint {
buffer := memory.request_page(1)
log.info(format(Thingy, .(-100, -100, .(-math.PI, true)), buffer))
log.info(format(SubThingy, .(-math.E, false), buffer))
log.info(format_args(Color, .{r: 255, g: 254, b: 253, a: 252}, buffer, .{
decimal_digits: DEFAULT_OPTS.decimal_digits,
radix: 16,
}))
// default value: .{decimal_digits: 2}
log.info(format_args(f64, math.LN_2, buffer, .{decimal_digits: 1 << 32, radix: 16}))
log.info(format([u8; 3], .(1, 2, 3), buffer))
log.info(format(^SubThingy, &.(0.0, true), buffer))
return 0
}