diff options
author | Tor Egge <Tor.Egge@broadpark.no> | 2019-02-13 15:28:15 +0100 |
---|---|---|
committer | Tor Egge <Tor.Egge@broadpark.no> | 2019-02-13 15:28:15 +0100 |
commit | f0a669ba9601014f0f3c0b8ab9400b2d40062e6a (patch) | |
tree | 0157df955285a1b6c2013e2803a6aa7b4debe7e0 /document/src/tests/repo | |
parent | a95444bc86804cc3e0522902386890cf86870ef7 (diff) |
Verify that tensor types (detailedtype) in document type repo are propagated.
Diffstat (limited to 'document/src/tests/repo')
-rw-r--r-- | document/src/tests/repo/documenttyperepo_test.cpp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/document/src/tests/repo/documenttyperepo_test.cpp b/document/src/tests/repo/documenttyperepo_test.cpp index 1e8fd9ec470..b92d85bd0ce 100644 --- a/document/src/tests/repo/documenttyperepo_test.cpp +++ b/document/src/tests/repo/documenttyperepo_test.cpp @@ -530,4 +530,23 @@ TEST("Reference fields are resolved to correct reference type") { EXPECT_EQUAL(*ref1_type, type->getFieldsType().getField("ref3").getDataType()); } +TEST("Tensor fields have tensor types") { + DocumenttypesConfigBuilderHelper builder; + builder.document(doc_type_id, type_name, + Struct(header_name), + Struct(body_name). + addTensorField("tensor1", "tensor(x[3])"). + addTensorField("tensor2", "tensor(y{})"). + addTensorField("tensor3", "tensor(x[3])")); + DocumentTypeRepo repo(builder.config()); + auto *docType = repo.getDocumentType(doc_type_id); + ASSERT_TRUE(docType != nullptr); + auto &tensorField1 = docType->getField("tensor1"); + auto &tensorField2 = docType->getField("tensor2"); + EXPECT_EQUAL("TensorDataType(tensor(x[3]))", tensorField1.getDataType().toString()); + EXPECT_EQUAL("TensorDataType(tensor(y{}))", tensorField2.getDataType().toString()); + auto &tensorField3 = docType->getField("tensor3"); + EXPECT_TRUE(&tensorField1.getDataType() == &tensorField3.getDataType()); +} + TEST_MAIN() { TEST_RUN_ALL(); } |