diff options
author | Håvard Pettersen <havardpe@oath.com> | 2017-10-03 13:11:24 +0000 |
---|---|---|
committer | Håvard Pettersen <havardpe@oath.com> | 2017-10-03 13:11:24 +0000 |
commit | 38e1daf1c98882a1f75a345bcf5eca84c222fa89 (patch) | |
tree | 1215a6496d5539ae1d87670b539b371ec17e8a13 /eval/src/tests/tensor | |
parent | 81b9d23e0e85e73626ff6edea446741bb263b465 (diff) |
wire in spec-based tensor conformance testing
verify conformance spec generation
verify C++ default expression evaluation
bonus: verify binary format test spec generation
Diffstat (limited to 'eval/src/tests/tensor')
-rw-r--r-- | eval/src/tests/tensor/tensor_conformance/.gitignore | 2 | ||||
-rw-r--r-- | eval/src/tests/tensor/tensor_conformance/tensor_conformance_test.cpp | 22 |
2 files changed, 24 insertions, 0 deletions
diff --git a/eval/src/tests/tensor/tensor_conformance/.gitignore b/eval/src/tests/tensor/tensor_conformance/.gitignore new file mode 100644 index 00000000000..60177365cf7 --- /dev/null +++ b/eval/src/tests/tensor/tensor_conformance/.gitignore @@ -0,0 +1,2 @@ +/binary_test_spec.json +/conformance_test_spec.json diff --git a/eval/src/tests/tensor/tensor_conformance/tensor_conformance_test.cpp b/eval/src/tests/tensor/tensor_conformance/tensor_conformance_test.cpp index daf641143e8..ad21a50cf1d 100644 --- a/eval/src/tests/tensor/tensor_conformance/tensor_conformance_test.cpp +++ b/eval/src/tests/tensor/tensor_conformance/tensor_conformance_test.cpp @@ -3,10 +3,12 @@ #include <vespa/eval/eval/test/tensor_conformance.h> #include <vespa/eval/eval/simple_tensor_engine.h> #include <vespa/eval/tensor/default_tensor_engine.h> +#include <vespa/vespalib/util/stringfmt.h> using vespalib::eval::SimpleTensorEngine; using vespalib::eval::test::TensorConformance; using vespalib::tensor::DefaultTensorEngine; +using vespalib::make_string; vespalib::string module_path(TEST_PATH("../../../../")); @@ -19,4 +21,24 @@ TEST("require that production tensor implementation passes all conformance tests TEST_DO(TensorConformance::run_tests(module_path, DefaultTensorEngine::ref())); } +TEST("require that tensor serialization test spec can be generated") { + vespalib::string spec = module_path + "src/apps/make_tensor_binary_format_test_spec/test_spec.json"; + vespalib::string binary = module_path + "src/apps/make_tensor_binary_format_test_spec/eval_make_tensor_binary_format_test_spec_app"; + EXPECT_EQUAL(system(make_string("%s > binary_test_spec.json", binary.c_str()).c_str()), 0); + EXPECT_EQUAL(system(make_string("diff -u %s binary_test_spec.json", spec.c_str()).c_str()), 0); +} + +TEST("require that cross-language tensor conformance test spec can be generated") { + vespalib::string spec = module_path + "src/apps/tensor_conformance/test_spec.json"; + vespalib::string binary = module_path + "src/apps/tensor_conformance/vespa-tensor-conformance"; + EXPECT_EQUAL(system(make_string("%s generate > conformance_test_spec.json", binary.c_str()).c_str()), 0); + EXPECT_EQUAL(system(make_string("diff -u %s conformance_test_spec.json", spec.c_str()).c_str()), 0); +} + +TEST("require that cross-language tensor conformance tests pass with production C++ expression evaluation") { + vespalib::string spec = module_path + "src/apps/tensor_conformance/test_spec.json"; + vespalib::string binary = module_path + "src/apps/tensor_conformance/vespa-tensor-conformance"; + EXPECT_EQUAL(system(make_string("cat %s | %s evaluate | %s verify", spec.c_str(), binary.c_str(), binary.c_str()).c_str()), 0); +} + TEST_MAIN() { TEST_RUN_ALL(); } |