diff options
Diffstat (limited to 'eval/src/tests/eval/tensor_spec/tensor_spec_test.cpp')
-rw-r--r-- | eval/src/tests/eval/tensor_spec/tensor_spec_test.cpp | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/eval/src/tests/eval/tensor_spec/tensor_spec_test.cpp b/eval/src/tests/eval/tensor_spec/tensor_spec_test.cpp index aa62e52f6f4..7c48606d6dd 100644 --- a/eval/src/tests/eval/tensor_spec/tensor_spec_test.cpp +++ b/eval/src/tests/eval/tensor_spec/tensor_spec_test.cpp @@ -19,6 +19,17 @@ TEST("require that a tensor spec can be converted to and from slime") { EXPECT_EQUAL(TensorSpec::from_slime(slime.get()), spec); } +TEST("require that a tensor spec can be converted to and from an expression") { + TensorSpec spec("tensor<float>(x[2],y{})"); + spec.add({{"x", 0}, {"y", "xxx"}}, 1.0) + .add({{"x", 0}, {"y", "yyy"}}, 2.0) + .add({{"x", 1}, {"y", "xxx"}}, 3.0) + .add({{"x", 1}, {"y", "yyy"}}, 4.0); + vespalib::string expr = spec.to_expr(); + fprintf(stderr, "expr: \n%s\n", expr.c_str()); + EXPECT_EQUAL(TensorSpec::from_expr(expr), spec); +} + TEST("require that tensor specs can be diffed") { TensorSpec expect("tensor(x[2],y{})"); expect.add({{"x", 0}, {"y", "xxx"}}, 1.5) |