aboutsummaryrefslogtreecommitdiff
path: root/src/tests/print.cpp
blob: dcd1033af75e91b9898a738b8b95b6b0a6de8695 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include <bu/sio.h>

int upper()
{
    static int iVal = 1;
    return iVal++;
}

int main()
{
    int32_t x = INT32_MIN;
    int32_t y = -x;
    Bu::sio << INT32_MIN;
    Bu::println("Attack: Rolled %1 against %2 using %3.").
        arg( INT32_MIN ).arg( 45.0 ).arg( Bu::String("Longsword") );
    Bu::print("hello there %1!\n").arg("Bob");

    Bu::println("This is %1 crazy, like %2 times over!").
        arg("totally").arg( 47.2 ).end();
    Bu::println("This is unsubstituted?");

    Bu::serr << "This is error text." << Bu::serr.nl;
    Bu::println( Bu::serr, "This is also error text?");

    Bu::println("This is %{1}000  - %{1}.").arg( 34, Bu::Fmt().width(10).fill('0') );

    Bu::String s = Bu::String("hello %1").arg("bob %1").end().toLower().arg("yo");

    Bu::println( s );
    Bu::println("Hello %%1");

    Bu::println("Nums: %1, %2, %3, %4, %5, %6").arg( upper() ).arg( upper() ).arg( upper() ).arg( upper() ).arg( upper() ).arg( upper() );

    return 0;
}