From dbdd0728033b437b44982f2050cfc153c215413b Mon Sep 17 00:00:00 2001 From: Daniel <d.hornung@indiscale.com> Date: Fri, 20 Aug 2021 10:16:31 +0200 Subject: [PATCH] ENH: Value::IsNull is const --- include/caosdb/value.h | 2 +- test/test_value.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/include/caosdb/value.h b/include/caosdb/value.h index 513ab33..989f780 100644 --- a/include/caosdb/value.h +++ b/include/caosdb/value.h @@ -122,7 +122,7 @@ public: LIST_VALUE_CONSTRUCTOR(char *, set_string_value) LIST_VALUE_CONSTRUCTOR(bool, set_boolean_value) - [[nodiscard]] inline auto IsNull() -> bool { + [[nodiscard]] inline auto IsNull() const noexcept -> bool { return this->wrapped->value_case() == ValueCase::VALUE_NOT_SET; } diff --git a/test/test_value.cpp b/test/test_value.cpp index 0bbc645..74d30f0 100644 --- a/test/test_value.cpp +++ b/test/test_value.cpp @@ -65,6 +65,11 @@ TEST(test_value, test_string) { EXPECT_FALSE(empty_string.IsInteger()); EXPECT_EQ(empty_string.AsString(), ""); + + // Test inequality + Value string1("1"); + Value int1(1); + EXPECT_FALSE(string1 == int1); } TEST(test_value, test_double) { -- GitLab