diff options
author | Arne Juul <arnej@verizonmedia.com> | 2020-10-14 10:29:59 +0000 |
---|---|---|
committer | Arne Juul <arnej@verizonmedia.com> | 2020-10-14 10:29:59 +0000 |
commit | 28e6edf935fb6e602f904b567e32605638cabef6 (patch) | |
tree | f1cc0a6014db80eb38daf1d1451c660b2337b0cb /eval | |
parent | 725c352a20bae355e3424e4658fa56ddd9c053d9 (diff) |
add operator== and operator<< for testing only
Diffstat (limited to 'eval')
-rw-r--r-- | eval/src/vespa/eval/eval/test/CMakeLists.txt | 1 | ||||
-rw-r--r-- | eval/src/vespa/eval/eval/test/value_compare.cpp | 22 | ||||
-rw-r--r-- | eval/src/vespa/eval/eval/test/value_compare.h | 13 |
3 files changed, 36 insertions, 0 deletions
diff --git a/eval/src/vespa/eval/eval/test/CMakeLists.txt b/eval/src/vespa/eval/eval/test/CMakeLists.txt index 8b4f7c4f93b..6e88beab9b7 100644 --- a/eval/src/vespa/eval/eval/test/CMakeLists.txt +++ b/eval/src/vespa/eval/eval/test/CMakeLists.txt @@ -5,4 +5,5 @@ vespa_add_library(eval_eval_test OBJECT eval_spec.cpp tensor_conformance.cpp test_io.cpp + value_compare.cpp ) diff --git a/eval/src/vespa/eval/eval/test/value_compare.cpp b/eval/src/vespa/eval/eval/test/value_compare.cpp new file mode 100644 index 00000000000..c29eeb4f41d --- /dev/null +++ b/eval/src/vespa/eval/eval/test/value_compare.cpp @@ -0,0 +1,22 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#include "value_compare.h" +#include <vespa/eval/eval/engine_or_factory.h> + +namespace vespalib::eval { + +bool operator==(const Value &lhs, const Value &rhs) +{ + auto engine = EngineOrFactory::get(); + return engine.to_spec(lhs) == engine.to_spec(rhs); +} + +std::ostream &operator<<(std::ostream &out, const Value &value) +{ + auto engine = EngineOrFactory::get(); + auto spec = engine.to_spec(value); + out << spec.to_string(); + return out; +} + +} // namespace vespalib::eval diff --git a/eval/src/vespa/eval/eval/test/value_compare.h b/eval/src/vespa/eval/eval/test/value_compare.h new file mode 100644 index 00000000000..d3978309564 --- /dev/null +++ b/eval/src/vespa/eval/eval/test/value_compare.h @@ -0,0 +1,13 @@ +// Copyright Verizon Media. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. + +#pragma once + +#include <vespa/eval/eval/value.h> + +namespace vespalib::eval { + +bool operator==(const Value &lhs, const Value &rhs); +std::ostream &operator<<(std::ostream &out, const Value &tensor); + +} + |