Files
Aer/tests/printf_test.aer
T

41 lines
1.2 KiB
Plaintext

import 'console';
class Program {
private string $s = 'monkey';
private string $t = 'many monkeys';
private int $n = 43951789;
private int $u = -43951789;
private char $c = 65;
public void main() {
$this->testMonkey();
$this->testNumbers();
}
private void testMonkey() {
Console::Print("[%s]\n", $this->s);
Console::Print("[%10s]\n", $this->s);
Console::Print("[%-10s]\n", $this->s);
Console::Print("[%010s]\n", $this->s);
Console::Print("[%'#10s]\n", $this->s);
Console::Print("[%10.10s]\n", $this->t);
}
private void testNumbers() {
Console::Print("%%b = '%b'\n", $this->n);
Console::Print("%%c = '%c'\n", $this->c);
Console::Print("%%d = '%d'\n", $this->c);
Console::Print("%%d = '%d'\n", $this->n);
Console::Print("%%e = '%e'\n", $this->n);
Console::Print("%%u = '%u'\n", $this->n);
Console::Print("%%u = '%u'\n", $this->u);
Console::Print("%%f = '%f'\n", $this->n);
Console::Print("%%o = '%o'\n", $this->n);
Console::Print("%%s = '%s'\n", $this->n);
Console::Print("%%x = '%x'\n", $this->n);
Console::Print("%%X = '%X'\n", $this->n);
Console::Print("%%+d = '%+d'\n", $this->n);
Console::Print("%%+d = '%+d'\n", $this->u);
}
}