Пример #1
0
TEST(StringBuilderTest, Clear)
{
    StringBuilder builder;
    builder.append("0123456789");
    builder.clear();
    expectEmpty(builder);
}
Пример #2
0
TEST(StringBuilderTest, Resize)
{
    StringBuilder builder;
    builder.append("0123456789");
    builder.resize(10);
    EXPECT_EQ(10U, builder.length());
    expectBuilderContent("0123456789", builder);
    builder.resize(8);
    EXPECT_EQ(8U, builder.length());
    expectBuilderContent("01234567", builder);

    builder.toString();
    builder.resize(7);
    EXPECT_EQ(7U, builder.length());
    expectBuilderContent("0123456", builder);
    builder.resize(0);
    expectEmpty(builder);
}
Пример #3
0
StringMath::Token StringMath::parseExpressionList() {
    // ExpressionList ::= (Expression (',' Expression)*)? Empty
    Token result;

    if(!lexer.peekToken().isEmpty()) {
        while(true) {
            result = parseExpression();

            if(!lexer.peekToken().isSymbol(","))
                break;

            lexer.popToken();
        }
    }

    expectEmpty();

    // store the last answer
    variables["ans"] = result;
    return result;
}
Пример #4
0
TEST(StringBuilderTest, DefaultConstructor)
{
    StringBuilder builder;
    expectEmpty(builder);
}