예제 #1
0
  void test_find_and_activate_none_is_false() {
    Thread* cur = Thread::current(state);

    bool ret = state->find_and_activate_thread();

    TS_ASSERT_EQUALS(false, ret);
    TS_ASSERT_EQUALS(cur, Thread::current(state));
    TS_ASSERT_EQUALS(Qfalse, cur->queued());
  }
예제 #2
0
  void test_find_and_activate() {
    Thread* cur = Thread::current(state);
    Thread* thread = Thread::create(state);

    thread->wakeup(state);
    state->queue_thread(thread);

    bool ret = state->find_and_activate_thread();
    TS_ASSERT_EQUALS(true, ret);

    TS_ASSERT_EQUALS(Qfalse, thread->queued());
    TS_ASSERT_EQUALS(thread, Thread::current(state));

    TS_ASSERT_EQUALS(Qtrue, cur->queued());
  }