summaryrefslogtreecommitdiffstats
path: root/eval/src/tests
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@oath.com>2019-04-03 16:33:28 +0000
committerHenning Baldersheim <balder@oath.com>2019-04-03 16:33:28 +0000
commitce4339ab5224bac5df5fb721cb7d2668ae75c811 (patch)
treeb0fc7edd32afed431750e65cb84635295666cddb /eval/src/tests
parent6bb8fbba81114e3b7c902b1a9d12f3d91029011e (diff)
Keep the serialzation of the cells with the serialization for now.
Clean up code for better understanding and reuse.
Diffstat (limited to 'eval/src/tests')
-rw-r--r--eval/src/tests/tensor/tensor_serialization/tensor_serialization_test.cpp11
1 files changed, 4 insertions, 7 deletions
diff --git a/eval/src/tests/tensor/tensor_serialization/tensor_serialization_test.cpp b/eval/src/tests/tensor/tensor_serialization/tensor_serialization_test.cpp
index d32fecc5cba..0237f6cc769 100644
--- a/eval/src/tests/tensor/tensor_serialization/tensor_serialization_test.cpp
+++ b/eval/src/tests/tensor/tensor_serialization/tensor_serialization_test.cpp
@@ -16,7 +16,6 @@
using namespace vespalib::tensor;
using vespalib::nbostream;
using ExpBuffer = std::vector<uint8_t>;
-using SerializeFormat = vespalib::tensor::DenseTensorView::SerializeFormat;
namespace std {
@@ -145,10 +144,8 @@ TEST_F("test tensor serialization for SparseTensor", SparseFixture)
struct DenseFixture
{
- Tensor::UP createTensor(SerializeFormat format, const DenseTensorCells &cells) {
- auto tensor = TensorFactory::createDense(cells);
- dynamic_cast<DenseTensorView &>(*tensor).serializeAs(format);
- return tensor;
+ Tensor::UP createTensor(const DenseTensorCells &cells) {
+ return TensorFactory::createDense(cells);
}
void serialize(nbostream &stream, const Tensor &tensor) {
@@ -166,9 +163,9 @@ struct DenseFixture
assertSerialized(exp, SerializeFormat::DOUBLE, rhs);
}
void assertSerialized(const ExpBuffer &exp, SerializeFormat cellType, const DenseTensorCells &rhs) {
- Tensor::UP rhsTensor(createTensor(cellType, rhs));
+ Tensor::UP rhsTensor(createTensor(rhs));
nbostream rhsStream;
- serialize(rhsStream, *rhsTensor);
+ TypedBinaryFormat::serialize(rhsStream, *rhsTensor, cellType);
EXPECT_EQUAL(exp, rhsStream);
auto rhs2 = deserialize(rhsStream);
EXPECT_EQUAL(*rhs2, *rhsTensor);