mirror of
https://github.com/dragonflydb/dragonfly.git
synced 2024-12-14 11:58:02 +00:00
chore: Enable unit-tests in CI (#2129)
* chore: Enable unit-tests in CI * Update helio
This commit is contained in:
parent
f68e1ef7e3
commit
1f4b1e4c6c
5 changed files with 42 additions and 34 deletions
1
.github/workflows/ci.yml
vendored
1
.github/workflows/ci.yml
vendored
|
@ -98,7 +98,6 @@ jobs:
|
|||
${SCCACHE_PATH} --show-stats | tee $GITHUB_STEP_SUMMARY
|
||||
|
||||
- name: C++ Unit Tests
|
||||
if: ${{ false }}
|
||||
run: |
|
||||
cd ${GITHUB_WORKSPACE}/build
|
||||
echo Run ctest -V -L DFLY
|
||||
|
|
2
helio
2
helio
|
@ -1 +1 @@
|
|||
Subproject commit 1fea6effc72919649c815afb04e9c7829b0240ab
|
||||
Subproject commit 1b3f13d94a5342fe9c4db67a7e05404c602b8a17
|
|
@ -6,15 +6,29 @@
|
|||
|
||||
#include <absl/strings/match.h>
|
||||
|
||||
#include "base/logging.h"
|
||||
|
||||
namespace facade {
|
||||
|
||||
using namespace testing;
|
||||
using namespace std;
|
||||
|
||||
bool RespMatcher::MatchAndExplain(const RespExpr& e, MatchResultListener* listener) const {
|
||||
bool RespMatcher::MatchAndExplain(RespExpr e, MatchResultListener* listener) const {
|
||||
if (e.type != type_) {
|
||||
*listener << "\nWrong type: " << RespExpr::TypeName(e.type);
|
||||
return false;
|
||||
if (e.type == RespExpr::STRING && type_ == RespExpr::DOUBLE) {
|
||||
// Doubles are encoded as strings, unless RESP3 is selected. So parse string and try to
|
||||
// compare it.
|
||||
double d = 0;
|
||||
if (!absl::SimpleAtod(e.GetString(), &d)) {
|
||||
*listener << "\nCan't parse as double: " << e.GetString();
|
||||
return false;
|
||||
}
|
||||
e.type = RespExpr::DOUBLE;
|
||||
e.u = d;
|
||||
} else {
|
||||
*listener << "\nWrong type: " << RespExpr::TypeName(e.type);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (type_ == RespExpr::STRING || type_ == RespExpr::ERROR) {
|
||||
|
@ -37,7 +51,7 @@ bool RespMatcher::MatchAndExplain(const RespExpr& e, MatchResultListener* listen
|
|||
}
|
||||
} else if (type_ == RespExpr::DOUBLE) {
|
||||
auto actual = get<double>(e.u);
|
||||
if (exp_double_ != actual) {
|
||||
if (abs(exp_double_ - actual) > 0.0001) {
|
||||
*listener << "\nActual : " << actual << " expected: " << exp_double_;
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -26,7 +26,7 @@ class RespMatcher {
|
|||
}
|
||||
using is_gtest_matcher = void;
|
||||
|
||||
bool MatchAndExplain(const RespExpr& e, testing::MatchResultListener*) const;
|
||||
bool MatchAndExplain(RespExpr e, testing::MatchResultListener*) const;
|
||||
|
||||
void DescribeTo(std::ostream* os) const;
|
||||
|
||||
|
|
|
@ -790,56 +790,51 @@ TEST_F(ZSetFamilyTest, GeoSearch) {
|
|||
EXPECT_THAT(
|
||||
resp,
|
||||
RespArray(ElementsAre(
|
||||
RespArray(ElementsAre("Berlin", "0.00017343178521311378", "3673983950397063",
|
||||
RespArray(ElementsAre("13.405002057552338", "52.51999907056681")))),
|
||||
RespArray(
|
||||
ElementsAre("Dublin", "487.5619030644293", "3678981558208417",
|
||||
RespArray(ElementsAre("6.260299980640411", "53.34980087538425")))))));
|
||||
RespArray(ElementsAre("Berlin", DoubleArg(0.00017343178521311378), "3673983950397063",
|
||||
RespArray(ElementsAre(DoubleArg(13.4050), DoubleArg(52.5200))))),
|
||||
RespArray(ElementsAre("Dublin", DoubleArg(487.5619030644293), "3678981558208417",
|
||||
RespArray(ElementsAre(DoubleArg(6.2603), DoubleArg(53.3498))))))));
|
||||
|
||||
resp = Run({"GEOSEARCH", "Europe", "FROMLONLAT", "13.4050", "52.5200", "BYBOX", "1000", "1000",
|
||||
"KM", "WITHCOORD", "WITHDIST"});
|
||||
EXPECT_THAT(
|
||||
resp,
|
||||
RespArray(ElementsAre(
|
||||
RespArray(ElementsAre("Vienna", "523.6926930553866",
|
||||
RespArray(ElementsAre("16.373799741268158", "48.20820011474228")))),
|
||||
RespArray(ElementsAre("Berlin", "0.00017343178521311378",
|
||||
RespArray(ElementsAre("13.405002057552338", "52.51999907056681")))),
|
||||
RespArray(
|
||||
ElementsAre("Dublin", "487.5619030644293",
|
||||
RespArray(ElementsAre("6.260299980640411", "53.34980087538425")))))));
|
||||
RespArray(ElementsAre("Vienna", DoubleArg(523.6926930553866),
|
||||
RespArray(ElementsAre(DoubleArg(16.3738), DoubleArg(48.2082))))),
|
||||
RespArray(ElementsAre("Berlin", DoubleArg(0.00017343178521311378),
|
||||
RespArray(ElementsAre(DoubleArg(13.4050), DoubleArg(52.5200))))),
|
||||
RespArray(ElementsAre("Dublin", DoubleArg(487.5619030644293),
|
||||
RespArray(ElementsAre(DoubleArg(6.2603), DoubleArg(53.3498))))))));
|
||||
|
||||
resp = Run({"GEOSEARCH", "Europe", "FROMLONLAT", "13.4050", "52.5200", "BYRADIUS", "500", "KM",
|
||||
"COUNT", "3", "WITHCOORD", "WITHDIST"});
|
||||
EXPECT_THAT(
|
||||
resp,
|
||||
RespArray(ElementsAre(
|
||||
RespArray(ElementsAre("Berlin", "0.00017343178521311378",
|
||||
RespArray(ElementsAre("13.405002057552338", "52.51999907056681")))),
|
||||
RespArray(
|
||||
ElementsAre("Dublin", "487.5619030644293",
|
||||
RespArray(ElementsAre("6.260299980640411", "53.34980087538425")))))));
|
||||
RespArray(ElementsAre("Berlin", DoubleArg(0.00017343178521311378),
|
||||
RespArray(ElementsAre(DoubleArg(13.4050), DoubleArg(52.5200))))),
|
||||
RespArray(ElementsAre("Dublin", DoubleArg(487.5619030644293),
|
||||
RespArray(ElementsAre(DoubleArg(6.2603), DoubleArg(53.3498))))))));
|
||||
|
||||
resp = Run({"GEOSEARCH", "Europe", "FROMLONLAT", "13.4050", "52.5200", "BYRADIUS", "500", "KM",
|
||||
"DESC", "WITHCOORD", "WITHDIST"});
|
||||
EXPECT_THAT(
|
||||
resp,
|
||||
RespArray(ElementsAre(
|
||||
RespArray(ElementsAre("Dublin", "487.5619030644293",
|
||||
RespArray(ElementsAre("6.260299980640411", "53.34980087538425")))),
|
||||
RespArray(
|
||||
ElementsAre("Berlin", "0.00017343178521311378",
|
||||
RespArray(ElementsAre("13.405002057552338", "52.51999907056681")))))));
|
||||
RespArray(ElementsAre("Dublin", DoubleArg(487.5619030644293),
|
||||
RespArray(ElementsAre(DoubleArg(6.2603), DoubleArg(53.3498))))),
|
||||
RespArray(ElementsAre("Berlin", DoubleArg(0.00017343178521311378),
|
||||
RespArray(ElementsAre(DoubleArg(13.4050), DoubleArg(52.5200))))))));
|
||||
|
||||
resp = Run({"GEOSEARCH", "Europe", "FROMMEMBER", "Madrid", "BYRADIUS", "700", "KM", "WITHCOORD",
|
||||
"WITHDIST"});
|
||||
EXPECT_THAT(
|
||||
resp,
|
||||
RespArray(ElementsAre(
|
||||
RespArray(ElementsAre(
|
||||
"Madrid", "0", RespArray(ElementsAre("3.7038007378578186", "40.416799319406216")))),
|
||||
RespArray(
|
||||
ElementsAre("Lisbon", "502.20769462704084",
|
||||
RespArray(ElementsAre("9.142698347568512", "38.736900197448534")))))));
|
||||
RespArray(ElementsAre("Madrid", "0",
|
||||
RespArray(ElementsAre(DoubleArg(3.7038), DoubleArg(40.4168))))),
|
||||
RespArray(ElementsAre("Lisbon", DoubleArg(502.20769462704084),
|
||||
RespArray(ElementsAre(DoubleArg(9.1427), DoubleArg(38.7369))))))));
|
||||
}
|
||||
} // namespace dfly
|
||||
|
|
Loading…
Reference in a new issue