Fix unit tests.

This commit is contained in:
Christoph Heiss 2018-03-04 23:10:33 +01:00
parent 6c2cc7b444
commit 4258a48d7d
5 changed files with 13 additions and 13 deletions

View file

@ -83,7 +83,7 @@ string(STRIP "${tests}" tests)
add_custom_target(
tests
COMMAND for t in ${tests}\; do printf %s \"$$t: \"\; ./tests/$$t && echo success || echo failed\; done
COMMAND for t in ${tests}\; do printf %s \"$$t: \"\; ./tests/$$t\; [ $$? == 1 ] && echo success || echo failed\; done
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${tests}
COMMENT "Running tests")

View file

@ -16,13 +16,12 @@ int main()
client.command("set", "a", "1");
client.command("set", "b", "2");
client.command("del", "c");
auto result{client.command("mget", "a", "b", "c")};
return !(
result.type == resply::Result::Type::Array &&
result.array[0].type == resply::Result::Type::String && result.array[0].string == "1" &&
result.array[1].type == resply::Result::Type::String && result.array[1].string == "2" &&
result.array[2].type == resply::Result::Type::Nil
);
return result.type == resply::Result::Type::Array &&
result.array[0].type == resply::Result::Type::String && result.array[0].string == "1" &&
result.array[1].type == resply::Result::Type::String && result.array[1].string == "2" &&
result.array[2].type == resply::Result::Type::Nil;
}

View file

@ -16,5 +16,5 @@ int main()
auto result{client.command("ping")};
return !(result.type == resply::Result::Type::String && result.string == "PONG");
return result.type == resply::Result::Type::String && result.string == "PONG";
}

View file

@ -21,8 +21,8 @@ int main()
.command("incr", "a")
.send();
return !(result.size() == 3 &&
result[0].integer == 1 &&
result[1].integer == 2 &&
result[2].integer == 3);
return result.size() == 3 &&
result[0].type == resply::Result::Type::Integer && result[0].integer == 1 &&
result[1].type == resply::Result::Type::Integer && result[1].integer == 2 &&
result[2].type == resply::Result::Type::Integer && result[2].integer == 3;
}

View file

@ -33,5 +33,6 @@ int main()
client2.command("publish", "a", "pubsub-test");
auto message{result.get_future().get()};
return message.first == "a" && message.second == "pubusb-test";
return message.first == "a" && message.second == "pubsub-test";
}