mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-26 02:18:04 +01:00
Add hdel
This commit is contained in:
@@ -374,6 +374,50 @@ void RedisTest::testEval()
|
||||
|
||||
}
|
||||
|
||||
void RedisTest::testHDel()
|
||||
{
|
||||
if (!_connected)
|
||||
{
|
||||
std::cout << "Not connected, test skipped." << std::endl;
|
||||
return;
|
||||
}
|
||||
|
||||
delKey("myhash");
|
||||
|
||||
Command hset = Command::hset("myhash", "field1", "foo");
|
||||
try
|
||||
{
|
||||
Poco::Int64 value = _redis.execute<Poco::Int64>(hset);
|
||||
assert(value == 1);
|
||||
}
|
||||
catch(RedisException &e)
|
||||
{
|
||||
fail(e.message());
|
||||
}
|
||||
|
||||
Command hdel = Command::hdel("myhash", "field1");
|
||||
try
|
||||
{
|
||||
Poco::Int64 result = _redis.execute<Poco::Int64>(hdel);
|
||||
assert(result == 1);
|
||||
}
|
||||
catch(RedisException &e)
|
||||
{
|
||||
fail(e.message());
|
||||
}
|
||||
|
||||
hdel = Command::hdel("myhash", "field2");
|
||||
try
|
||||
{
|
||||
Poco::Int64 result = _redis.execute<Poco::Int64>(hdel);
|
||||
assert(result == 0);
|
||||
}
|
||||
catch(RedisException &e)
|
||||
{
|
||||
fail(e.message());
|
||||
}
|
||||
}
|
||||
|
||||
void RedisTest::testHSet()
|
||||
{
|
||||
if (!_connected)
|
||||
@@ -2438,6 +2482,7 @@ CppUnit::Test* RedisTest::suite()
|
||||
CppUnit_addTest(pSuite, RedisTest, testEcho);
|
||||
CppUnit_addTest(pSuite, RedisTest, testError);
|
||||
CppUnit_addTest(pSuite, RedisTest, testEval);
|
||||
CppUnit_addTest(pSuite, RedisTest, testHDel);
|
||||
CppUnit_addTest(pSuite, RedisTest, testHSet);
|
||||
CppUnit_addTest(pSuite, RedisTest, testIncr);
|
||||
CppUnit_addTest(pSuite, RedisTest, testIncrBy);
|
||||
|
||||
Reference in New Issue
Block a user