Exemple #1
0
/**
 * Test that choice_option correctly validates its contruction parameters.
 */
TEST(choice_option_test, parameters)
{
    EXPECT_DEBUG_DEATH(qflags::choice_option("foo", {}, "bar"), "")
        << "Failed to assert when no choice values were provided.";

    EXPECT_DEBUG_DEATH(qflags::choice_option("foo", { "bar" }, "baz"), "")
        << "Failed to assert when default value is not a choice value.";

    EXPECT_DEBUG_DEATH(qflags::choice_option("foo", { "bar", "bar" }, "bar"), "")
        << "Failed to assert when choice values are not distinct.";
}
TEST(ExtensionSetTest, InvalidEnumDeath) {
  unittest::TestAllExtensions message;
  EXPECT_DEBUG_DEATH(
    message.SetExtension(unittest::optional_foreign_enum_extension,
                         static_cast<unittest::ForeignEnum>(53)),
    "IsValid");
}
Exemple #3
0
TEST_F(result, asserts_or_throws_out_of_range_on_attempt_to_increment_past_end) {
    sqlite::result results(
        db->execute("SELECT id, name FROM test WHERE id = 1;")
    );
    auto it(results.begin());
    EXPECT_NO_THROW(++it);
    EXPECT_DEBUG_DEATH(++it, "");
}
Exemple #4
0
TEST_F(row, throws_error_when_asked_for_non_existing_column_id) {
    sqlite::row row(make_row("SELECT * FROM test;"));
    EXPECT_DEBUG_DEATH(row[5], "");
}