summaryrefslogtreecommitdiffstats
path: root/document
diff options
context:
space:
mode:
authorHenning Baldersheim <balder@yahoo-inc.com>2017-07-25 19:47:35 +0200
committerHenning Baldersheim <balder@yahoo-inc.com>2017-07-31 17:04:17 +0200
commited86958cf65226a246cf4b8532e5f5e904a4b05d (patch)
treee7b52c64e70fca42c8281ff6fca17074b3837529 /document
parent76d9c00d726c3038e3ad1677619facb50336fb05 (diff)
We are not java so we do not need these sanity checks. valgrind will do them just fine.
Remove the tests
Diffstat (limited to 'document')
-rw-r--r--document/src/tests/arrayfieldvaluetest.cpp11
-rw-r--r--document/src/tests/structfieldvaluetest.cpp9
-rw-r--r--document/src/vespa/document/datatype/collectiondatatype.h2
-rw-r--r--document/src/vespa/document/fieldvalue/arrayfieldvalue.cpp14
-rw-r--r--document/src/vespa/document/fieldvalue/fieldvalue.cpp2
-rw-r--r--document/src/vespa/document/fieldvalue/mapfieldvalue.cpp3
-rw-r--r--document/src/vespa/document/fieldvalue/structfieldvalue.cpp5
7 files changed, 9 insertions, 37 deletions
diff --git a/document/src/tests/arrayfieldvaluetest.cpp b/document/src/tests/arrayfieldvaluetest.cpp
index c9a35bacf1c..8e1cbfafb43 100644
--- a/document/src/tests/arrayfieldvaluetest.cpp
+++ b/document/src/tests/arrayfieldvaluetest.cpp
@@ -161,17 +161,6 @@ void ArrayFieldValueTest::testArray()
// Failure situations.
- // Refuse to accept non-array types
- try{
- ArrayFieldValue value6(*DataType::TAG);
- CPPUNIT_FAIL("Didn't complain about non-array type");
- } catch (std::exception& e) {
- fprintf(stderr, "Exception = %s\n", e.what());
- CPPUNIT_ASSERT_CONTAIN(
- "Cannot generate an array value with non-array type",
- e.what());
- }
-
// Verify that datatypes are verified
// Created almost equal types to try to get it to fail
ArrayDataType type1(*DataType::INT);
diff --git a/document/src/tests/structfieldvaluetest.cpp b/document/src/tests/structfieldvaluetest.cpp
index 38e915ec82d..9fffe1d630f 100644
--- a/document/src/tests/structfieldvaluetest.cpp
+++ b/document/src/tests/structfieldvaluetest.cpp
@@ -193,15 +193,6 @@ void StructFieldValueTest::testStruct()
// Failure situations.
- // Refuse to accept non-struct types
- try{
- StructFieldValue value6(*DataType::DOCUMENT);
- CPPUNIT_FAIL("Didn't complain about non-struct type");
- } catch (std::exception& e) {
- CPPUNIT_ASSERT_CONTAIN("Cannot generate a struct value with "
- "non-struct type", e.what());
- }
-
// Refuse to set wrong types
try{
value2.setValue(intF, StringFieldValue("bar"));
diff --git a/document/src/vespa/document/datatype/collectiondatatype.h b/document/src/vespa/document/datatype/collectiondatatype.h
index 04fcb0f5be4..0e258e3e0cf 100644
--- a/document/src/vespa/document/datatype/collectiondatatype.h
+++ b/document/src/vespa/document/datatype/collectiondatatype.h
@@ -9,7 +9,7 @@
*/
#pragma once
-#include <vespa/document/datatype/datatype.h>
+#include "datatype.h"
namespace document {
diff --git a/document/src/vespa/document/fieldvalue/arrayfieldvalue.cpp b/document/src/vespa/document/fieldvalue/arrayfieldvalue.cpp
index 1173ed6df8d..85fd031ac10 100644
--- a/document/src/vespa/document/fieldvalue/arrayfieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/arrayfieldvalue.cpp
@@ -12,6 +12,7 @@
LOG_SETUP(".document.fieldvalue.array");
using namespace vespalib::xml;
+using vespalib::make_string;
namespace document {
@@ -27,11 +28,6 @@ ArrayFieldValue::ArrayFieldValue(const DataType &type)
: CollectionFieldValue(type),
_array()
{
- if (!type.inherits(ArrayDataType::classId)) {
- throw IllegalArgumentException(
- "Cannot generate an array value with non-array type "
- + type.toString() + ".", VESPA_STRLOC);
- }
_array.reset(static_cast<IArray *>(createArray(getNestedType()).release()));
}
@@ -60,7 +56,7 @@ void
ArrayFieldValue::remove(uint32_t index)
{
if (_array->size() <= index) {
- throw IllegalArgumentException(vespalib::make_string(
+ throw IllegalArgumentException(make_string(
"Cannot remove index %u from an array of size %lu.",
index, (unsigned long)_array->size()), VESPA_STRLOC);
}
@@ -73,7 +69,7 @@ ArrayFieldValue::addValue(const FieldValue& value)
if (getNestedType().isValueType(value)) {
_array->push_back(value);
} else {
- throw IllegalArgumentException(vespalib::make_string(
+ throw IllegalArgumentException(make_string(
"Cannot add value of type %s to array containing type %s.",
value.getDataType()->toString().c_str(),
getNestedType().toString().c_str()), VESPA_STRLOC);
@@ -92,7 +88,7 @@ ArrayFieldValue::containsValue(const FieldValue& value) const
}
return false;
} else {
- throw IllegalArgumentException(vespalib::make_string(
+ throw IllegalArgumentException(make_string(
"Value of type %s can't possibly be in array of type %s.",
value.getDataType()->toString().c_str(),
getDataType()->toString().c_str()), VESPA_STRLOC);
@@ -114,7 +110,7 @@ ArrayFieldValue::removeValue(const FieldValue& value)
}
return (oldSize != _array->size());
} else {
- throw IllegalArgumentException(vespalib::make_string(
+ throw IllegalArgumentException(make_string(
"Value of type %s can't possibly be in array of type %s.",
value.getDataType()->toString().c_str(),
getDataType()->toString().c_str()), VESPA_STRLOC);
diff --git a/document/src/vespa/document/fieldvalue/fieldvalue.cpp b/document/src/vespa/document/fieldvalue/fieldvalue.cpp
index 903922c0992..979a6316e45 100644
--- a/document/src/vespa/document/fieldvalue/fieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/fieldvalue.cpp
@@ -217,6 +217,7 @@ using vespalib::ComplexArrayT;
using vespalib::PrimitiveArrayT;
namespace {
+
class FieldValueFactory : public ComplexArrayT<FieldValue>::Factory
{
public:
@@ -226,6 +227,7 @@ public:
private:
DataType::CP _dataType;
};
+
}
std::unique_ptr<vespalib::IArrayBase>
diff --git a/document/src/vespa/document/fieldvalue/mapfieldvalue.cpp b/document/src/vespa/document/fieldvalue/mapfieldvalue.cpp
index 750bb8d3bab..2b0463d39e6 100644
--- a/document/src/vespa/document/fieldvalue/mapfieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/mapfieldvalue.cpp
@@ -27,8 +27,7 @@ namespace {
const MapDataType *verifyMapType(const DataType& type) {
const MapDataType *ptr(Identifiable::cast<const MapDataType *>(&type));
if (!ptr) {
- throw vespalib::IllegalArgumentException(
- "Datatype given is not a map type", VESPA_STRLOC);
+ throw vespalib::IllegalArgumentException("Datatype given is not a map type", VESPA_STRLOC);
}
return ptr;
}
diff --git a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp
index f4afd843896..adb6fb9fa4e 100644
--- a/document/src/vespa/document/fieldvalue/structfieldvalue.cpp
+++ b/document/src/vespa/document/fieldvalue/structfieldvalue.cpp
@@ -33,11 +33,6 @@ StructFieldValue::StructFieldValue(const DataType &type)
_version(Document::getNewestSerializationVersion()),
_hasChanged(true)
{
- if (!type.getClass().inherits(StructDataType::classId)) {
- throw vespalib::IllegalArgumentException(
- "Cannot generate a struct value with non-struct type "
- + type.toString() + ".", VESPA_STRLOC);
- }
}
StructFieldValue::~StructFieldValue() { }