/** * @dataProvider setupData */ void KArchiveTest::testTarReadWrite() { QFETCH(QString, fileName); // testCreateTar must have been run first. KTar tar(fileName); QVERIFY(tar.open(QIODevice::ReadWrite)); testReadWrite(&tar); testFileData(&tar); QVERIFY(tar.close()); // Reopen it and check it { KTar tar(fileName); QVERIFY(tar.open(QIODevice::ReadOnly)); testFileData( &tar ); const KArchiveDirectory* dir = tar.directory(); const KArchiveEntry* e = dir->entry("newfile"); QVERIFY(e && e->isFile()); const KArchiveFile* f = (KArchiveFile*)e; QCOMPARE(f->data().size(), 8); } // NOTE This is the last test for this dataset. so cleanup here QFile::remove(fileName); }
bool TestSerializationBuffer::doTest() { bool pass = true; pass &= testReadWrite( ); pass &= testExternalBuffer( ); pass &= testStrings( ); performanceTest( ); return pass; }
/* main function running all tests */ int main (void) { testName = ""; initStorageManager(); testReadWrite(); testAppendEnsureCapMetaData(); return 0; }
int main (int argc, char *argv[]) { unsigned int failureCount = 0; GNUNET_log_setup ("test-disk", "WARNING", NULL); failureCount += testReadWrite (); failureCount += testOpenClose (); failureCount += testDirScan (); failureCount += testDirIter (); failureCount += testCanonicalize (); failureCount += testChangeOwner (); failureCount += testDirMani (); if (failureCount != 0) { FPRINTF (stderr, "\n%u TESTS FAILED!\n", failureCount); return -1; } return 0; } /* end of main */
bool WGF3::test() { bool result = true; if (!testFileCreate()) { std::cout << "false\n"; result = false; } else { std::cout << "OK\n"; } if (!testReadWrite()) { std::cout << "false\n"; result = false; } else { std::cout << "OK\n"; } return result; }
void sdtest_task(void *d) { struct sd_response res; int32_t ret; uint32_t arg; uint32_t rca; (void) data; ret = sd_sendCommand(sd, CMD(0), 0, NULL, 100 / portTICK_PERIOD_MS); CONFIG_ASSERT(ret == 0); { arg = 0; arg |= (0x1 << 8); /* Select 2.7 - 3.3 V */ arg |= (0x42 << 0); /* 8 Bit Check Pattern */ ret = sd_sendCommand(sd, CMD(8), arg, &res, 100 / portTICK_PERIOD_MS); /* Only Version >= 2.0 is suppored in this test */ CONFIG_ASSERT(ret == 0); /* Voltage shall acceped and check pattern is 0x42 */ CONFIG_ASSERT((res.data[3] & 0xFFF) == ((1 << 8) | (0x42 << 0))); } { arg = 0; arg |= BIT(19) | BIT(20) | BIT(31); /* aprox 3.3 is used */; arg |= BIT(28); /* Switch from Power Save to max perf */ arg |= BIT(30); /* Acrivate SDHC or SDXC Support */ do { /* Send ACMD41 -> CMD55 + ACMD41 */ ret = sd_sendCommand(sd, CMD(55), 0, &res, 100 / portTICK_PERIOD_MS); CONFIG_ASSERT(ret == 0); ret = sd_sendCommand(sd, ACMD(41), arg, &res, 100 / portTICK_PERIOD_MS); CONFIG_ASSERT(ret == 0); } while (((res.data[3] >> 31) & 0x1) != 0x1); } { /* Ask for CID */ ret = sd_sendCommand(sd, CMD(2), 0, &res, 100 / portTICK_PERIOD_MS); CONFIG_ASSERT(ret == 0); /* Set Card to ready mode and get RCA*/ ret = sd_sendCommand(sd, CMD(3), 0, &res, 100 / portTICK_PERIOD_MS); CONFIG_ASSERT(ret == 0); rca = res.data[3] & 0xFFFF0000; /* Set Card is transver mode */ ret = sd_sendCommand(sd, CMD(7), rca, 0, 100 / portTICK_PERIOD_MS); CONFIG_ASSERT(ret == 0); } testReadWrite(); { arg = 0; arg |= 2; ret = sd_sendCommand(sd, CMD(55), rca, NULL, 100 / portTICK_PERIOD_MS); CONFIG_ASSERT(ret == 0); ret = sd_sendCommand(sd, ACMD(6), arg, NULL, 100 / portTICK_PERIOD_MS); CONFIG_ASSERT(ret == 0); ret = sd_setBusWide(sd, SD_BusWide_4b); CONFIG_ASSERT(ret == 0); } testReadWrite(); { ret = sd_setClock(sd, 48000000); CONFIG_ASSERT(ret == 0); } testReadWrite(); vTaskSuspend(NULL); }