START_TEST(db_getinfo_fails_with_no_open_db)
{
defaultcfg();
+ suppress_output();
ck_assert_int_eq(strlen(db_getinfo("foofoo")), 0);
}
START_TEST(db_setinfo_fails_with_no_open_db)
{
defaultcfg();
+ suppress_output();
ck_assert_int_eq(db_setinfo("foo", "bar", 0), 0);
ck_assert_int_eq(db_setinfo("foo", "bar", 1), 0);
START_TEST(db_addtraffic_with_no_traffic_does_nothing)
{
defaultcfg();
+ suppress_output();
ck_assert_int_eq(db_addtraffic("eth0", 0, 0), 0);
}
START_TEST(db_setactive_fails_with_no_open_db)
{
defaultcfg();
+ suppress_output();
ck_assert_int_eq(db_setactive("eth0", 0), 0);
ck_assert_int_eq(db_setactive("eth0", 1), 0);
START_TEST(db_setalias_fails_with_no_open_db)
{
defaultcfg();
+ suppress_output();
+
ck_assert_int_eq(db_setalias("eth0", "The Internet"), 0);
}
END_TEST
START_TEST(db_setupdated_fails_with_no_open_db)
{
defaultcfg();
+ suppress_output();
ck_assert_int_eq(db_setupdated("eth0", 123456), 0);
}
int ret;
defaultcfg();
+ suppress_output();
ret = db_addinterface("eth0");
ck_assert_int_eq(ret, 0);
int ret;
defaultcfg();
+ suppress_output();
ret = db_open(1);
ck_assert_int_eq(ret, 1);
uint64_t ret;
defaultcfg();
+ suppress_output();
ret = db_open(1);
ck_assert_int_eq(ret, 1);