Example #1
0
bool MetavoxelTests::run() {
    
    qDebug() << "Running metavoxel tests...";
    
    // seed the random number generator so that our tests are reproducible
    srand(0xBAAAAABE);

    // create two endpoints with the same header
    QByteArray datagramHeader("testheader");
    Endpoint alice(datagramHeader), bob(datagramHeader);
    
    alice.setOther(&bob);
    bob.setOther(&alice);
    
    // perform a large number of simulation iterations
    const int SIMULATION_ITERATIONS = 100000;
    for (int i = 0; i < SIMULATION_ITERATIONS; i++) {
        if (alice.simulate(i) || bob.simulate(i)) {
            return true;
        }
    }
    
    qDebug() << "Sent" << highPriorityMessagesSent << "high priority messages, received" << highPriorityMessagesReceived;
    qDebug() << "Sent" << unreliableMessagesSent << "unreliable messages, received" << unreliableMessagesReceived;
    qDebug() << "Sent" << reliableMessagesSent << "reliable messages, received" << reliableMessagesReceived;
    qDebug() << "Sent" << streamedBytesSent << "streamed bytes, received" << streamedBytesReceived;
    qDebug() << "Sent" << datagramsSent << "datagrams, received" << datagramsReceived;
    
    qDebug() << "All tests passed!";
    
    return false;
}
Example #2
0
bool MetavoxelTests::run() {
    
    qDebug() << "Running transmission tests...";
    qDebug();
    
    // seed the random number generator so that our tests are reproducible
    srand(0xBAAAAABE);

    // create two endpoints with the same header
    QByteArray datagramHeader("testheader");
    Endpoint alice(datagramHeader), bob(datagramHeader);
    
    alice.setOther(&bob);
    bob.setOther(&alice);
    
    // perform a large number of simulation iterations
    const int SIMULATION_ITERATIONS = 10000;
    for (int i = 0; i < SIMULATION_ITERATIONS; i++) {
        if (alice.simulate(i) || bob.simulate(i)) {
            return true;
        }
    }
    
    qDebug() << "Sent" << highPriorityMessagesSent << "high priority messages, received" << highPriorityMessagesReceived;
    qDebug() << "Sent" << unreliableMessagesSent << "unreliable messages, received" << unreliableMessagesReceived;
    qDebug() << "Sent" << reliableMessagesSent << "reliable messages, received" << reliableMessagesReceived;
    qDebug() << "Sent" << streamedBytesSent << "streamed bytes, received" << streamedBytesReceived;
    qDebug() << "Sent" << datagramsSent << "datagrams with" << bytesSent << "bytes, received" <<
        datagramsReceived << "with" << bytesReceived << "bytes";
    qDebug() << "Created" << sharedObjectsCreated << "shared objects, destroyed" << sharedObjectsDestroyed;
    qDebug() << "Performed" << objectMutationsPerformed << "object mutations";
    qDebug();
    
    qDebug() << "Running serialization tests...";
    qDebug();
    
    if (testSerialization(Bitstream::HASH_METADATA) || testSerialization(Bitstream::FULL_METADATA)) {
        return true;
    }
    
    qDebug() << "All tests passed!";
    
    return false;
}