void CIpuTestHarness::ResourceLeakTest() // // Creates a new test that fails if any there are any leaked resource handles { // Start new test _LIT(KResourceTestName, "Resource Handle Leak Test"); TRAPD(testError, StartTestL(KResourceTestName)); if(testError==KErrNone) { // Find number of opened handles TInt processHandleCount=0; TInt threadHandleCount=0; RThread().HandleCount(processHandleCount,threadHandleCount); TInt openHandleCount = iStartHandleCount-threadHandleCount; TInt err = KErrNone; if ( openHandleCount !=0 ) { err = KErrGeneral; LogIt(_L("Number leaked handles is %D"), openHandleCount); } EndTest(err); } else { _LIT(KTxtResourceTestRunError, "Unable to complete Resource Leak Test, error: %d"); LogIt(KTxtResourceTestRunError, testError); EndTest(testError); } }
nsresult AsyncNoShutdownTest(int testNumber) { // This test gets a service, and also gets an async request for shutdown, // but the service doesn't get shut down because some other client (who's // not participating in the async shutdown game as he should) is // continuing to hang onto the service. This causes myServ variable to // get set to NULL, but the service doesn't get unloaded right away as // it should. nsresult err; err = BeginTest(testNumber); if (err != NS_OK) return err; // Create some other user of kIMyServiceCID, preventing it from // really going away: IMyService* otherClient; err = CallGetService(kIMyServiceCID, &otherClient); if (err != NS_OK) return err; err = AsyncShutdown(testNumber); if (err != NS_OK) return err; err = EndTest(testNumber); // Finally, release the other client. NS_RELEASE(otherClient); return err; }
void TestContext::Fail(std::string message) { if (message.empty()) message = "fail"; EndTest(TestFinishState::FAILED, message); // TODO: Throw "assert" exception }
void CTModifiersChangedTest::IncSubState() { if (iSubState==(numTests-1)) EndTest(); else { iSubState++; iWin->Invalidate(); } }
void ItemContainerWidgetsPage::OnButtonTestItemContainer(wxCommandEvent&) { m_container = GetContainer(); wxASSERT_MSG(m_container, wxT("Widget must have a test widget")); wxLogMessage(wxT("wxItemContainer test for %s, %s:"), GetWidget()->GetClassInfo()->GetClassName(), (m_container->IsSorted() ? "Sorted" : "Unsorted")); const wxArrayString expected_result = m_container->IsSorted() ? MakeArray(m_itemsSorted) : m_items; StartTest(wxT("Append one item")); wxString item = m_items[0]; m_container->Append(item); EndTest(wxArrayString(1, &item)); StartTest(wxT("Append some items")); m_container->Append(m_items); EndTest(expected_result); StartTest(wxT("Append some items with data objects")); wxClientData **objects = new wxClientData *[m_items.GetCount()]; unsigned i; for ( i = 0; i < m_items.GetCount(); ++i ) objects[i] = CreateClientData(i); m_container->Append(m_items, objects); EndTest(expected_result); delete[] objects; StartTest(wxT("Append some items with data")); void **data = new void *[m_items.GetCount()]; for ( i = 0; i < m_items.GetCount(); ++i ) data[i] = wxUIntToPtr(i); m_container->Append(m_items, data); EndTest(expected_result); delete[] data; StartTest(wxT("Append some items with data, one by one")); for ( i = 0; i < m_items.GetCount(); ++i ) m_container->Append(m_items[i], wxUIntToPtr(i)); EndTest(expected_result); StartTest(wxT("Append some items with data objects, one by one")); for ( i = 0; i < m_items.GetCount(); ++i ) m_container->Append(m_items[i], CreateClientData(i)); EndTest(expected_result); if ( !m_container->IsSorted() ) { StartTest(wxT("Insert in reverse order with data, one by one")); for ( unsigned i = m_items.GetCount(); i; --i ) m_container->Insert(m_items[i - 1], 0, wxUIntToPtr(i - 1)); EndTest(expected_result); } }
nsresult SimpleTest(int testNumber) { // This test just gets a service, uses it and releases it. nsresult err; err = BeginTest(testNumber); if (err != NS_OK) return err; err = EndTest(testNumber); return err; }
int main() { StartTest("LexTest"); ParseResult result; Parser parser(g_testProgram, result); Token token; for (TokenType expectedType : g_expectedTypes) { if ((token = parser.PeekToken(false)).type != expectedType) { if (token.type == TOKEN_NAME) std::cout << "Failed token was an identifier: " << token.text << std::endl; std::cout << "Expected: " << Util::TokenName(expectedType) << ", not: " << Util::TokenName(token.type) << std::endl; EndTest(false); } parser.NextToken(false); } EndTest(true); }
void XmlTestReporter::ReportSummary(int totalTestCount, int failedTestCount, int failureCount, float secondsElapsed) { AddXmlElement(m_ostream, NULL); BeginResults(m_ostream, totalTestCount, failedTestCount, failureCount, secondsElapsed); DeferredTestResultList const& results = GetResults(); for (DeferredTestResultList::const_iterator i = results.begin(); i != results.end(); ++i) { BeginTest(m_ostream, *i); if (i->failed) AddFailure(m_ostream, *i); EndTest(m_ostream, *i); } EndResults(m_ostream); }
// // Perform the Test // LOCAL_C void PerformTestL() /** * * The PerformTestL method is the main user interface routine for the GSM TSY Regression * Test Harness. It loads the appropriate serial drivers and unloads them at completion. * This method presents the user with the list of tests to run and then * responds to the user's input. If the user does not select any specific test, it runs all * tests as the default. * * @leave This method leaves if it can not connect to the communications server or load * the CSY. Additionally, this method leaves if the test script can not be created. * If the test fails with an error, User::Leave will be invoked. */ { RCommServ commServer; TESTL(commServer.Connect()==KErrNone); TInt res=commServer.LoadCommModule(_L("ECUART.CSY")); INFO_PRINTF1(TRefByValue<const TDesC>(_L("LoadCommModuleError = %d\n")), res); TESTL(res==KErrNone || res==KErrAlreadyExists); // This block of prints is for all tests to be listed in one column // Note: by displaying menu selectons in a single column, all selections will not be visible INFO_PRINTF1(_L("Which test? Leave to run all tests\n")); INFO_PRINTF1(_L("a) Receive SMS Test\n")); INFO_PRINTF1(_L("b) SMS Notification Test\n")); INFO_PRINTF1(_L("c) SMS PDU Capability Test\n")); INFO_PRINTF1(_L("d) Default SCA Test\n")); INFO_PRINTF1(_L("e) SMS Transmission Test\n")); INFO_PRINTF1(_L("f) Data Call Test\n")); INFO_PRINTF1(_L("g) Errored Data Call Test\n")); INFO_PRINTF1(_L("h) Odd Initialisation Tests\n")); INFO_PRINTF1(_L("i) SMS Storage Tests\n")); INFO_PRINTF1(_L("j) Failure Initialisation Tests\n")); INFO_PRINTF1(_L("k) Incoming Call Tests\n")); INFO_PRINTF1(_L("l) SMS Cancel Scenarios\n")); INFO_PRINTF1(_L("m) Shutdown Scenarios\n")); INFO_PRINTF1(_L("n) SMS Storage Delete Test\n")); INFO_PRINTF1(_L("o) Simultaneous Fax Reception and Signal Strength Retrieval Scenario\n")); INFO_PRINTF1(_L("p) Data Call Cancel Scenarios\n")); INFO_PRINTF1(_L("q) Fax Call Premature Close Scenario\n")); INFO_PRINTF1(_L("r) Two Fax Reception Scenario\n")); INFO_PRINTF1(_L("s) Voice Call Scenarios\n")); INFO_PRINTF1(_L("t) Data Call Set-up, Data Transfer and Remote Termination Test\n")); INFO_PRINTF1(_L("u) Data Call Dial-up Networking Call-back Test\n")); INFO_PRINTF1(_L("v) Data Call Answer and Remote Hang-up Closely Followed by a Dial Test\n")); INFO_PRINTF1(_L("w) Phonebook tests\n")); INFO_PRINTF1(_L("x) Network and Registration tests\n")); INFO_PRINTF1(_L("y) Phone and Line tests\n")); INFO_PRINTF1(_L("z) Voice and Data calls tests\n")); INFO_PRINTF1(_L("1) No CNMI info and Modem Detection tests\n")); INFO_PRINTF1(_L("2) No CMGF info tests\n")); INFO_PRINTF1(_L("3) AT+CBST tests\n")); INFO_PRINTF1(_L("4) CBST & CNMI string parsing test\n")) ; INFO_PRINTF1(_L("5) CGQREQ responses during initialise\n")); INFO_PRINTF1(_L("6) Unsolicited messages injected during initialisation\n")); INFO_PRINTF1(_L("9) Voice Call OOM tests (NOT RUN AS PART OF 'ALL TESTS')\n")); TBool keyPressed=ETrue; TKeyCode key=ShortWaitForKey(10, keyPressed); TBool allTests=!keyPressed; if(keyPressed) { if((key>='A')&&(key<='Z')) // A simple fold key=(TKeyCode)(key-'A'+'a'); } // // Run the tests... // // Test Rx SMS messages if((key=='a')||(allTests)) { SIMPLETESTMACRO("Simple SMS Receive",CTestDriveRxMess,ERxMessScript); SIMPLETESTMACRO("CMT SMS Receive",CTestDriveRxMessCmt,ERxMessCmtAndCmtiScript); SIMPLETESTMACRO("CMTI SMS Receive emulating an Ericsson T28",CTestDriveRxMess,ERxMessEricssonT28Script); } // Test Notification of SMS messages if((key=='b')||(allTests)) { SIMPLETESTMACRO("SMS CMTI Notification and Receive",CTestDriveNotMess,ERxMessScript); SIMPLETESTMACRO("SMS CMT Notification and Receive",CTestDriveNotMessCmt,ERxMessCmtScript); } // Test behaviour when a modem claims not to support SMS PDU mode if((key=='c')||(allTests)) { SIMPLETESTMACRO("No SMS PDU capability",CTestDriveNoPduRxMess,ENoPduRxMessScript); } // Test retrieval and setting of default service centre if ((key=='d')||(allTests)) { SIMPLETESTMACRO("Simple SCA retrieval & setting",CTestDriveSca,EScaSimpleScript); SIMPLETESTMACRO("8210-style SCA retrieval & setting",CTestDriveSca,ESca8210StyleScript); } // Test a simple SMS Tx if((key=='e')||(allTests)) { SIMPLETESTMACRO("A simple SMS Tx",CTestDriveTxMess,ETxMessScript); SIMPLETESTMACRO("New Standard SMS Tx",CTestDriveTxNewStdMess,ETxMessNewStdScript); SIMPLETESTMACRO("New Standard SMS Tx Test emulating an Ericsson T28",CTestDriveTxNewStdMess,ETxMessT28NewStdScript); // Test no prefix on pdu, don't set default sca, new ETSI format _LIT8(KTxA,"Tx: no PDU prefix, no default SCA set, new standard"); StartTest(KTxA); CTestDriveTxWithScaCombo* test4c=CTestDriveTxWithScaCombo::NewL(ETxMessScriptNoprefixNodefscaNew,EFalse,EFalse,ETrue); CleanupStack::PushL(test4c); User::LeaveIfError(test4c->RunTestL()); CleanupStack::PopAndDestroy(); EndTest(KTxA); User::After(1000000L); // Test prefix on pdu, don't set default sca, new ETSI format _LIT8(KTxB,"Tx: PDU prefix, no default SCA set, new standard"); StartTest(KTxB); test4c=CTestDriveTxWithScaCombo::NewL(ETxMessScriptPrefixNodefscaNew,ETrue,EFalse,ETrue); CleanupStack::PushL(test4c); User::LeaveIfError(test4c->RunTestL()); CleanupStack::PopAndDestroy(); EndTest(KTxB); User::After(1000000L); // Test no prefix on pdu, set default sca, new ETSI format _LIT8(KTxC,"Tx: no PDU prefix, default SCA set, new standard"); StartTest(KTxC); test4c=CTestDriveTxWithScaCombo::NewL(ETxMessScriptNoprefixDefscaNew,EFalse,ETrue,ETrue); CleanupStack::PushL(test4c); User::LeaveIfError(test4c->RunTestL()); CleanupStack::PopAndDestroy(); EndTest(KTxC); User::After(1000000L); // Test prefix on pdu, set default sca, new ETSI format _LIT8(KTxD,"Tx: PDU prefix, default SCA set, new standard"); StartTest(KTxD); test4c=CTestDriveTxWithScaCombo::NewL(ETxMessScriptPrefixDefscaNew,ETrue,ETrue,ETrue); CleanupStack::PushL(test4c); User::LeaveIfError(test4c->RunTestL()); CleanupStack::PopAndDestroy(); EndTest(KTxD); User::After(1000000L); // Test no prefix on pdu, don't set default sca, old ETSI format _LIT8(KTxE,"Tx: No PDU prefix, no default SCA set, old standard"); StartTest(KTxE); test4c=CTestDriveTxWithScaCombo::NewL(ETxMessScriptNoprefixNodefscaOld,EFalse,EFalse,EFalse); CleanupStack::PushL(test4c); User::LeaveIfError(test4c->RunTestL()); CleanupStack::PopAndDestroy(); EndTest(KTxE); User::After(1000000L); // Test prefix on pdu, don't set default sca, old ETSI format _LIT8(KTxF,"Tx: PDU prefix, no default SCA set, old standard"); StartTest(KTxF); test4c=CTestDriveTxWithScaCombo::NewL(ETxMessScriptPrefixNodefscaOld,ETrue,EFalse,EFalse); CleanupStack::PushL(test4c); User::LeaveIfError(test4c->RunTestL()); CleanupStack::PopAndDestroy(); EndTest(KTxF); User::After(1000000L); // Test no prefix on pdu, set default sca, old ETSI format _LIT8(KTxG,"Tx: no PDU prefix, default SCA set, old standard"); StartTest(KTxG); test4c=CTestDriveTxWithScaCombo::NewL(ETxMessScriptNoprefixDefscaOld,EFalse,ETrue,EFalse); CleanupStack::PushL(test4c); User::LeaveIfError(test4c->RunTestL()); CleanupStack::PopAndDestroy(); EndTest(KTxG); User::After(1000000L); // Test prefix on pdu, set default sca, old ETSI format _LIT8(KTxH,"Tx: PDU prefix, default SCA set, old standard"); StartTest(KTxH); test4c=CTestDriveTxWithScaCombo::NewL(ETxMessScriptPrefixDefscaOld,ETrue,ETrue,EFalse); CleanupStack::PushL(test4c); User::LeaveIfError(test4c->RunTestL()); CleanupStack::PopAndDestroy(); EndTest(KTxH); User::After(1000000L); // Test a "+CMS ERROR 321" from a Read (observed on an Ericsson 888) SIMPLETESTMACRO("Invalid Read Test",CTestDriveTxRx,ETxMessRxTxScriptA); } // Test Dialing a Data Call if((key=='f')||(allTests)) { SIMPLETESTMACRO("Dialing a simple Data Call",CTestDriveDataCall,EDataCallScript); } // Test an Error Dialing a Data Call if((key=='g')||(allTests)) { SIMPLETESTMACRO("Dialing a simple Data Call, with the modem ERRORing some commands",CTestDriveDataCall,EDataCallErrorAScript); } // Test some odd initialisation sequences if((key=='h')||(allTests)) { SIMPLETESTMACRO("Odd Initialisation Sequence A",CTestDriveOddInit,EOddInitAScript); SIMPLETESTMACRO("Odd Initialisation Sequence B",CTestDriveOddInit,EOddInitBScript); SIMPLETESTMACRO("Odd Initialisation Sequence C",CTestDriveOddInit,EOddInitCScript); SIMPLETESTMACRO("Odd Initialisation Sequence D",CTestDriveOddInit,EOddInitDScript); SIMPLETESTMACRO("Odd Initialisation Sequence E",CTestDriveOddInit,EOddInitEScript); SIMPLETESTMACRO("Odd Initialisation Sequence F",CTestDriveOddInit,EOddInitFScript); SIMPLETESTMACRO("Odd Initialisation Sequence G",CTestDriveOddInit,EOddInitGScript); SIMPLETESTMACRO("Odd Initialisation Sequence H",CTestDriveOddInit,EOddInitHScript); SIMPLETESTMACRO("Odd Initialisation Sequence I",CTestDriveOddInit,EOddInitIScript); } // Test SMS Storage functions if((key=='i')||(allTests)) { SIMPLETESTMACRO("Message Storage Functions with old standard PDUs",CTestDriveMessStor,EMessStorOldSmsStdScript); SIMPLETESTMACRO("Message Storage Functions with new standard PDUs",CTestDriveMessStor,EMessStorNewSmsStdScript); } // Test Initialisation Failure Scenarios if((key=='j')||(allTests)) { SIMPLETESTMACRO("Initialisation Failure Scenarios",CTestDriveFailInit,EFailInitAScript); } // Test Incoming Call Scenarios if((key=='k')||(allTests)) { SIMPLETESTMACRO("Incoming Call Scenarios",CTestDriveInCall,EInCallScriptA); SIMPLETESTMACRO("Incoming Call Scenarios with a Nokia",CTestDriveInCall,EInCallScriptB); } // Test SMS Cancel if((key=='l')||(allTests)) { SIMPLETESTMACRO("SMS Cancel CMT Scenarios",CTestDriveSmsCancel,ESmsCancelScript); SIMPLETESTMACRO("SMS Cancel CMTI Scenarios",CTestDriveSmsCancel,ESmsCancelCmtiScript); } // Test Shutdown Scenarios if((key=='m')||(allTests)) { SIMPLETESTMACRO("Shutdown Scenarios",CTestDriveShutdown,EShutdownScript); SIMPLETESTMACRO("Shutdown Scenarios A",CTestDriveShutdownA,EShutdownScriptA); } // Test SMS Delete if((key=='n')||(allTests)) { SIMPLETESTMACRO("A Simple SMS Storage Delete",CTestDriveSmsDelete,ESmsStorageDeleteScript); } // Test simultaneous Fax Reception and Signal Strength Retrieval if((key=='o')||(allTests)) { SIMPLETESTMACRO("Simultaneous Fax Reception and Signal Strength Retrieval",CTestDriveSsFax,ESsFaxScriptA); SIMPLETESTMACRO("Simultaneous Data Reception and Signal Strength Retrieval",CTestDriveSSData,ESsDataScriptA); } // Test Data Call Cancel Scenarios if((key=='p')||(allTests)) { SIMPLETESTMACRO("Data Call Cancel Scenarios",CTestDriveDataCallCancel,EDataCallCancelScript); } // Fax Call Premature Close Scenarios if((key=='q')||(allTests)) { SIMPLETESTMACRO("Fax Call Premature Close Scenarios",CTestDrivePremClose,EFaxPremCloseScriptA); // SIMPLETESTMACRO("Fax Call Premature Close Scenarios Part B",CTestDrivePremCloseB,EFaxPremCloseScriptB); } // Two Fax Reception Scenarios if((key=='r')||(allTests)) { SIMPLETESTMACRO("Two Fax Reception Scenarios",CTestDriveTwoFaxRx,ETwoFaxRxScriptA); } // Voice Call Scenarios if((key=='s')||(allTests)) { SIMPLETESTMACRO("Voice Call Scenarios",CTestDriveVoiceCall,EVoiceCallScriptA); } // Test Dialing a Set-up, Data Transfer and Remote Termination Data Call if((key=='t')||(allTests)) { SIMPLETESTMACRO("Dialing a Set-up, Data Transfer and Remote Termination Data Call",CTestDriveDataCallRemoteTerm,EDataCallRemoteTermScript); } // Test Dialing a Dial-up Networking Call-back Data Call if((key=='u')||(allTests)) { TInt varDelay; // Variable Delay for EWait script, for scoping purposes varDelay = KCallBackDefVarDelay; if(!allTests) { // This tests is valid for supporting variable delay for an EWait script varDelay = GetNumberEntry( KCallBackMaxDigits, // max numbers of digits KCallBackMinVarDelay, // min value allowed KCallBackMaxVarDelay, // max value allowed KInputWaitOnDelaySecs, // secs to wait for a user key entry KCallBackDefVarDelay, // default value if timed out _L("Enter delay value") ); } _LIT8(KCallbackA,"Dialing a Dial-up Networking Call-back Data Call"); StartTest(KCallbackA); CTestDriveDataCallCallBack* test23=CTestDriveDataCallCallBack::NewL(EDataCallCallBackScript, varDelay); CleanupStack::PushL(test23); User::LeaveIfError(test23->RunTestL()); CleanupStack::PopAndDestroy(); EndTest(KCallbackA); User::After(1000000L); } // Test an Answer and Remote Hang-up Closely Followed by a Dial Data Call if((key=='v')||(allTests)) { TInt varDelay; // Variable Delay for EWait script, for scoping purposes varDelay = KHangupDialDefVarDelay; if(!allTests) { // This tests is valid for supporting variable delay for an EWait script varDelay = GetNumberEntry( KHangupDialMaxDigits, // max numbers of digits KHangupDialMinVarDelay, // min value allowed KHangupDialMaxVarDelay, // max value allowed KInputWaitOnDelaySecs, // secs to wait for a user key entry KHangupDialDefVarDelay, // default value if timed out _L("Enter delay value") ); } _LIT8(KCallbackB,"Answer and Remote Hang-up Closely Followed by a Dial Data Call"); StartTest(KCallbackB); CTestDriveRemoteHangupDial* test24=CTestDriveRemoteHangupDial::NewL(EDataCallRemoteHangDialScript, varDelay); CleanupStack::PushL(test24); User::LeaveIfError(test24->RunTestL()); CleanupStack::PopAndDestroy(); EndTest(KCallbackB); User::After(1000000L); } // Phone book tests if((key=='w')||(allTests)) { SIMPLETESTMACRO("Phone book Scenarios",CTestDrivePhoneBook,EPhoneBookScript); } // Network and Registration tests if((key=='x')||(allTests)) { SIMPLETESTMACRO("Testing Network and Registration",CTestDriveNetworkRegistration,ENetworkRegistrationScript); } // Phone and Line tests if((key=='y')||(allTests)) { SIMPLETESTMACRO("Phone and Line Scenarios",CTestDrivePhoneLine,EPhoneLineScript); } // Voice and Data Call tests if((key=='z')||(allTests)) { SIMPLETESTMACRO("Voice and Data Calls",CTestDriveAllCalls,EAllCallsScript); } // No CNMI information and Modem notification tests if((key=='1')||(allTests)) { SIMPLETESTMACRO("No CNMI info and Modem notification request",CTestDriveNoCnmi,ENoCnmiScript); } // No CMGF information tests if((key=='2')||(allTests)) { SIMPLETESTMACRO("No CMGF info request",CTestDriveNoCmgf,ENoCmgfScript); } // AT+CBST information tests if((key=='3')||(allTests)) { SIMPLETESTMACRO("AT+CBST tests",CTestDriveDataCallDiffParam, ECallDiffParamScript); } //CBST string parsing test if((key=='4')||(allTests)) { SIMPLETESTMACRO("CBST & CNMI string parsing test",CTestDriveCbstParse, ECbstParseScript); } // CGQREQ responses during initialise (added to increase conditional code coverage) if((key=='5')||(allTests)) { SIMPLETESTMACRO("CGQREQ responses during initialise",CTestDriveCGQREQResponses,ECGQREQResponsesScript); } // Unsolicited messages injected during initialisation if((key=='6')||(allTests)) { SIMPLETESTMACRO("Unsolicited messages injected during initialisation",CTestDriveUnsolicited,EUnsolicitedScript); } // OOM Voice Call tests, not run as part of 'all tests' if(key=='9') { SIMPLETESTMACRO("OOM Voice Call",CTestDriveOOMVoiceCall,EOOMVoiceCall); } // // Tidy up after the tests // res = commServer.UnloadCommModule(_L("ECUART.CSY")); commServer.Close(); }
void DcfManagerTest::DoRun (void) { // 0 3 4 5 8 9 10 12 // | sifs | aifsn | tx | sifs | aifsn | | tx | // StartTest (1, 3, 10); AddDcfState (1); AddAccessRequest (1, 1, 4, 0); AddAccessRequest (10, 2, 10, 0); EndTest (); // Check that receiving inside SIFS shall be cancelled properly: // 0 3 4 5 8 9 12 13 14 // | sifs | aifsn | tx | sifs | ack | sifs | aifsn | |tx | // StartTest (1, 3, 10); AddDcfState (1); AddAccessRequest (1, 1, 4, 0); AddRxInsideSifsEvt (6, 10); AddTxEvt (8, 1); AddAccessRequest (14, 2, 14, 0); EndTest (); // The test below mainly intends to test the case where the medium // becomes busy in the middle of a backoff slot: the backoff counter // must not be decremented for this backoff slot. This is the case // below for the backoff slot starting at time 78us. // // 20 60 66 70 74 78 80 100 106 110 114 118 120 // | rx | sifs | aifsn | bslot0 | bslot1 | | rx | sifs | aifsn | bslot2 | bslot3 | tx | // | // 30 request access. backoff slots: 4 StartTest (4, 6, 10); AddDcfState (1); AddRxOkEvt (20, 40); AddRxOkEvt (80, 20); AddAccessRequest (30, 2, 118, 0); ExpectCollision (30, 4, 0); // backoff: 4 slots EndTest (); // Test the case where the backoff slots is zero. // // 20 60 66 70 72 // | rx | sifs | aifsn | tx | // | // 30 request access. backoff slots: 0 StartTest (4, 6, 10); AddDcfState (1); AddRxOkEvt (20, 40); AddAccessRequest (30, 2, 70, 0); ExpectCollision (30, 0, 0); // backoff: 0 slots EndTest (); // Test shows when two frames are received without interval between // them: // 20 60 100 106 110 112 // | rx | rx |sifs | aifsn | tx | // | // 30 request access. backoff slots: 0 StartTest (4, 6, 10); AddDcfState (1); AddRxOkEvt (20, 40); AddRxOkEvt (60, 40); AddAccessRequest (30, 2, 110, 0); ExpectCollision (30, 0, 0); // backoff: 0 slots EndTest (); // The test below is subject to some discussion because I am // not sure I understand the intent of the spec here. // i.e., what happens if you make a request to get access // to the medium during the difs idle time after a busy period ? // do you need to start a backoff ? Or do you need to wait until // the end of difs and access the medium ? // Here, we wait until the end of difs and access the medium. // // 20 60 66 70 72 // | rx | sifs | aifsn | tx | // | // 62 request access. // StartTest (4, 6, 10); AddDcfState (1); AddRxOkEvt (20, 40); AddAccessRequest (62, 2, 70, 0); EndTest (); // Test an EIFS // // 20 60 66 76 86 90 94 98 102 106 // | rx | sifs | acktxttime | sifs + aifsn | bslot0 | bslot1 | bslot2 | bslot3 | tx | // | | <------eifs------>| // 30 request access. backoff slots: 4 StartTest (4, 6, 10); AddDcfState (1); AddRxErrorEvt (20, 40); AddAccessRequest (30, 2, 102, 0); ExpectCollision (30, 4, 0); // backoff: 4 slots EndTest (); // Test an EIFS which is interupted by a successfull transmission. // // 20 60 66 69 75 81 85 89 93 97 101 103 // | rx | sifs | | rx | sifs | aifsn | bslot0 | bslot1 | bslot2 | bslot3 | tx | // | | <--eifs-->| // 30 request access. backoff slots: 4 StartTest (4, 6, 10); AddDcfState (1); AddRxErrorEvt (20, 40); AddAccessRequest (30, 2, 101, 0); ExpectCollision (30, 4, 0); // backoff: 4 slots AddRxOkEvt (69, 6); EndTest (); // Test two DCFs which suffer an internal collision. the first DCF has a higher // priority than the second DCF. // // 20 60 66 70 74 78 88 // DCF0 | rx | sifs | aifsn | bslot0 | bslot1 | tx | // DCF1 | rx | sifs | aifsn | aifsn | aifsn | | sifs | aifsn | aifsn | aifsn | bslot | tx | // 94 98 102 106 110 112 StartTest (4, 6, 10); AddDcfState (1); // high priority DCF AddDcfState (3); // low priority DCF AddRxOkEvt (20, 40); AddAccessRequest (30, 10, 78, 0); ExpectCollision (30, 2, 0); // backoff: 2 slot AddAccessRequest (40, 2, 110, 1); ExpectCollision (40, 0, 1); // backoff: 0 slot ExpectInternalCollision (78, 1, 1); // backoff: 1 slot EndTest (); // Test of AckTimeout handling: First queue requests access and ack procedure fails, // inside the ack timeout second queue with higher priority requests access. // // 20 40 50 60 66 76 // DCF0 - low | tx | ack timeout |sifs| | // DCF1 - high | | |sifs| tx | // ^ request access StartTest (4, 6, 10); AddDcfState (2); // high priority DCF AddDcfState (0); // low priority DCF AddAccessRequestWithAckTimeout (20, 20, 20, 0); AddAccessRequest (50, 10, 66, 1); EndTest (); // Test of AckTimeout handling: // // First queue requests access and ack is 2 us delayed (got ack interval at the picture), // inside this interval second queue with higher priority requests access. // // 20 40 41 42 48 58 // DCF0 - low | tx |got ack |sifs| | // DCF1 - high | | |sifs| tx | // ^ request access StartTest (4, 6, 10); AddDcfState (2); // high priority DCF AddDcfState (0); // low priority DCF AddAccessRequestWithSuccessfullAck (20, 20, 20, 2, 0); AddAccessRequest (41, 10, 48, 1); EndTest (); //Repeat the same but with one queue: // 20 40 41 42 48 58 // DCF0 - low | tx |got ack |sifs| | // ^ request access StartTest (4, 6, 10); AddDcfState (2); AddAccessRequestWithSuccessfullAck (20, 20, 20, 2, 0); AddAccessRequest (41, 10, 56, 0); EndTest (); //Repeat the same when ack was delayed: //and request the next access before previous tx end: // 20 39 40 42 64 74 // DCF0 - low | tx |got ack |sifs + 4 * slot| | // ^ request access StartTest (4, 6, 10); AddDcfState (2); AddAccessRequestWithSuccessfullAck (20, 20, 20, 2, 0); AddAccessRequest (39, 10, 64, 0); ExpectCollision (39, 2, 0); // backoff: 2 slot EndTest (); // // test simple NAV count. This scenario modelizes a simple DATA+ACK handshake // where the data rate used for the ACK is higher than expected by the DATA source // so, the data exchange completes before the end of nav. // StartTest (4, 6, 10); AddDcfState (1); AddRxOkEvt (20, 40); AddNavStart (60, 15); AddRxOkEvt (66, 5); AddNavStart (71, 0); AddAccessRequest (30, 10, 93, 0); ExpectCollision (30, 2, 0); // backoff: 2 slot EndTest (); // // test more complex NAV handling by a CF-poll. This scenario modelizes a // simple DATA+ACK handshake interrupted by a CF-poll which resets the // NAV counter. // StartTest (4, 6, 10); AddDcfState (1); AddRxOkEvt (20, 40); AddNavStart (60, 15); AddRxOkEvt (66, 5); AddNavReset (71, 2); AddAccessRequest (30, 10, 91, 0); ExpectCollision (30, 2, 0); // backoff: 2 slot EndTest (); StartTest (4, 6, 10); AddDcfState (2); AddRxOkEvt (20, 40); AddAccessRequest (80, 10, 80, 0); EndTest (); StartTest (4, 6, 10); AddDcfState (2); AddRxOkEvt (20, 40); AddRxOkEvt (78, 8); AddAccessRequest (30, 50, 108, 0); ExpectCollision (30, 3, 0); // backoff: 3 slots EndTest (); // Channel switching tests // 0 20 23 24 25 // | switching | sifs | aifsn | tx | // | // 21 access request. StartTest (1, 3, 10); AddDcfState (1); AddSwitchingEvt (0,20); AddAccessRequest (21, 1, 24, 0); EndTest (); // 20 40 50 53 54 55 // | switching | busy | sifs | aifsn | tx | // | | // 30 busy. 45 access request. // StartTest (1, 3, 10); AddDcfState (1); AddSwitchingEvt (20,20); AddCcaBusyEvt (30,20); AddAccessRequest (45, 1, 54, 0); EndTest (); // 20 30 50 53 54 55 // | rx | switching | sifs | aifsn | tx | // | // 51 access request. // StartTest (1, 3, 10); AddDcfState (1); AddRxStartEvt (20,40); AddSwitchingEvt (30,20); AddAccessRequest (51, 1, 54, 0); EndTest (); // 20 30 50 53 54 55 // | busy | switching | sifs | aifsn | tx | // | // 51 access request. // StartTest (1, 3, 10); AddDcfState (1); AddCcaBusyEvt (20,40); AddSwitchingEvt (30,20); AddAccessRequest (51, 1, 54, 0); EndTest (); // 20 30 50 53 54 55 // | nav | switching | sifs | aifsn | tx | // | // 51 access request. // StartTest (1, 3, 10); AddDcfState (1); AddNavStart (20,40); AddSwitchingEvt (30,20); AddAccessRequest (51, 1, 54, 0); EndTest (); // 20 40 50 55 58 59 60 // | tx | ack timeout | switching | sifs | aifsn | tx | // | | // 45 access request. 56 access request. // StartTest (1, 3, 10); AddDcfState (1); AddAccessRequestWithAckTimeout (20, 20, 20, 0); AddAccessRequest (45, 1, 50, 0); AddSwitchingEvt (50,5); AddAccessRequest (56, 1, 59, 0); EndTest (); // 20 60 66 70 74 78 80 100 106 110 112 // | rx | sifs | aifsn | bslot0 | bslot1 | | switching | sifs | aifsn | tx | // | | // 30 access request. 101 access request. // StartTest (4, 6, 10); AddDcfState (1); AddRxOkEvt (20,40); AddAccessRequest (30, 2, 80, 0); ExpectCollision (30, 4, 0); // backoff: 4 slots AddSwitchingEvt (80,20); AddAccessRequest (101, 2, 110, 0); EndTest (); }
void TestContext::Skip(std::string message) { EndTest(TestFinishState::SKIPPED, message); // TODO: Throw "test skipped" exception }
void TestContext::Pass(std::string message) { EndTest(TestFinishState::PASSED, message); }