mirror of
https://github.com/c3lang/c3c.git
synced 2026-02-27 12:01:16 +00:00
* lib/std/time: avoid switch in DateTime.compare_to() * lib/std/time: add NanoDuration.to_format() * std/lib: fix #934
20 lines
846 B
C
20 lines
846 B
C
module std::io @test;
|
|
|
|
fn void printf_a()
|
|
{
|
|
String s;
|
|
s = string::printf("%08.2a", 234.125);
|
|
assert(s == "0x1.d4p+7", "got '%s'; want '0x1.d4p+7'", s);
|
|
s = string::printf("%a", 234.125);
|
|
assert(s == "0x1.d44p+7", "got '%s'; want '0x1.d44p+7'", s);
|
|
s = string::printf("%A", 234.125);
|
|
assert(s == "0X1.D44P+7", "got '%s'; want '0X1.D44P+7'", s);
|
|
s = string::printf("%20a", 234.125);
|
|
assert(s == " 0x1.d44p+7", "got '%s'; want ' 0x1.d44p+7'", s);
|
|
s = string::printf("%-20a", 234.125);
|
|
assert(s == "0x1.d44p+7 ", "got '%s'; want '0x1.d44p+7 '", s);
|
|
s = string::printf("%-20s", "hello world");
|
|
assert(s == "hello world ", "got '%s'; want 'hello world '", s);
|
|
s = string::printf("%20s", "hello world");
|
|
assert(s == " hello world", "got '%s'; want ' hello world'", s);
|
|
} |