Exemplo n.º 1
0
void ProjectDialog::accept()
{
	Project p = project();
	bool ufc = p.useFileCreation();
	p.setUseFileCreation( 0 );
	p.setElementStatus( ElementStatus::recordByName( "New" ) );
	p.setProjectStatus( ProjectStatus::recordByName( "Production" ) );
	p.commit();
	p.setUseFileCreation( ufc );
	p.setProject( p );
	
	Client client( Client::recordByName( mClientCombo->currentText() ) );
	p.setClient( client );
	p.commit();
	
	if( mWebCheck->isChecked() || mFTPCheck->isChecked() ) {
		User u = User::setupProjectUser( p, client, mWebCheck->isChecked(), mFTPCheck->isChecked() );
		u.commit();
	}
	
	/* Create Project Storage Records */
	ProjectStorageList storage;
	storage += createStorage( p, "animation", mWIPCombo->currentText() );
	storage += createStorage( p, "renderOutput", mRenderOutputCombo->currentText() );
	storage += createStorage( p, "compOutput", mCompOutputCombo->currentText() );
	storage.commit();

	QDialog::accept();
}
TEST(LowLevelBufferHandler, SetMetaData) {
    const BufferId BUFFERS_COUNT = 1;
    const BufferPos BUFFER_SIZE = 1;
    LowLevelBufferHandler manager(BUFFERS_COUNT, BUFFER_SIZE);

    MetaData meta;
    SignalValue buffersDump[] = {0};
    QualityCode qualityCodesDump[] = {0};
    TimeStamp timeStampsDump[] = {0};

    const int length = manager.getDataLengthBytes();
    boost::scoped_array<char> storage(createStorage(BUFFERS_COUNT, BUFFER_SIZE,
                                                    meta,
                                                    buffersDump,
                                                    qualityCodesDump,
                                                    timeStampsDump,
                                                    length));

    MetaData metaActual;
    metaActual.clientCount = 10;
    manager.setMetaData(metaActual, reinterpret_cast<void *>(storage.get()));

    boost::scoped_array<char> expected(createStorage(BUFFERS_COUNT, BUFFER_SIZE,
                                                     metaActual,
                                                     buffersDump,
                                                     qualityCodesDump,
                                                     timeStampsDump,
                                                     length));
    EXPECT_TRUE(0 == std::memcmp(expected.get(), storage.get(), length));
}
TEST(LowLevelBufferHandler, SetQualityCode) {
    const BufferId BUFFERS_COUNT = 10;
    const BufferPos BUFFER_SIZE = 4;
    LowLevelBufferHandler manager(BUFFERS_COUNT, BUFFER_SIZE);

    BufferPos currentPos = 0;
    SignalValue buffersDump[] = {
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3
    };
    QualityCode qualityCodesDump[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    TimeStamp timeStampsDump[] = {9, 6, 7, 8};

    const int length = manager.getDataLengthBytes();
    boost::scoped_array<char> storage(createStorage(BUFFERS_COUNT, BUFFER_SIZE,
                                                    currentPos,
                                                    buffersDump,
                                                    qualityCodesDump,
                                                    timeStampsDump,
                                                    length));

    QualityCode expectedQualty[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    boost::scoped_array<char> expected(createStorage(BUFFERS_COUNT, BUFFER_SIZE,
                                                     currentPos,
                                                     buffersDump,
                                                     expectedQualty,
                                                     timeStampsDump,
                                                     length));
    manager.setQualityCode(0, 0, storage.get());
    manager.setQualityCode(1, 1, storage.get());
    manager.setQualityCode(2, 2, storage.get());
    manager.setQualityCode(3, 3, storage.get());
    manager.setQualityCode(4, 4, storage.get());
    manager.setQualityCode(5, 5, storage.get());
    manager.setQualityCode(6, 6, storage.get());
    manager.setQualityCode(7, 7, storage.get());
    manager.setQualityCode(8, 8, storage.get());
    manager.setQualityCode(9, 9, storage.get());

    EXPECT_TRUE(0 == std::memcmp(expected.get(), storage.get(), length));
}
TEST(LowLevelBufferHandler, ParseTimestampsToVector) {
    const BufferId BUFFERS_COUNT = 10;
    const BufferPos BUFFER_SIZE = 4;
    LowLevelBufferHandler manager(BUFFERS_COUNT, BUFFER_SIZE);

    BufferPos currentPos = 0;
    SignalValue buffersDump[] = {
        4, 1, 2, 3,
        8, 5, 6, 7,
        0, 9, 0, 0,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3
    };
    QualityCode qualityCodesDump[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    TimeStamp timeStampsDump[] = {9, 6, 7, 8};

    const int length = manager.getDataLengthBytes();
    boost::scoped_array<char> storage(createStorage(BUFFERS_COUNT, BUFFER_SIZE,
                                                    currentPos,
                                                    buffersDump,
                                                    qualityCodesDump,
                                                    timeStampsDump,
                                                    length));
    QVector<TimeStamp> expected = {9, 8, 7, 6};
    EXPECT_EQ(expected, manager.getTimestamps((void*)storage.get()));
}
TEST(LowLevelBufferHandler, ParseTimestamps) {
    const BufferId BUFFERS_COUNT = 10;
    const BufferPos BUFFER_SIZE = 4;
    LowLevelBufferHandler manager(BUFFERS_COUNT, BUFFER_SIZE);

    BufferPos currentPos = 0;
    SignalValue buffersDump[] = {
        4, 1, 2, 3,
        8, 5, 6, 7,
        0, 9, 0, 0,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3
    };
    QualityCode qualityCodesDump[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    TimeStamp timeStampsDump[] = {9, 6, 7, 8};

    const int length = manager.getDataLengthBytes();
    boost::scoped_array<char> storage(createStorage(BUFFERS_COUNT, BUFFER_SIZE,
                                                    currentPos,
                                                    buffersDump,
                                                    qualityCodesDump,
                                                    timeStampsDump,
                                                    length));
    TimeStamp expected[] = {9, 8, 7, 6};
    std::unique_ptr<TimeStamp[]> actual(manager.getRawTimeStamps((void*)storage.get()));
    EXPECT_TRUE(0 == std::memcmp(expected, actual.get(), 4 * sizeof(TimeStamp)));
}
TEST(LowLevelBufferHandler, GetBufferToVector) {
    const BufferId BUFFERS_COUNT = 10;
    const BufferPos BUFFER_SIZE = 4;
    LowLevelBufferHandler manager(BUFFERS_COUNT, BUFFER_SIZE);

    BufferPos currentPos = 0;
    SignalValue buffersDump[] = {
        4, 1, 2, 3,
        8, 5, 6, 7,
        0, 9, 0, 0,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3
    };
    QualityCode qualityCodesDump[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    TimeStamp timeStampsDump[] = {4, 1, 2, 3};

    const int length = manager.getDataLengthBytes();
    boost::scoped_array<char> storage(createStorage(BUFFERS_COUNT, BUFFER_SIZE,
                                                    currentPos,
                                                    buffersDump,
                                                    qualityCodesDump,
                                                    timeStampsDump,
                                                    length));
    EXPECT_EQ(QVector<SignalValue>({4, 3, 2, 1}), manager.getBuffer<QVector>(0, (void*)storage.get()));
    EXPECT_EQ(QVector<SignalValue>({8, 7, 6, 5}), manager.getBuffer<QVector>(1, (void*)storage.get()));
    EXPECT_EQ(QVector<SignalValue>({0, 0, 0, 9}), manager.getBuffer<QVector>(2, (void*)storage.get()));
}
TEST(LowLevelBufferHandler, GetBuffersDump) {
    const BufferId BUFFERS_COUNT = 10;
    const BufferPos BUFFER_SIZE = 4;
    LowLevelBufferHandler manager(BUFFERS_COUNT, BUFFER_SIZE);

    BufferPos currentPos = 0;
    SignalValue buffersDump[] = {
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3
    };
    QualityCode qualityCodesDump[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    TimeStamp timeStampsDump[] = {4, 1, 2, 3};

    const int length = manager.getDataLengthBytes();
    boost::scoped_array<char> storage(createStorage(BUFFERS_COUNT, BUFFER_SIZE,
                                                    currentPos,
                                                    buffersDump,
                                                    qualityCodesDump,
                                                    timeStampsDump,
                                                    length));

    const int dumpLength = manager.getDumpLengthBytes();
    char *expected = new char[dumpLength];
    memset(expected, 0, dumpLength);
    SignalValue expectedBufferDump[] = {
        4, 3, 2, 1,
        4, 3, 2, 1,
        4, 3, 2, 1,
        4, 3, 2, 1,
        4, 3, 2, 1,
        4, 3, 2, 1,
        4, 3, 2, 1,
        4, 3, 2, 1,
        4, 3, 2, 1,
        4, 3, 2, 1
    };
    QualityCode expectedQualityCodes[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    TimeStamp expectedTimeStamps[] = {4, 3, 2, 1};
    memcpy(expected, expectedBufferDump, (BUFFERS_COUNT * BUFFER_SIZE) * sizeof(SignalValue));
    memcpy(expected + (BUFFERS_COUNT * BUFFER_SIZE) * sizeof(SignalValue), expectedQualityCodes, BUFFERS_COUNT * sizeof(QualityCode));
    memcpy(expected + (BUFFERS_COUNT * BUFFER_SIZE) * sizeof(SignalValue) + BUFFERS_COUNT * sizeof(QualityCode), expectedTimeStamps, BUFFER_SIZE * sizeof(TimeStamp));

    char *dump = manager.getRawBuffersDump((void*)storage.get());
    EXPECT_TRUE(0 == std::memcmp(expected, dump, dumpLength));

    //! Cleanup
    delete[] expected;
    delete[] dump;
}
TEST(LowLevelBufferHandler, MultiplePushWithFullingBuffer) {
    static const BufferId BUFFERS_COUNT = 10;
    static const BufferPos BUFFER_SIZE = 4;

    LowLevelBufferHandler manager(BUFFERS_COUNT, BUFFER_SIZE);
    void *storage = manager.createStorage();
    for (int j = 0; j < 4; ++j) {
        boost::scoped_array<SignalValue> signalsPack(new SignalValue[BUFFERS_COUNT]);
        for (BufferId i = 0; i < BUFFERS_COUNT; ++i)
            signalsPack[i] = j;
        manager.push(j, signalsPack.get(), (void*)storage);
    }

    BufferPos expectedCurrentPos = 3;
    SignalValue expectedBuffers[] = {
        0, 1, 2, 3,
        0, 1, 2, 3,
        0, 1, 2, 3,
        0, 1, 2, 3,
        0, 1, 2, 3,
        0, 1, 2, 3,
        0, 1, 2, 3,
        0, 1, 2, 3,
        0, 1, 2, 3,
        0, 1, 2, 3
    };
    QualityCode expectedQualityCodes[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    TimeStamp expectedTimeStamps[] = {0, 1, 2, 3};

    const int length = manager.getDataLengthBytes();
    boost::scoped_array<char> expected(createStorage(BUFFERS_COUNT, BUFFER_SIZE,
                                                     expectedCurrentPos,
                                                     expectedBuffers,
                                                     expectedQualityCodes,
                                                     expectedTimeStamps,
                                                     length));

    EXPECT_TRUE(0 == std::memcmp(expected.get(), storage, length));

    delete[] (char*)storage;
}
TEST(LowLevelBufferHandler, GetBuffer) {
    const BufferId BUFFERS_COUNT = 10;
    const BufferPos BUFFER_SIZE = 4;
    LowLevelBufferHandler manager(BUFFERS_COUNT, BUFFER_SIZE);

    BufferPos currentPos = 0;
    SignalValue buffersDump[] = {
        4, 1, 2, 3,
        8, 5, 6, 7,
        0, 9, 0, 0,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3
    };
    QualityCode qualityCodesDump[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    TimeStamp timeStampsDump[] = {4, 1, 2, 3};

    const int length = manager.getDataLengthBytes();
    boost::scoped_array<char> storage(createStorage(BUFFERS_COUNT, BUFFER_SIZE,
                                                    currentPos,
                                                    buffersDump,
                                                    qualityCodesDump,
                                                    timeStampsDump,
                                                    length));
    SignalValue expected1[] = {4, 3, 2, 1};
    std::unique_ptr<SignalValue[]> actual1(manager.getRawBuffer(0, (void*)storage.get()));
    EXPECT_TRUE(0 == std::memcmp(expected1, actual1.get(), 4 * sizeof(SignalValue)));

    SignalValue expected2[] = {8, 7, 6, 5};
    std::unique_ptr<SignalValue[]> actual2(manager.getRawBuffer(1, (void*)storage.get()));
    EXPECT_TRUE(0 == std::memcmp(expected2, actual2.get(), 4 * sizeof(SignalValue)));

    SignalValue expected3[] = {0, 0, 0, 9};
    std::unique_ptr<SignalValue[]> actual3(manager.getRawBuffer(2, (void*)storage.get()));
    EXPECT_TRUE(0 == std::memcmp(expected3, actual3.get(), 4 * sizeof(SignalValue)));
}
Exemplo n.º 10
0
TEST(LowLevelBufferHandler, ParseQualityCode) {
    const BufferId BUFFERS_COUNT = 10;
    const BufferPos BUFFER_SIZE = 4;
    LowLevelBufferHandler manager(BUFFERS_COUNT, BUFFER_SIZE);

    BufferPos currentPos = 0;
    SignalValue buffersDump[] = {
        4, 1, 2, 3,
        8, 5, 6, 7,
        0, 9, 0, 0,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3,
        4, 1, 2, 3
    };
    QualityCode qualityCodesDump[] = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9};
    TimeStamp timeStampsDump[] = {9, 6, 7, 8};

    const int length = manager.getDataLengthBytes();
    boost::scoped_array<char> storage(createStorage(BUFFERS_COUNT, BUFFER_SIZE,
                                                    currentPos,
                                                    buffersDump,
                                                    qualityCodesDump,
                                                    timeStampsDump,
                                                    length));
    EXPECT_EQ(0, manager.getQualityCode(0, storage.get()));
    EXPECT_EQ(1, manager.getQualityCode(1, storage.get()));
    EXPECT_EQ(2, manager.getQualityCode(2, storage.get()));
    EXPECT_EQ(3, manager.getQualityCode(3, storage.get()));
    EXPECT_EQ(4, manager.getQualityCode(4, storage.get()));
    EXPECT_EQ(5, manager.getQualityCode(5, storage.get()));
    EXPECT_EQ(6, manager.getQualityCode(6, storage.get()));
    EXPECT_EQ(7, manager.getQualityCode(7, storage.get()));
    EXPECT_EQ(8, manager.getQualityCode(8, storage.get()));
    EXPECT_EQ(9, manager.getQualityCode(9, storage.get()));
}
Exemplo n.º 11
0
TEST(LowLevelBufferHandler, Push) {
    static const BufferId BUFFERS_COUNT = 10;
    static const BufferPos BUFFER_SIZE = 4;
    LowLevelBufferHandler manager(BUFFERS_COUNT, BUFFER_SIZE);

    BufferPos expectedCurrentPos = 0;
    SignalValue expectedBuffers[] = {
        0, 0, 0, 0,
        1, 0, 0, 0,
        2, 0, 0, 0,
        3, 0, 0, 0,
        4, 0, 0, 0,
        5, 0, 0, 0,
        6, 0, 0, 0,
        7, 0, 0, 0,
        8, 0, 0, 0,
        9, 0, 0, 0
    };
    QualityCode expectedQualityCodes[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
    TimeStamp expectedTimeStamps[] = {1, 0, 0, 0};
    const int length = manager.getDataLengthBytes();
    boost::scoped_array<char> expected(createStorage(BUFFERS_COUNT, BUFFER_SIZE,
                                                     expectedCurrentPos,
                                                     expectedBuffers,
                                                     expectedQualityCodes,
                                                     expectedTimeStamps,
                                                     length));

    boost::scoped_array<SignalValue> signalsPackToPush(new SignalValue[BUFFERS_COUNT]);
    for (BufferId i = 0; i < BUFFERS_COUNT; ++i)
        signalsPackToPush[i] = i;

    void *storage = manager.createStorage();
    manager.push(1, signalsPackToPush.get(), storage);

    EXPECT_TRUE(0 == std::memcmp(expected.get(), storage, length));

    delete[] (char*)storage;
}
Exemplo n.º 12
0
TEST(LowLevelBufferHandler, GetMetaData) {
    const BufferId BUFFERS_COUNT = 1;
    const BufferPos BUFFER_SIZE = 1;
    LowLevelBufferHandler manager(BUFFERS_COUNT, BUFFER_SIZE);

    MetaData meta;
    meta.currentPos = 0;
    meta.buffersCount = 1;
    meta.bufferSize = 1;
    meta.clientCount = 10;
    SignalValue buffersDump[] = {0};
    QualityCode qualityCodesDump[] = {0};
    TimeStamp timeStampsDump[] = {0};

    const int length = manager.getDataLengthBytes();
    boost::scoped_array<char> storage(createStorage(BUFFERS_COUNT, BUFFER_SIZE,
                                                    meta,
                                                    buffersDump,
                                                    qualityCodesDump,
                                                    timeStampsDump,
                                                    length));

    EXPECT_EQ(meta, manager.getMetaData(reinterpret_cast<void *>(storage.get())));
}
Exemplo n.º 13
0
void AggregationProcessorMT::aggregate()
{
	tp = Context::getContext()->getServer()->getThreadPool();
	tg = tp->createThreadGroup();

	double resultSize = aggregationPlan->getArea()->getSize();

	initIntern();

	const vector<PPlanNode> &sources = planNode->getChildren();
	for (vector<PPlanNode>::const_iterator source = sources.begin(); source != sources.end(); ++source) {
		PCellStream sourceDataSP = engine->createProcessor(*source, false);

		reader = dynamic_cast<StorageCpu::Processor *>(sourceDataSP.get());
		if (reader && (*source)->getType() == SOURCE) {
			minJump = (size_t)reader->pageList->maxPageSize() * 20;
			reader->mtCallback = this;
			if (!storage) {
				createStorage(resultSize);
			}
			if (newAlg && hashStorage) {
				reader->aggregate(hashStorage, parentMaps);
			} else {
				while (reader->nextIntern()) {
					if (!storage) {
						createStorage(resultSize);
					}
					aggregateCell(reader->getKey(), reader->getValue().getNumeric());
				}
			}
		} else {
			CellValueStream *sourceData = sourceDataSP.get();
			while (sourceData->next()) {
				if (!storage) {
					createStorage(resultSize);
				}
				aggregateCell(sourceData->getKey(), sourceData->getValue().getNumeric());
			}
		}
	}

	tp->join(tg);
	tp->destroyThreadGroup(tg);
	if (threadStorage) {
		if (storage) {
			storageReader = dynamic_cast<ICellMapStream *>(threadStorage.get())->getValues();
			while (storageReader->next()) {
				storage->add(storageReader->getKey(), storageReader->getDouble());
			}
		} else {
			storage = threadStorage;
		}
	}
	if (!storage) {
		storage = CreateDoubleCellMap(aggregationPlan->getArea()->dimCount());
	}
	if (resultSize > 1000 && (Logger::isDebug() || Logger::isTrace())) {
		Logger::debug << "Aggregated area of " << resultSize << " cells. " << storage->size() << " aggregations exists." << endl;
	}
	storageReader = dynamic_cast<ICellMapStream *>(storage.get())->getValues();
}
Exemplo n.º 14
0
SINT4
storageSelfTest1(StgMode in_stgModeOpen, StgMode in_stgModeCreate)
{
    SINT4           iRet =          SSTG_OK;
    RootStorage*    pRoot =         NULL;
    Storage*        pStorage1 =     NULL;
    Storage*        pStorage2 =     NULL;
    Storage*        pStorage3 =     NULL;
    Stream*         pStream1 =      NULL;
    Stream*         pStream2 =      NULL;
    Stream*         pStream3 =      NULL;
    Stream*         pStream4 =      NULL;
    int             cch =           0;
    unsigned long   cchL =          0;
    wchar_t         pwchBuf[] =     L"Stuff to write into streams";
    wchar_t         pwchBuf2[60];

    /* The main thing being tested here is the open list.  If the calling
     * application fails to close some streams and storages before closing
     * the structured storage file, the structured storage library is supposed 
     * to clean everything up automatically.
     */

    /* Create a bunch of streams and storages */
    iRet = createStructuredStorageEx (WSZ_TEST_FILENAME, in_stgModeCreate, &pRoot, 0);
    ASSERT (iRet == SSTG_OK && pRoot != NULL);

    iRet = getStorageFromRoot (pRoot, &pStorage1);
    ASSERT (iRet == SSTG_OK && pStorage1 != NULL);

    iRet = createStream (pStorage1, WSZ_TEST_STREAM_1, &pStream1);
    ASSERT (iRet == SSTG_OK && pStream1 != NULL);

    cch = 0;
    ASSERT (writeLEwstring(pStream1, pwchBuf, &cch) == SSTG_OK && cch == 28);

    iRet = createStorage (pStorage1, WSZ_TEST_STORAGE_2, &pStorage2);
    ASSERT (iRet == SSTG_OK && pStorage2 != NULL);

    iRet = createStorage (pStorage2, WSZ_TEST_STORAGE_3, &pStorage3);
    ASSERT (iRet == SSTG_OK && pStorage3 != NULL);

    iRet = createStream (pStorage2, WSZ_TEST_STREAM_2, &pStream2);
    ASSERT (iRet == SSTG_OK && pStream2 != NULL);

    cch = 0;
    ASSERT (writeLEwstring(pStream2, pwchBuf, &cch) == SSTG_OK && cch == 28);

    cchL = 28 * sizeof(wchar_t);
    iRet = flushStream(pStorage2, WSZ_TEST_STREAM_3, pwchBuf, &cchL);
    ASSERT(iRet == SSTG_OK && cchL == (28 * sizeof(wchar_t)));

    /* Test to ensure that destroying a mini stream works */
    cchL = 28 * sizeof(wchar_t);
    iRet = flushStream(pStorage2, WSZ_TEST_STREAM_4, pwchBuf, &cchL);
    ASSERT(iRet == SSTG_OK && cchL == (28 * sizeof(wchar_t)));
    iRet = destroy(pStorage2, WSZ_TEST_STREAM_4);
    ASSERT(iRet == SSTG_OK);

    /* Test to make sure duplicates are not allowed */
    iRet = createStream(pStorage2, WSZ_TEST_STREAM_3, &pStream4);
    ASSERT (iRet != SSTG_OK && pStream4 == NULL);

    /* Now close the entire compound file without closing any of the open
     * children */
    iRet = closeStructuredStorage(&pRoot);
    ASSERT (iRet == SSTG_OK && pRoot == NULL);

    pStorage1 = NULL;
    pStorage2 = NULL;
    pStorage3 = NULL;
    pStream1 = NULL;
    pStream2 = NULL;
    pStream3 = NULL;

    /* Now do the same thing for reading. */
    /* Open a bunch of streams and storages for reading. */
    iRet = openStructuredStorageEx (WSZ_TEST_FILENAME, in_stgModeOpen, &pRoot);
    ASSERT (iRet == SSTG_OK);

    iRet = getStorageFromRoot (pRoot, &pStorage1);
    ASSERT (iRet == SSTG_OK && pStorage1 != NULL);

    iRet = openStream (pStorage1, WSZ_TEST_STREAM_1, &pStream1);
    ASSERT (iRet == SSTG_OK && pStream1 != NULL);

    cch = 28;
    iRet = readLEwstring(pStream1, &cch, pwchBuf2);
    ASSERT (iRet == SSTG_OK && cch == 28);
    ASSERT (memcmp(pwchBuf, pwchBuf2, wcslen(pwchBuf) + 1) == 0);
    memset(pwchBuf2, 0, sizeof(pwchBuf2));

    iRet = openStorage (pStorage1, WSZ_TEST_STORAGE_2, &pStorage2);
    ASSERT (iRet == SSTG_OK && pStorage2 != NULL);

    iRet = openStorage (pStorage2, WSZ_TEST_STORAGE_3, &pStorage3);
    ASSERT (iRet == SSTG_OK && pStorage3 != NULL);

    iRet = openStream (pStorage2, WSZ_TEST_STREAM_2, &pStream2);
    ASSERT (iRet == SSTG_OK && pStream2 != NULL);

    cch = 28;
    ASSERT (readLEwstring(pStream2, &cch, pwchBuf2) == SSTG_OK && cch == 28);
    ASSERT (memcmp(pwchBuf, pwchBuf2, wcslen(pwchBuf) + 1) == 0);
    memset(pwchBuf2, 0, sizeof(pwchBuf2));

    iRet = openStream (pStorage2, WSZ_TEST_STREAM_3, &pStream3);
    ASSERT (iRet == SSTG_OK && pStream3 != NULL);

    cch = 28 * sizeof(wchar_t);
    iRet = streamRead(pStream3, pwchBuf2, &cchL);
    ASSERT (iRet == SSTG_OK && cchL == (28 * sizeof(wchar_t)));
    ASSERT (memcmp(pwchBuf, pwchBuf2, wcslen(pwchBuf) + 1) == 0);
    memset(pwchBuf2, 0, sizeof(pwchBuf2));

    /* Close the entire compound file without closing any of the open
     * children */
    iRet = closeStructuredStorage(&pRoot);
    ASSERT (iRet == SSTG_OK && pRoot == NULL);

    /* Remove test file */
    SSRW_WREMOVE (WSZ_TEST_FILENAME);

    return iRet;
}