/*---------------------------------------------------------------------- | main +---------------------------------------------------------------------*/ int main(int /*argc*/, char** /*argv*/) { TestMisc(); TestDateFromTimeStringW3C(); TestDateFromTimeStringANSI(); TestDateFromTimeStringRFC_1036(); TestDateFromTimeStringRFC_1123(); TestRandom(); return 0; }
bool DataAccessCommandTest::Run() { vtStor::eErrorCode identifyErrorCode = vtStor::eErrorCode::None; // Use ATA cCommandHandlerAta_GetCommandHandler(m_TestResource->GetCommandHandler(), m_TestResource->GetAtaProtocol()); // Register command handler m_TestResource->GetSelectedDrive()->RegisterCommandHandler(TestResource::COMMAND_HANDLE_ATA_COMMAND_TYPE, m_TestResource->GetCommandHandler()); bool result = true; result &= TestBoundary(); result &= TestRandom(); result &= TestOutOfBound(); return (result); }
int main() { srand(time(NULL)); //new gameState struct gameState * randomState = malloc(sizeof(struct gameState)); int i; int numPlayers; int kingdomCards[10]; int randomSeed; int firstRun = 1; int returnValue; printf("Unit test 1\r\n"); printf("Conducting %d random trials.\r\n", UNITTEST1_TRIALS); int foundErrors = 0; int trials; for (trials = 0; trials < UNITTEST1_TRIALS; trials++ ){ //fuzz the state fuzzState(randomState); //semi-randomize inputs (within reason) numPlayers = randomNumPlayers(); unittest1_initiateKingdomCards(kingdomCards); randomSeed = rand(); //run function and store results returnValue = initializeGame(numPlayers, kingdomCards, randomSeed, randomState); //test outputs: if (firstRun == 1) TestRandom(); if (returnValue != -1) { foundErrors -= checkGameState(randomState, returnValue, numPlayers, kingdomCards); //subtracts a negative to add } firstRun = 0; } printf("Unit Test 1 Complete. I found %d errors\r\n", foundErrors); return 0; }
// Handle message from javascript, javascript side will tell me what // kind of test it wants, and I will respond accordingly. static void HandleMessage(PP_Instance instance, struct PP_Var message) { if (!ppb_messaging || !ppb_var || message.type != PP_VARTYPE_STRING) { __libnacl_irt_basic.exit(1); } uint32_t message_len; const char* message_string = ppb_var->VarToUtf8(message, &message_len); if (!my_strncmp("Message from Javascript to NaCl", message_string, message_len)) { // Reply back with what we received. ppb_messaging->PostMessage(instance, message); } else if (!my_strncmp("random", message_string, message_len)) { TestRandom(instance); } else { // Unknown message came. PostStringMessage(instance, "Unknown message type"); } }