29: Unittests - royal-lang/rl GitHub Wiki

Unittests are a vital part of programming and thus Royal has built-in unittest support.

Using the unittest keyword you can create a unittest block which is the same as a function block and thus you can create your tests directly without distinct functions, libraries, attributes etc.

unittest
{
    ...
}

Example:

fn int add(int x, int y)
{
    return x + y;
}

unittest
{
    var result = add(10, 10);

    assert(result == 20);
}