extend some unit tests. primarily test_alert_manager and fixed a bug in alert_manager
This commit is contained in:
@@ -1162,7 +1162,29 @@ int test_main()
|
||||
TEST_EQUAL(print_entry(e), "{ 'a': 1, 'b': 'foo', 'c': [ 1 ] }");
|
||||
}
|
||||
|
||||
// TODO: test switch_underlying_buffer
|
||||
// test switch_underlying_buffer
|
||||
{
|
||||
char b1[] = "d1:ai1e1:b3:foo1:cli1e-i2ee1:dd1:xi1eee";
|
||||
char b2[] = "d1:ai1e1:b3:foo1:cli1e-i2ee1:dd1:xi1eee";
|
||||
|
||||
bdecode_node e;
|
||||
error_code ec;
|
||||
int pos;
|
||||
int ret = bdecode(b1, b1 + sizeof(b1)-1, e, ec, &pos);
|
||||
TEST_EQUAL(ret, -1);
|
||||
TEST_EQUAL(pos, 22);
|
||||
TEST_EQUAL(e.type(), bdecode_node::dict_t);
|
||||
|
||||
std::string string1 = print_entry(e);
|
||||
printf("%s\n", string1.c_str());
|
||||
|
||||
e.switch_underlying_buffer(b2);
|
||||
|
||||
std::string string2 = print_entry(e);
|
||||
printf("%s\n", string2.c_str());
|
||||
|
||||
TEST_EQUAL(string1, string2);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Reference in New Issue
Block a user