summaryrefslogtreecommitdiffstats
path: root/eval/src/apps/tensor_conformance/generate.cpp
blob: 45ff6243d81ac325ae4ea242221df91e83e3a2ae (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.

#include "generate.h"

using TensorSpec = vespalib::eval::TensorSpec;

TensorSpec spec(double value) { return TensorSpec("double").add({}, value); }

void
Generator::generate(TestBuilder &dst)
{
    // smoke tests with expected result
    dst.add("a+a", {{"a", spec(2.0)}}, spec(4.0));
    dst.add("a*b", {{"a", spec(2.0)}, {"b", spec(3.0)}}, spec(6.0));
    dst.add("(a+b)*(a-b)", {{"a", spec(5.0)}, {"b", spec(2.0)}}, spec(21.0));
    // smoke test without expected result
    dst.add("(a-b)/(a+b)", {{"a", spec(5.0)}, {"b", spec(2.0)}});
}