summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2016-12-15 05:17:10 +0100
committerHenning Baldersheim <balder@yahoo-inc.com>2016-12-15 13:12:36 +0100
commit2523fa2064bb09005f747fa3bcafe7a731241e98 (patch)
treee6daac946686e85b2464f4a9d86c81986f147b5d /document
parent1c63902ae04edc5335f6162ea8c20a63c0e3d298 (diff)
Make some more test build too.
Diffstat (limited to 'document')
-rw-r--r--document/src/tests/documentcalculatortestcase.cpp27
1 files changed, 12 insertions, 15 deletions
diff --git a/document/src/tests/documentcalculatortestcase.cpp b/document/src/tests/documentcalculatortestcase.cpp
index 00de5427961..0279d850dfd 100644
--- a/document/src/tests/documentcalculatortestcase.cpp
+++ b/document/src/tests/documentcalculatortestcase.cpp
@@ -1,18 +1,15 @@
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
-
-#include <vespa/fastos/fastos.h>
#include <vespa/document/base/testdocrepo.h>
-#include <vespa/document/fieldvalue/fieldvalues.h>
#include <vespa/vespalib/io/fileutil.h>
#include <vespa/vdstestlib/cppunit/macros.h>
#include <vespa/document/base/documentcalculator.h>
+#include <vespa/document/fieldvalue/document.h>
+#include <vespa/document/fieldvalue/bytefieldvalue.h>
#include <vespa/document/fieldvalue/intfieldvalue.h>
#include <vespa/document/fieldvalue/longfieldvalue.h>
#include <vespa/document/fieldvalue/floatfieldvalue.h>
-#include <fstream>
-
namespace document {
class DocumentCalculatorTest : public CppUnit::TestFixture {
@@ -59,7 +56,7 @@ DocumentCalculatorTest::testConstant() {
Document doc(*_testRepo.getDocumentType("testdoctype1"),
DocumentId("doc:test:foo"));
- CPPUNIT_ASSERT_EQUAL(4.0, calc.evaluate(doc, variables));
+ CPPUNIT_ASSERT_EQUAL(4.0, calc.evaluate(doc, std::move(variables)));
}
void
@@ -69,7 +66,7 @@ DocumentCalculatorTest::testSimple() {
Document doc(*_testRepo.getDocumentType("testdoctype1"),
DocumentId("doc:test:foo"));
- CPPUNIT_ASSERT_EQUAL(4.0, calc.evaluate(doc, variables));
+ CPPUNIT_ASSERT_EQUAL(4.0, calc.evaluate(doc, std::move(variables)));
}
void
@@ -81,7 +78,7 @@ DocumentCalculatorTest::testVariables() {
Document doc(*_testRepo.getDocumentType("testdoctype1"),
DocumentId("doc:test:foo"));
- CPPUNIT_ASSERT_EQUAL(4.0, calc.evaluate(doc, variables));
+ CPPUNIT_ASSERT_EQUAL(4.0, calc.evaluate(doc, std::move(variables)));
}
void
@@ -97,7 +94,7 @@ DocumentCalculatorTest::testFields() {
doc.setValue(doc.getField("headerval"), IntFieldValue(5));
doc.setValue(doc.getField("hfloatval"), FloatFieldValue(3.0));
doc.setValue(doc.getField("headerlongval"), LongFieldValue(2));
- CPPUNIT_ASSERT_EQUAL(4.0, calc.evaluate(doc, variables));
+ CPPUNIT_ASSERT_EQUAL(4.0, calc.evaluate(doc, std::move(variables)));
}
void
@@ -114,7 +111,7 @@ DocumentCalculatorTest::testFieldsDivZero() {
doc.setValue(doc.getField("hfloatval"), FloatFieldValue(3.0));
doc.setValue(doc.getField("headerlongval"), LongFieldValue(0));
try {
- calc.evaluate(doc, variables);
+ calc.evaluate(doc, std::move(variables));
CPPUNIT_ASSERT(false);
} catch (const vespalib::IllegalArgumentException& e) {
// OK
@@ -129,7 +126,7 @@ DocumentCalculatorTest::testDivideByZero() {
Document doc(*_testRepo.getDocumentType("testdoctype1"),
DocumentId("doc:test:foo"));
try {
- calc.evaluate(doc, variables);
+ calc.evaluate(doc, std::move(variables));
CPPUNIT_ASSERT(false);
} catch (const vespalib::IllegalArgumentException& e) {
// OK
@@ -144,7 +141,7 @@ DocumentCalculatorTest::testModByZero() {
Document doc(*_testRepo.getDocumentType("testdoctype1"),
DocumentId("doc:test:foo"));
try {
- calc.evaluate(doc, variables);
+ calc.evaluate(doc, std::move(variables));
CPPUNIT_ASSERT(false);
} catch (const vespalib::IllegalArgumentException& e) {
// OK
@@ -162,7 +159,7 @@ DocumentCalculatorTest::testFieldNotSet() {
doc.setValue(doc.getField("hfloatval"), FloatFieldValue(3.0));
doc.setValue(doc.getField("headerlongval"), LongFieldValue(2));
try {
- calc.evaluate(doc, variables);
+ calc.evaluate(doc, std::move(variables));
CPPUNIT_ASSERT(false);
} catch (const vespalib::IllegalArgumentException&) {
// OK
@@ -181,7 +178,7 @@ DocumentCalculatorTest::testFieldNotFound() {
doc.setValue(doc.getField("hfloatval"), FloatFieldValue(3.0));
doc.setValue(doc.getField("headerlongval"), LongFieldValue(2));
try {
- calc.evaluate(doc, variables);
+ calc.evaluate(doc, std::move(variables));
CPPUNIT_ASSERT(false);
} catch (const vespalib::IllegalArgumentException&) {
// OK
@@ -196,7 +193,7 @@ DocumentCalculatorTest::testByteSubtractionZeroResult() {
Document doc(*_testRepo.getDocumentType("testdoctype1"),
DocumentId("doc:test:foo"));
doc.setValue(doc.getField("byteval"), ByteFieldValue(3));
- CPPUNIT_ASSERT_EQUAL(0.0, calc.evaluate(doc, variables));
+ CPPUNIT_ASSERT_EQUAL(0.0, calc.evaluate(doc, std::move(variables)));
}
}