Skip to content

Commit

Permalink
Fix a small but dramatic bug.
Browse files Browse the repository at this point in the history
Signed-off-by: Johannes Kalmbach <johannes.kalmbach@gmail.com>
  • Loading branch information
joka921 committed Jan 24, 2025
1 parent ff47922 commit e245112
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
4 changes: 4 additions & 0 deletions src/parser/TripleComponent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,11 @@ std::ostream& operator<<(std::ostream& stream, const TripleComponent& obj) {
stream << "DATE: " << value.toStringAndType().first;
} else if constexpr (std::is_same_v<T, bool>) {
stream << (value ? "true" : "false");
} else if constexpr (std::is_same_v<T, GeoPoint>) {
stream << Id::makeFromGeoPoint(value);
} else {
static_assert(
ad_utility::SameAsAny<T, Id, double, int64_t, std::string>);
stream << value;
}
},
Expand Down
15 changes: 14 additions & 1 deletion test/TripleComponentTest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// Author: Johannes Kalmbach(joka921) <johannes.kalmbach@gmail.com>
//

#include <gtest/gtest.h>
#include <gmock/gmock.h>

#include "./util/IdTestHelpers.h"
#include "./util/TripleComponentTestHelpers.h"
Expand Down Expand Up @@ -225,3 +225,16 @@ TEST(TripleComponent, invalidDatatypeForLiteral) {
// Something that is invalid because it is none of the above
ASSERT_ANY_THROW(lit("\"alpha\"", "fr-ca"));
}

/*
TEST(TripleComponent, toString) {
using Tc = TripleComponent;
auto match = [](const std::string& s) {
.. Todo...
}
EXPECT_EQ({GeoPoint{13, 14}};
EXPECT_EQ()
}
*/

0 comments on commit e245112

Please sign in to comment.