Fix unit tests.
This commit is contained in:
parent
6c2cc7b444
commit
4258a48d7d
|
@ -83,7 +83,7 @@ string(STRIP "${tests}" tests)
|
||||||
|
|
||||||
add_custom_target(
|
add_custom_target(
|
||||||
tests
|
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}
|
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
|
||||||
DEPENDS ${tests}
|
DEPENDS ${tests}
|
||||||
COMMENT "Running tests")
|
COMMENT "Running tests")
|
||||||
|
|
|
@ -16,13 +16,12 @@ int main()
|
||||||
|
|
||||||
client.command("set", "a", "1");
|
client.command("set", "a", "1");
|
||||||
client.command("set", "b", "2");
|
client.command("set", "b", "2");
|
||||||
|
client.command("del", "c");
|
||||||
|
|
||||||
auto result{client.command("mget", "a", "b", "c")};
|
auto result{client.command("mget", "a", "b", "c")};
|
||||||
|
|
||||||
return !(
|
return result.type == resply::Result::Type::Array &&
|
||||||
result.type == resply::Result::Type::Array &&
|
result.array[0].type == resply::Result::Type::String && result.array[0].string == "1" &&
|
||||||
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[1].type == resply::Result::Type::String && result.array[1].string == "2" &&
|
result.array[2].type == resply::Result::Type::Nil;
|
||||||
result.array[2].type == resply::Result::Type::Nil
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,5 +16,5 @@ int main()
|
||||||
|
|
||||||
auto result{client.command("ping")};
|
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";
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,8 +21,8 @@ int main()
|
||||||
.command("incr", "a")
|
.command("incr", "a")
|
||||||
.send();
|
.send();
|
||||||
|
|
||||||
return !(result.size() == 3 &&
|
return result.size() == 3 &&
|
||||||
result[0].integer == 1 &&
|
result[0].type == resply::Result::Type::Integer && result[0].integer == 1 &&
|
||||||
result[1].integer == 2 &&
|
result[1].type == resply::Result::Type::Integer && result[1].integer == 2 &&
|
||||||
result[2].integer == 3);
|
result[2].type == resply::Result::Type::Integer && result[2].integer == 3;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,5 +33,6 @@ int main()
|
||||||
client2.command("publish", "a", "pubsub-test");
|
client2.command("publish", "a", "pubsub-test");
|
||||||
|
|
||||||
auto message{result.get_future().get()};
|
auto message{result.get_future().get()};
|
||||||
return message.first == "a" && message.second == "pubusb-test";
|
|
||||||
|
return message.first == "a" && message.second == "pubsub-test";
|
||||||
}
|
}
|
||||||
|
|
Reference in a new issue