这篇教程C++ test_set_step函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中test_set_step函数的典型用法代码示例。如果您正苦于以下问题:C++ test_set_step函数的具体用法?C++ test_set_step怎么用?C++ test_set_step使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了test_set_step函数的30个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: rt_test_005_005_executestatic void rt_test_005_005_execute(void) { /* [5.5.1] An higher priority thread is created that performs non-atomical wait and signal operations on a semaphore.*/ test_set_step(1); { threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+1, thread3, 0); } /* [5.5.2] The function chSemSignalWait() is invoked by specifying the same semaphore for the wait and signal phases. The counter value must be one on exit.*/ test_set_step(2); { chSemSignalWait(&sem1, &sem1); test_assert(queue_isempty(&sem1.queue), "queue not empty"); test_assert(sem1.cnt == 0, "counter not zero"); } /* [5.5.3] The function chSemSignalWait() is invoked again by specifying the same semaphore for the wait and signal phases. The counter value must be one on exit.*/ test_set_step(3); { chSemSignalWait(&sem1, &sem1); test_assert(queue_isempty(&sem1.queue), "queue not empty"); test_assert(sem1.cnt == 0, "counter not zero"); }}
开发者ID:mabl,项目名称:ChibiOS,代码行数:29,
示例2: nil_test_004_001_executestatic void nil_test_004_001_execute(void) { systime_t time; msg_t msg; /* [4.1.1] The function chThdSuspendTimeoutS() is invoked, the thread is remotely resumed with message @p MSG_OK. On return the message and the state of the reference are tested.*/ test_set_step(1); { chSysLock(); msg = chThdSuspendTimeoutS(>r1, TIME_INFINITE); chSysUnlock(); test_assert(NULL == gtr1, "not NULL"); test_assert(MSG_OK == msg,"wrong returned message"); } /* [4.1.2] The function chThdSuspendTimeoutS() is invoked, the thread is not resumed so a timeout must occur. On return the message and the state of the reference are tested.*/ test_set_step(2); { chSysLock(); time = chVTGetSystemTimeX(); msg = chThdSuspendTimeoutS(&tr1, TIME_MS2I(1000)); chSysUnlock(); test_assert_time_window(chTimeAddX(time, TIME_MS2I(1000)), chTimeAddX(time, TIME_MS2I(1000) + 1), "out of time window"); test_assert(NULL == tr1, "not NULL"); test_assert(MSG_TIMEOUT == msg, "wrong returned message"); }}
开发者ID:mabl,项目名称:ChibiOS,代码行数:32,
示例3: test_002_002_executestatic void test_002_002_execute(void) { /* The function chSemWait() is invoked, after return the counter and the returned message are tested. The semaphore is signaled by another thread.*/ test_set_step(1); { msg_t msg; msg = chSemWait(&gsem1); test_assert_lock(chSemGetCounterI(&gsem1) == 0, "wrong counter value"); test_assert(MSG_OK == msg, "wrong returned message"); } /* The function chSemWait() is invoked, after return the counter and the returned message are tested. The semaphore is reset by another thread.*/ test_set_step(2); { msg_t msg; msg = chSemWait(&gsem2); test_assert_lock(chSemGetCounterI(&gsem2) == 0, "wrong counter value"); test_assert(MSG_RESET == msg, "wrong returned message"); }}
开发者ID:MultiCalorNV,项目名称:verventa-web_Int,代码行数:30,
示例4: test_005_003_executestatic void test_005_003_execute(void) { systime_t time; /* [5.3.1] Getting the system time for test duration measurement.*/ test_set_step(1); { time = test_wait_tick(); } /* [5.3.2] The five contenders threads are created and let run atomically, the goals sequence is tested, the threads must complete in priority order.*/ test_set_step(2); { threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-5, thread3LL, 0); threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-4, thread3L, 0); threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread3M, 0); threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-2, thread3H, 0); threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread3HH, 0); test_wait_threads(); test_assert_sequence("ABCDE", "invalid sequence"); } /* [5.3.3] Testing that all threads completed within the specified time windows (110mS...110mS+ALLOWED_DELAY).*/ test_set_step(3); { test_assert_time_window(time + MS2ST(110), time + MS2ST(110) + ALLOWED_DELAY, "out of time window"); }}
开发者ID:AlexShiLucky,项目名称:ChibiOS,代码行数:31,
示例5: test_005_007_executestatic void test_005_007_execute(void) { /* [5.7.1] Starting the five threads with increasing priority, the threads will queue on the condition variable.*/ test_set_step(1); { tprio_t prio = chThdGetPriorityX(); threads[0] = chThdCreateStatic(wa[0], WA_SIZE, prio+1, thread6, "E"); threads[1] = chThdCreateStatic(wa[1], WA_SIZE, prio+2, thread6, "D"); threads[2] = chThdCreateStatic(wa[2], WA_SIZE, prio+3, thread6, "C"); threads[3] = chThdCreateStatic(wa[3], WA_SIZE, prio+4, thread6, "B"); threads[4] = chThdCreateStatic(wa[4], WA_SIZE, prio+5, thread6, "A"); } /* [5.7.2] Atomically signaling the condition variable five times then waiting for the threads to terminate in priority order, the order is tested.*/ test_set_step(2); { chSysLock(); chCondSignalI(&c1); chCondSignalI(&c1); chCondSignalI(&c1); chCondSignalI(&c1); chCondSignalI(&c1); chSchRescheduleS(); chSysUnlock(); test_wait_threads(); test_assert_sequence("ABCDE", "invalid sequence"); }}
开发者ID:AlexShiLucky,项目名称:ChibiOS,代码行数:31,
示例6: test_002_003_executestatic void test_002_003_execute(void) { systime_t time; msg_t msg; /* The function chSemWaitTimeout() is invoked, after return the system time, the counter and the returned message are tested.*/ test_set_step(1); { time = chVTGetSystemTimeX(); msg = chSemWaitTimeout(&sem1, MS2ST(1000)); test_assert_time_window(time + MS2ST(1000), time + MS2ST(1000) + 1, "out of time window"); test_assert_lock(chSemGetCounterI(&sem1) == 0, "wrong counter value"); test_assert(MSG_TIMEOUT == msg, "wrong timeout message"); } /* The function chSemWaitTimeout() is invoked, after return the system time, the counter and the returned message are tested.*/ test_set_step(2); { time = chVTGetSystemTimeX(); msg = chSemWaitTimeout(&sem1, MS2ST(1000)); test_assert_time_window(time + MS2ST(1000), time + MS2ST(1000) + 1, "out of time window"); test_assert_lock(chSemGetCounterI(&sem1) == 0, "wrong counter value"); test_assert(MSG_TIMEOUT == msg, "wrong timeout message"); }}
开发者ID:MultiCalorNV,项目名称:verventa-web_Int,代码行数:34,
示例7: nasa_osal_test_002_002_executestatic void nasa_osal_test_002_002_execute(void) { /* [2.2.1] OS_QueueGetIdByName() is invoked with queue_id set to NULL, an error is expected.*/ test_set_step(1); { int32 err; err = OS_QueueGetIdByName(NULL, "queue"); test_assert(err == OS_INVALID_POINTER, "NULL not detected"); } /* [2.2.2] OS_QueueGetIdByName() is invoked with queue_name set to NULL, an error is expected.*/ test_set_step(2); { int32 err; err = OS_QueueGetIdByName(&qid, NULL); test_assert(err == OS_INVALID_POINTER, "NULL not detected"); } /* [2.2.3] OS_QueueGetIdByName() is invoked with a very long task name, an error is expected.*/ test_set_step(3); { int32 err; err = OS_QueueGetIdByName(&qid, "very very long queue name"); test_assert(err == OS_ERR_NAME_TOO_LONG, "name limit not detected"); }}
开发者ID:mabl,项目名称:ChibiOS,代码行数:32,
示例8: test_001_004_executestatic void test_001_004_execute(void) { uint32 tid; /* [1.4.1] Creating a task executing an infinite loop.*/ test_set_step(1); { int32 err; err = OS_TaskCreate(&tid, "deletable task", test_task_delete, (uint32 *)wa_test1, sizeof wa_test1, TASKS_BASE_PRIORITY, 0); test_assert(err == OS_SUCCESS, "deletable task creation failed"); } /* [1.4.2] Letting the task run for a while then deleting it. A check is performed on the correct execution of the delete handler.*/ test_set_step(2); { int32 err; (void) OS_TaskDelay(50); err = OS_TaskDelete(tid); test_assert(err == OS_SUCCESS, "delete failed"); test_assert_sequence("ABC", "events order violation"); }}
开发者ID:KTannenberg,项目名称:ChibiOS,代码行数:30,
示例9: test_002_004_executestatic void test_002_004_execute(void) { systime_t time; msg_t msg; /* The function chThdSuspendTimeoutS() is invoked, the thread is remotely resumed with message @p MSG_OK. On return the message and the state of the reference are tested.*/ test_set_step(1); { msg = chThdSuspendTimeoutS(>r1, TIME_INFINITE); test_assert(NULL == gtr1, "not NULL"); test_assert(MSG_OK == msg, "wrong returned message"); } /* The function chThdSuspendTimeoutS() is invoked, the thread is not resumed so a timeout must occur. On return the message and the state of the reference are tested.*/ test_set_step(2); { time = chVTGetSystemTimeX(); msg = chThdSuspendTimeoutS(&tr1, MS2ST(1000)); test_assert_time_window(time + MS2ST(1000), time + MS2ST(1000) + 1, "out of time window"); test_assert(NULL == tr1, "not NULL"); test_assert(MSG_TIMEOUT == msg, "wrong returned message"); }}
开发者ID:MultiCalorNV,项目名称:verventa-web_Int,代码行数:32,
示例10: test_006_001_executestatic void test_006_001_execute(void) { thread_t *tp; msg_t msg; /* [6.1.1] Starting the messenger thread.*/ test_set_step(1); { threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() + 1, msg_thread1, chThdGetSelfX()); } /* [6.1.2] Waiting for four messages then testing the receive order.*/ test_set_step(2); { unsigned i; for (i = 0; i < 4; i++) { tp = chMsgWait(); msg = chMsgGet(tp); chMsgRelease(tp, msg); test_emit_token(msg); } test_wait_threads(); test_assert_sequence("ABCD", "invalid sequence"); }}
开发者ID:KTannenberg,项目名称:ChibiOS,代码行数:27,
示例11: rt_test_005_001_executestatic void rt_test_005_001_execute(void) { /* [5.1.1] The function chSemWait() is invoked, after return the counter and the returned message are tested.*/ test_set_step(1); { msg_t msg; msg = chSemWait(&sem1); test_assert_lock(chSemGetCounterI(&sem1) == 0, "wrong counter value"); test_assert(MSG_OK == msg, "wrong returned message"); } /* [5.1.2] The function chSemSignal() is invoked, after return the counter is tested.*/ test_set_step(2); { chSemSignal(&sem1); test_assert_lock(chSemGetCounterI(&sem1) == 1, "wrong counter value"); } /* [5.1.3] The function chSemReset() is invoked, after return the counter is tested.*/ test_set_step(3); { chSemReset(&sem1, 2); test_assert_lock(chSemGetCounterI(&sem1) == 2, "wrong counter value"); }}
开发者ID:mabl,项目名称:ChibiOS,代码行数:29,
示例12: rt_test_005_002_executestatic void rt_test_005_002_execute(void) { /* [5.2.1] Five threads are created with mixed priority levels (not increasing nor decreasing). Threads enqueue on a semaphore initialized to zero.*/ test_set_step(1); { threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+5, thread1, "A"); threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()+1, thread1, "B"); threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()+3, thread1, "C"); threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()+4, thread1, "D"); threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()+2, thread1, "E"); } /* [5.2.2] The semaphore is signaled 5 times. The thread activation sequence is tested.*/ test_set_step(2); { chSemSignal(&sem1); chSemSignal(&sem1); chSemSignal(&sem1); chSemSignal(&sem1); chSemSignal(&sem1); test_wait_threads();#if CH_CFG_USE_SEMAPHORES_PRIORITY test_assert_sequence("ADCEB", "invalid sequence");#else test_assert_sequence("ABCDE", "invalid sequence");#endif }}
开发者ID:mabl,项目名称:ChibiOS,代码行数:31,
示例13: test_003_001_executestatic void test_003_001_execute(void) { systime_t time; msg_t msg; /* [3.1.1] The function chThdSuspendTimeoutS() is invoked, the thread is remotely resumed with message @p MSG_OK. On return the message and the state of the reference are tested.*/ test_set_step(1); { threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-1, thread1, "A"); chSysLock(); msg = chThdSuspendTimeoutS(&tr1, TIME_INFINITE); chSysUnlock(); test_assert(NULL == tr1, "not NULL"); test_assert(MSG_OK == msg,"wrong returned message"); test_wait_threads(); } /* [3.1.2] The function chThdSuspendTimeoutS() is invoked, the thread is not resumed so a timeout must occur. On return the message and the state of the reference are tested.*/ test_set_step(2); { chSysLock(); time = chVTGetSystemTimeX(); msg = chThdSuspendTimeoutS(&tr1, MS2ST(1000)); chSysUnlock(); test_assert_time_window(time + MS2ST(1000), time + MS2ST(1000) + CH_CFG_ST_TIMEDELTA + 1, "out of time window"); test_assert(NULL == tr1, "not NULL"); test_assert(MSG_TIMEOUT == msg, "wrong returned message"); }}
开发者ID:KTannenberg,项目名称:ChibiOS,代码行数:34,
示例14: test_003_004_executestatic void test_003_004_execute(void) { uint32 local_tmid; /* [3.4.1] Retrieving the timer by name.*/ test_set_step(1); { int32 err; err = OS_TimerGetIdByName(&local_tmid, "test timer"); test_assert(err == OS_SUCCESS, "timer not found"); } /* [3.4.2] Setting up the timer for a 70mS one-shot tick.*/ test_set_step(2); { uint32 err; err = OS_TimerSet(local_tmid, 70000, 0); test_assert(err == OS_SUCCESS, "timer setup failed"); } /* [3.4.3] Waiting one second then counting the occurred ticks.*/ test_set_step(3); { (void) OS_TaskDelay(1000); test_assert(cnt == 1, "wrong ticks"); }}
开发者ID:awygle,项目名称:ChibiOS,代码行数:28,
示例15: test_003_003_executestatic void test_003_003_execute(void) { /* [3.3.1] OS_TimerGetIdByName() is invoked with timer_id set to NULL, an error is expected.*/ test_set_step(1); { int32 err; err = OS_TimerGetIdByName(NULL, "timer"); test_assert(err == OS_INVALID_POINTER, "NULL not detected"); } /* [3.3.2] OS_TimerGetIdByName() is invoked with timer name set to NULL, an error is expected.*/ test_set_step(2); { int32 err; err = OS_TimerGetIdByName(&tmid, NULL); test_assert(err == OS_INVALID_POINTER, "NULL not detected"); } /* [3.3.3] OS_TimerGetIdByName() is invoked with a very long task name, an error is expected.*/ test_set_step(3); { int32 err; err = OS_TimerGetIdByName(&tmid, "very very long timer name"); test_assert(err == OS_ERR_NAME_TOO_LONG, "name limit not detected"); }}
开发者ID:awygle,项目名称:ChibiOS,代码行数:32,
示例16: test_004_006_executestatic void test_004_006_execute(void) { /* [4.6.1] OS_BinSemGetIdByName() is invoked with sem_id set to NULL, an error is expected.*/ test_set_step(1); { int32 err; err = OS_BinSemGetIdByName(NULL, "semaphore"); test_assert(err == OS_INVALID_POINTER, "NULL not detected"); } /* [4.6.2] OS_BinSemGetIdByName() is invoked with semaphore name set to NULL, an error is expected.*/ test_set_step(2); { int32 err; err = OS_BinSemGetIdByName(&bsid, NULL); test_assert(err == OS_INVALID_POINTER, "NULL not detected"); } /* [4.6.3] OS_BinSemGetIdByName() is invoked with a very long task name, an error is expected.*/ test_set_step(3); { int32 err; err = OS_BinSemGetIdByName(&bsid, "very very long semaphore name"); test_assert(err == OS_ERR_NAME_TOO_LONG, "name limit not detected"); }}
开发者ID:KTannenberg,项目名称:ChibiOS,代码行数:32,
示例17: nasa_osal_test_002_004_executestatic void nasa_osal_test_002_004_execute(void) { uint32 local_qid; uint32 copied; char data[MESSAGE_SIZE]; /* [2.4.1] Retrieving the queue by name.*/ test_set_step(1); { int32 err; err = OS_QueueGetIdByName(&local_qid, "test queue"); test_assert(err == OS_SUCCESS, "queue not found"); } /* [2.4.2] Get operation with a one second timeout, an error is expected.*/ test_set_step(2); { int32 err; err = OS_QueueGet(qid, data, MESSAGE_SIZE, &copied, OS_Milli2Ticks(1000)); test_assert(err == OS_QUEUE_TIMEOUT, "unexpected error code"); } /* [2.4.3] Get operation in non-blocking mode, an error is expected.*/ test_set_step(3); { int32 err; err = OS_QueueGet(qid, data, MESSAGE_SIZE, &copied, OS_CHECK); test_assert(err == OS_QUEUE_EMPTY, "unexpected error code"); }}
开发者ID:mabl,项目名称:ChibiOS,代码行数:34,
示例18: test_001_002_executestatic void test_001_002_execute(void) { systime_t time; /* The current system time is read then a sleep is performed for 100 system ticks and on exit the system time is verified again.*/ test_set_step(1); { time = chVTGetSystemTimeX(); chThdSleep(100); test_assert_time_window(time + 100, time + 100 + 1, "out of time window"); } /* The current system time is read then a sleep is performed for 100000 microseconds and on exit the system time is verified again.*/ test_set_step(2); { time = chVTGetSystemTimeX(); chThdSleepMicroseconds(100); test_assert_time_window(time + US2ST(100), time + US2ST(100) + 1, "out of time window"); } /* The current system time is read then a sleep is performed for 100 milliseconds and on exit the system time is verified again.*/ test_set_step(3); { time = chVTGetSystemTimeX(); chThdSleepMilliseconds(100); test_assert_time_window(time + MS2ST(100), time + MS2ST(100) + 1, "out of time window"); } /* The current system time is read then a sleep is performed for 1 second and on exit the system time is verified again.*/ test_set_step(4); { time = chVTGetSystemTimeX(); chThdSleepSeconds(1); test_assert_time_window(time + S2ST(1), time + S2ST(1) + 1, "out of time window"); } test_set_step(5); { time = chVTGetSystemTimeX(); chThdSleepUntil(time + 100); test_assert_time_window(time + 100, time + 100 + 1, "out of time window"); }}
开发者ID:MultiCalorNV,项目名称:verventa-web_Int,代码行数:56,
示例19: nasa_osal_test_002_003_executestatic void nasa_osal_test_002_003_execute(void) { uint32 tid; unsigned i; /* [2.3.1] Creataing a queue with depth 4 and message size 20.*/ test_set_step(1); { int32 err; err = OS_QueueCreate(&qid, "test queue", 4, MESSAGE_SIZE, 0); test_assert(err == OS_SUCCESS, "queue creation failed"); } /* [2.3.2] Creating the writer task.*/ test_set_step(2); { int32 err; err = OS_TaskCreate(&tid, "writer task", test_task_writer, (uint32 *)wa_test1, sizeof wa_test1, TASKS_BASE_PRIORITY, 0); test_assert(err == OS_SUCCESS, "writer task creation failed"); } /* [2.3.3] Reading messages from the writer task.*/ test_set_step(3); { for (i = 0; i < WRITER_NUM_MESSAGES; i++) { int32 err; char data[MESSAGE_SIZE]; uint32 copied; err = OS_QueueGet(qid, data, MESSAGE_SIZE, &copied, OS_Milli2Ticks(200)); test_assert(err == OS_SUCCESS, "timed out"); test_assert(strncmp(data, "Hello World", sizeof (data)) == 0, "wrong message"); } } /* [2.3.4] Waiting for task termination then checking for errors.*/ test_set_step(4); { (void) OS_TaskWait(tid); tid = 0; test_assert_sequence("", "queue write errors occurred"); }}
开发者ID:mabl,项目名称:ChibiOS,代码行数:51,
示例20: test_009_003_executestatic void test_009_003_execute(void) { msg_t msg1, msg2; unsigned i; /* [9.3.1] Filling the mailbox.*/ test_set_step(1); { for (i = 0; i < MB_SIZE; i++) { msg1 = chMBPost(&mb1, 'B' + i, TIME_INFINITE); test_assert(msg1 == MSG_OK, "wrong wake-up message"); } } /* [9.3.2] Testing chMBPost(), chMBPostI(), chMBPostAhead() and chMBPostAheadI() timeout.*/ test_set_step(2); { msg1 = chMBPost(&mb1, 'X', 1); test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message"); chSysLock(); msg1 = chMBPostI(&mb1, 'X'); chSysUnlock(); test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message"); msg1 = chMBPostAhead(&mb1, 'X', 1); test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message"); chSysLock(); msg1 = chMBPostAheadI(&mb1, 'X'); chSysUnlock(); test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message"); } /* [9.3.3] Resetting the mailbox. The mailbox is then returned in active state.*/ test_set_step(3); { chMBReset(&mb1); chMBResumeX(&mb1); } /* [9.3.4] Testing chMBFetch() and chMBFetchI() timeout.*/ test_set_step(4); { msg1 = chMBFetch(&mb1, &msg2, 1); test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message"); chSysLock(); msg1 = chMBFetchI(&mb1, &msg2); chSysUnlock(); test_assert(msg1 == MSG_TIMEOUT, "wrong wake-up message"); }}
开发者ID:oh3eqn,项目名称:ChibiOS,代码行数:50,
示例21: test_002_005_executestatic void test_002_005_execute(void) { systime_t time; eventmask_t events; /* A set of event flags are set on the current thread then the function chVTGetSystemTimeX() is invoked, the function is supposed to return immediately because the event flags are already pending, after return the events mask is tested.*/ test_set_step(1); { time = chVTGetSystemTimeX(); chEvtSignalI(chThdGetSelfX(), 0x55); events = chEvtWaitAnyTimeout(ALL_EVENTS, MS2ST(1000)); test_assert((eventmask_t)0 != events, "timed out"); test_assert((eventmask_t)0x55 == events, "wrong events mask"); } /* The pending event flags mask is cleared then the function chVTGetSystemTimeX() is invoked, after return the events mask is tested. The thread is signaled by another thread.*/ test_set_step(2); { time = chVTGetSystemTimeX(); chThdGetSelfX()->epmask = 0; events = chEvtWaitAnyTimeout(ALL_EVENTS, MS2ST(1000)); test_assert((eventmask_t)0 != events, "timed out"); test_assert((eventmask_t)0x55 == events, "wrong events mask"); } /* The function chVTGetSystemTimeX() is invoked, no event can wakeup the thread, the function must return because timeout.*/ test_set_step(3); { chSysLock(); time = chVTGetSystemTimeX(); events = chEvtWaitAnyTimeoutS(0, MS2ST(1000)); chSysUnlock(); test_assert_time_window(time + MS2ST(1000), time + MS2ST(1000) + 1, "out of time window"); test_assert((eventmask_t)0 == events, "wrong events mask"); }}
开发者ID:MultiCalorNV,项目名称:verventa-web_Int,代码行数:48,
示例22: test_XXX_001_executestatic void test_XXX_001_execute(void) { /* Step description.*/ test_set_step(1); { }}
开发者ID:MultiCalorNV,项目名称:verventa-web_Int,代码行数:7,
示例23: test_005_005_executestatic void test_005_005_execute(void) { bool b; tprio_t prio; /* [5.5.1] Getting current thread priority for later checks.*/ test_set_step(1); { prio = chThdGetPriorityX(); } /* [5.5.2] Locking the mutex first time, it must be possible because it is not owned.*/ test_set_step(2); { b = chMtxTryLock(&m1); test_assert(b, "already locked"); } /* [5.5.3] Locking the mutex second time, it must fail because it is already owned.*/ test_set_step(3); { b = chMtxTryLock(&m1); test_assert(!b, "not locked"); } /* [5.5.4] Unlocking the mutex then it must not be owned anymore and the queue must be empty.*/ test_set_step(4); { chMtxUnlock(&m1); test_assert(m1.owner == NULL, "still owned"); test_assert(queue_isempty(&m1.queue), "queue not empty"); } /* [5.5.5] Testing that priority has not changed after operations.*/ test_set_step(5); { test_assert(chThdGetPriorityX() == prio, "wrong priority level"); } /* [5.5.6] Testing chMtxUnlockAll() behavior.*/ test_set_step(6); { b = chMtxTryLock(&m1); test_assert(b, "already locked"); b = chMtxTryLock(&m1); test_assert(!b, "not locked"); chMtxUnlockAll(); test_assert(m1.owner == NULL, "still owned"); test_assert(queue_isempty(&m1.queue), "queue not empty"); } /* [5.5.7] Testing that priority has not changed after operations.*/ test_set_step(7); { test_assert(chThdGetPriorityX() == prio, "wrong priority level"); }}
开发者ID:AlexShiLucky,项目名称:ChibiOS,代码行数:60,
示例24: test_005_003_executestatic void test_005_003_execute(void) { /* [5.3.1] Trying to allocate with 100mS timeout, must fail because the pool is empty.*/ test_set_step(1); { test_assert(chGuardedPoolAllocTimeout(&gmp1, MS2ST(100)) == NULL, "list not empty"); }}
开发者ID:Babody,项目名称:ChibiOS,代码行数:9,
示例25: rt_test_005_003_executestatic void rt_test_005_003_execute(void) { unsigned i; systime_t target_time; msg_t msg; /* [5.3.1] Testing special case TIME_IMMEDIATE.*/ test_set_step(1); { msg = chSemWaitTimeout(&sem1, TIME_IMMEDIATE); test_assert(msg == MSG_TIMEOUT, "wrong wake-up message"); test_assert(queue_isempty(&sem1.queue), "queue not empty"); test_assert(sem1.cnt == 0, "counter not zero"); } /* [5.3.2] Testing non-timeout condition.*/ test_set_step(2); { threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX() - 1, thread2, 0); msg = chSemWaitTimeout(&sem1, TIME_MS2I(500)); test_wait_threads(); test_assert(msg == MSG_OK, "wrong wake-up message"); test_assert(queue_isempty(&sem1.queue), "queue not empty"); test_assert(sem1.cnt == 0, "counter not zero"); } /* [5.3.3] Testing timeout condition.*/ test_set_step(3); { target_time = chTimeAddX(test_wait_tick(), TIME_MS2I(5 * 50)); for (i = 0; i < 5; i++) { test_emit_token('A' + i); msg = chSemWaitTimeout(&sem1, TIME_MS2I(50)); test_assert(msg == MSG_TIMEOUT, "wrong wake-up message"); test_assert(queue_isempty(&sem1.queue), "queue not empty"); test_assert(sem1.cnt == 0, "counter not zero"); } test_assert_sequence("ABCDE", "invalid sequence"); test_assert_time_window(target_time, chTimeAddX(target_time, ALLOWED_DELAY), "out of time window"); }}
开发者ID:mabl,项目名称:ChibiOS,代码行数:43,
示例26: test_002_002_executestatic void test_002_002_execute(void) { /* [2.2.1] Creating 5 threads with increasing priority, execution sequence is tested.*/ test_set_step(1); { threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-5, thread, "E"); threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-4, thread, "D"); threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread, "C"); threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-2, thread, "B"); threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread, "A"); test_wait_threads(); test_assert_sequence("ABCDE", "invalid sequence"); } /* [2.2.2] Creating 5 threads with decreasing priority, execution sequence is tested.*/ test_set_step(2); { threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread, "A"); threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-2, thread, "B"); threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread, "C"); threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-4, thread, "D"); threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-5, thread, "E"); test_wait_threads(); test_assert_sequence("ABCDE", "invalid sequence"); } /* [2.2.3] Creating 5 threads with pseudo-random priority, execution sequence is tested.*/ test_set_step(3); { threads[1] = chThdCreateStatic(wa[1], WA_SIZE, chThdGetPriorityX()-4, thread, "D"); threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()-5, thread, "E"); threads[4] = chThdCreateStatic(wa[4], WA_SIZE, chThdGetPriorityX()-1, thread, "A"); threads[3] = chThdCreateStatic(wa[3], WA_SIZE, chThdGetPriorityX()-2, thread, "B"); threads[2] = chThdCreateStatic(wa[2], WA_SIZE, chThdGetPriorityX()-3, thread, "C"); test_wait_threads(); test_assert_sequence("ABCDE", "invalid sequence"); }}
开发者ID:KTannenberg,项目名称:ChibiOS,代码行数:41,
示例27: rt_test_005_004_executestatic void rt_test_005_004_execute(void) { /* [5.4.1] A thread is created, it goes to wait on the semaphore.*/ test_set_step(1); { threads[0] = chThdCreateStatic(wa[0], WA_SIZE, chThdGetPriorityX()+1, thread1, "A"); } /* [5.4.2] The semaphore counter is increased by two, it is then tested to be one, the thread must have completed.*/ test_set_step(2); { chSysLock(); chSemAddCounterI(&sem1, 2); chSchRescheduleS(); chSysUnlock(); test_wait_threads(); test_assert_lock(chSemGetCounterI(&sem1) == 1, "invalid counter"); test_assert_sequence("A", "invalid sequence"); }}
开发者ID:mabl,项目名称:ChibiOS,代码行数:21,
示例28: test_006_002_executestatic void test_006_002_execute(void) { /* OS_MutSemGive() is invoked with sem_id set to -1, an error is expected.*/ test_set_step(1); { int32 err; err = OS_MutSemGive((uint32)-1); test_assert(err == OS_ERR_INVALID_ID, "invalid sem_id not detected"); }}
开发者ID:krtkr,项目名称:ChibiOS,代码行数:12,
示例29: test_004_007_executestatic void test_004_007_execute(void) { /* [4.7.1] OS_BinSemTimedWait() is invoked with timeout set to one second, an error is expected.*/ test_set_step(1); { int32 err; err = OS_BinSemTimedWait(bsid, 1000); test_assert(err == OS_SEM_TIMEOUT, "unexpected error code"); }}
开发者ID:KTannenberg,项目名称:ChibiOS,代码行数:12,
示例30: test_004_004_executestatic void test_004_004_execute(void) { /* [4.4.1] OS_BinSemTake() is invoked with sem_id set to -1, an error is expected.*/ test_set_step(1); { int32 err; err = OS_BinSemTake((uint32)-1); test_assert(err == OS_ERR_INVALID_ID, "invalid sem_id not detected"); }}
开发者ID:KTannenberg,项目名称:ChibiOS,代码行数:12,
注:本文中的test_set_step函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ test_setup函数代码示例 C++ test_run函数代码示例 |