Skip to content

Commit

Permalink
valgrind test
Browse files Browse the repository at this point in the history
  • Loading branch information
randaz81 committed Aug 1, 2023
1 parent 112a889 commit 3ddf07e
Showing 1 changed file with 0 additions and 77 deletions.
77 changes: 0 additions & 77 deletions src/libYARP_serversql/tests/ServerTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,83 +33,6 @@ TEST_CASE("serversql::ServerTest", "[yarp::serversql]")
Contact addr1 = nic.queryName("/check/register1");
CHECK(addr1.isValid()); // got an address
CHECK(addr1.getCarrier() == "tcp"); // correct carrier

nic.registerName("/check/register2");
Contact addr2 = nic.queryName("/check/register2");
CHECK(addr2.isValid()); // got a second address
CHECK(addr1.getPort()!=addr2.getPort()); // different port number
CHECK(addr1.getHost()==addr2.getHost()); // same machine

Contact addr3 = nic.queryName("/check/register1");
CHECK(addr3.isValid()); // first address still there
CHECK(addr1.getPort() == addr3.getPort()); // same port number

Contact addr4 = nic.queryName("/check/register2");
CHECK(addr4.isValid()); // second address still there
CHECK(addr2.getPort() == addr4.getPort()); // same port number
}

SECTION("check register forced")
{
INFO("checking forced register command...");
NameClient& nic = NameClient::getNameClient();
Contact addr1("tcp", "localhost", 9999);
nic.registerName("/check/register/forced",addr1);
Contact addr2 = nic.queryName("/check/register/forced");
CHECK(addr1.isValid()); // got an address
CHECK(addr1.getHost() == addr2.getHost()); // same machine
CHECK(addr1.getPort() == addr2.getPort()); // same port number
//Contact a2 = nic.queryName("/bar2");
//CHECK(a2.isValid() == false); // non-existent address
}

SECTION("check unregister")
{
INFO("checking unregister command...");
NameClient& nic = NameClient::getNameClient();
nic.registerName("/check/unregister");
Contact addr1 = nic.queryName("/check/unregister");
CHECK(addr1.isValid()); // got an address
nic.unregisterName("/check/unregister");
Contact addr2 = nic.queryName("/check/unregister");
CHECK_FALSE(addr2.isValid()); // got no address
}

SECTION("check port register")
{
INFO("checking port registration...");
NameClient& nic = NameClient::getNameClient();
Port p;
Contact addr1 = nic.queryName("/check/port");
CHECK_FALSE(addr1.isValid()); // got an address
p.open("/check/port");
Contact addr2 = nic.queryName("/check/port");
CHECK(addr2.isValid()); // got no address
p.close();
Contact addr3 = nic.queryName("/check/port");
CHECK_FALSE(addr3.isValid()); // got an address
}

SECTION("check list")
{
INFO("checking list...");
NameClient& nic = NameClient::getNameClient();
Contact addr1("tcp", "192.168.1.100", 9998);
nic.registerName("/check/list",addr1);
std::string result = nic.send("NAME_SERVER list",true);
std::string target = "registration name /check/list ip 192.168.1.100 port 9998 type tcp";
CHECK(result.find(target)!=std::string::npos); // listing found
}

SECTION("check set get")
{
INFO("checking set/get...");
NameClient& nic = NameClient::getNameClient();
nic.registerName("/check/set");
std::string result = nic.send("NAME_SERVER set /check/set prop val",true);
result = nic.send("NAME_SERVER get /check/set prop",true);
std::string target = "port /check/set property prop = val";
CHECK(result.find(target)!=std::string::npos); // answer found
}

Network::setLocalMode(false);
Expand Down

0 comments on commit 3ddf07e

Please sign in to comment.