Пример #1
0
/*
 * scan expecting 1 given token
 */
void
scan (tok_kind expect, token * tokp)
{
  get_token (tokp);
  if (tokp->kind != expect)
    expected1 (expect);
}
Пример #2
0
TEST(msdp_server_test, receiving_many_table_values_returns_many_tables)
{
    telnetpp::options::msdp::server server;
    std::vector<telnetpp::options::msdp::variable> variables;

    register_msdp_server_variable_reception(server, variables);
    activate_msdp_server(server);

    server.subnegotiate({
        1, 't', 'b', 'l', '0',
        2, 3,
              1, 'v', 'a', 'r', '0',
              2, 'v', 'a', 'l', '0',
           4,
        1, 't', 'b', 'l', '1',
        2, 3,
              1, 'v', 'a', 'r', '1',
              2, 'v', 'a', 'l', '1',
           4
    });

    telnetpp::options::msdp::variable expected0(
        "tbl0",
        std::vector<telnetpp::options::msdp::variable>{
            { "var0", "val0" }
        });
    telnetpp::options::msdp::variable expected1(
        "tbl1",
        std::vector<telnetpp::options::msdp::variable>{
            { "var1", "val1" }
        });

    ASSERT_EQ(size_t{2}, variables.size());
    ASSERT_EQ(expected0, variables[0]);
    ASSERT_EQ(expected1, variables[1]);
}