void test_getTime_it_should_return_100_150_250_300(void){

  resetTime();

  int time = getTime();

  UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((time)), (((void *)0)), (_U_UINT)47, UNITY_DISPLAY_STYLE_INT);

  time = getTime();

  UnityAssertEqualNumber((_U_SINT)((100)), (_U_SINT)((time)), (((void *)0)), (_U_UINT)49, UNITY_DISPLAY_STYLE_INT);

    time = getTime();

  UnityAssertEqualNumber((_U_SINT)((150)), (_U_SINT)((time)), (((void *)0)), (_U_UINT)51, UNITY_DISPLAY_STYLE_INT);

    time = getTime();

  UnityAssertEqualNumber((_U_SINT)((250)), (_U_SINT)((time)), (((void *)0)), (_U_UINT)53, UNITY_DISPLAY_STYLE_INT);

    time = getTime();

  UnityAssertEqualNumber((_U_SINT)((300)), (_U_SINT)((time)), (((void *)0)), (_U_UINT)55, UNITY_DISPLAY_STYLE_INT);

}
Exemple #2
0
void Reset(void)
{
	resetTime() ;

	GlobalResourceManager::use()->resetAll();

}
AbstractState* StationNumberMenu::Select()
{
  resetTime();
  Settings::SetNodeNumber(nodeNumber);
  LCDStates::TheSplashMenu.Init("Saved", false);
  return (AbstractState*)&LCDStates::TheSplashMenu;
}
Exemple #4
0
int mainInit(int argc, char** argv) {

	glutInit(&argc, argv);

	glutInitDisplayMode (GLUT_DOUBLE | GLUT_RGBA | GLUT_DEPTH);
	glutInitWindowPosition (0, 0);
	glutInitWindowSize(g_width,g_height);
	glutCreateWindow(argv[0]);

	Init();
	resetTime() ;
	glutIdleFunc(idleCB) ;
	glutReshapeFunc (ReshapeCB);
	glutKeyboardFunc( KeyboardCB );
	glutMouseFunc(MouseCB) ;
	glutMotionFunc(MotionCB) ;
	instructions();

	MakeScene() ;
	glutDisplayFunc(display);
	animTcl::InitTclTk(argc,argv) ;
	glutMainLoop();


	return 0;         // never reached
}
Exemple #5
0
    void Lock::GlobalWrite::_relock() { 
        invariant(!_lockState->isLocked());

        TrackLockAcquireTime a('W');
        _lockState->lockGlobal(newlm::MODE_X);
        resetTime();
    }
Exemple #6
0
float SmoothSailingCallback(
        float   inElapsedSinceLastCall,
        float   inElapsedTimeSinceLastFlightLoop,
        int     inCounter,
        void    *inRefcon) {

    /* get altitude - it's used in a number of places */
    float alt_agl = XPLMGetDataf( ref_alt_agl );
    float alt_msl = XPLMGetDataf( ref_alt_msl );
    
    /* only reset time if we think there's a reason to do it (set elsewhere)
     * and if the plane is not in the air */
    if( reset_time && alt_agl < 1 ) {
        resetTime();
    }
    else {
        reset_time = false;
    }

    setVisibility();
    setCloudBase( alt_agl, alt_msl );
    setWind( alt_agl, alt_msl );
    setTurbulence();

    return CALLBACK_INTERVAL;
}
void test_buttonFSM_in_Wait_state_prevState_is_Not_equal_curState_the_output_should_be_follow_curState(void){

  int buttonStateTable[] = {HIGH,LOW};

  setButtonPointerTable(buttonStateTable);

  resetTime();

  ButtonSM *TaskButtonA = malloc(sizeof(ButtonSM));

  buttonConfig(TaskButtonA,100);

  buttonFSM(TaskButtonA);

  UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((TaskButtonA->recordedTime)), (((void *)0)), (_U_UINT)113, UNITY_DISPLAY_STYLE_INT);

  UnityAssertEqualNumber((_U_SINT)((WAIT)), (_U_SINT)((TaskButtonA->state)), (((void *)0)), (_U_UINT)114, UNITY_DISPLAY_STYLE_INT);

  buttonFSM(TaskButtonA);

  UnityAssertEqualNumber((_U_SINT)((LOW)), (_U_SINT)((TaskButtonA->curState)), (((void *)0)), (_U_UINT)116, UNITY_DISPLAY_STYLE_INT);

  UnityAssertEqualNumber((_U_SINT)((LOW)), (_U_SINT)((TaskButtonA->prevState)), (((void *)0)), (_U_UINT)117, UNITY_DISPLAY_STYLE_INT);

  UnityAssertEqualNumber((_U_SINT)((IDLE)), (_U_SINT)((TaskButtonA->state)), (((void *)0)), (_U_UINT)118, UNITY_DISPLAY_STYLE_INT);

}
AbstractState* InboundRadioNodeMenu::Select()
{
  resetTime();

  if (cursorIndex < numberOfNodes)
  {
    for(uint8_t i = cursorIndex; i+1 < numberOfNodes;i++)
    {
      nodes[i] = nodes[i+1];
    }
    numberOfNodes--;
    LCDStates::TheSplashMenu.Init("Removed", &LCDStates::TheInboundRadioNodeMenu);
    return (AbstractState*)&LCDStates::TheSplashMenu;
  } else if (cursorIndex == numberOfNodes)
  {
    // add new
    if (numberOfNodes < 5)
    {
      return (AbstractState*)&LCDStates::TheAddNodeMenu;
    } 
    else 
    {
      LCDStates::TheSplashMenu.Init("List full", &LCDStates::TheInboundRadioNodeMenu);
      return (AbstractState*)&LCDStates::TheSplashMenu;
    }
    
  } else if (cursorIndex == numberOfNodes+1)
  {
    Settings::SetInboundRadioNodes(nodes, numberOfNodes);
    LCDStates::TheSplashMenu.Init("Saved", &LCDStates::TheInboundRadioNodeMenu);
    return (AbstractState*)&LCDStates::TheSplashMenu;
  }
  return NULL;
}
Exemple #9
0
void simStartBoundedMove (CMS distance)
{
  motionStatus = TRUE;
  translation_velocity = currentTransVelocity;
  translation_distance = distance;
  resetTime();
}
Exemple #10
0
void simStartGuardedMove (CMS distance, CMS stopRange)
{
  motionStatus = TRUE;
  translation_velocity = currentTransVelocity;
  translation_distance = distance;
  sensors();
  resetTime();
}
Exemple #11
0
	/**
	 * Fire a new bullet from the gun.
	 *
	 * @return The new bullet.
	*/	
	VGameEntity* Gun::fire() {
		if (canFire()) {
			fOffset *= -1;
			resetTime();
			return fEntityFactory->createBullet(fShip->getPosition() + fOffset, fShip->getDirection(), fShip->getGroup(), fBulletType);
		} else {
			return 0;
		}
	}
void
Control::beginTry() {
	srand( seed++ );
	(*os) << "begin try " << ++nrTry << endl;
	resetTime();
	feasible = false;
	bestScv = INT_MAX;
	bestEvaluation = INT_MAX;
}
void test_buttonFSM_in_IDle_state(void){
  resetTime();
  int buttonStateTable[] = {HIGH,LOW};
  setButtonPointerTable(buttonStateTable);
  ButtonSM *TaskButtonA = malloc(sizeof(ButtonSM));
  buttonConfig(TaskButtonA,100);
  buttonFSM(TaskButtonA);
  TEST_ASSERT_EQUAL(0,TaskButtonA->recordedTime);
  TEST_ASSERT_EQUAL(WAIT,TaskButtonA->state);
}
AbstractState* StationNumberMenu::Up()
{
  resetTime();
  if (nodeNumber < 31)
  {
    nodeNumber++;
    printNodeNumber();
  }
  return NULL;
}
AbstractState* StationNumberMenu::Down()
{
  resetTime();
  if (nodeNumber > 1)
  {
    nodeNumber--;
    printNodeNumber();
  }
  return NULL;
}
Exemple #16
0
void simStartTurn (DEGREES turn)
{
  motionStatus = TRUE;

  rotation_velocity = DEG_TO_RAD(currentRotVelocity);
  rotation_distance = DEG_TO_RAD(turn);
  if (turn < 0) {
    rotation_velocity = -rotation_velocity;
  }
  resetTime();
}
void SOMAW<TNeuron, TSOMParameters>::initialize(uint somRows, uint somCols, uint inputSize) {
    this->somRows = somRows;
    this->somCols = somCols;
    this->inputSize = inputSize;
    resetTime();

    this->neurons.size(somRows, somCols);
    this->activationMap.size(somRows, somCols);

    reRandomizeWeights();
}
Exemple #18
0
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
{
    m_highScore = 0;

    m_field = new TheField;
    connect(m_field, SIGNAL(flagSet(int,int)), SLOT(updateFlags(int,int)));
    connect(m_field->timer(), SIGNAL(timeout()), SLOT(updateTime()));
    connect(m_field, SIGNAL(resetTime()), SLOT(resetTime()));
    connect(m_field, SIGNAL(addScore()), SLOT(addToHighScore()));
    m_time = 0;
    resize(400, 500);
    setCentralWidget(m_field);

    createActs();
    createMenus();
    createToolbar();
    createStatusbar();

    m_field->setDifficulty(1);
}
Exemple #19
0
    Lock::GlobalRead::GlobalRead(Locker* lockState, unsigned timeoutms)
        : ScopedLock(lockState, 'R') {

        TrackLockAcquireTime a('R');

        newlm::LockResult result = _lockState->lockGlobal(newlm::MODE_S, timeoutms);
        if (result == newlm::LOCK_TIMEOUT) {
            throw DBTryLockTimeoutException();
        }

        resetTime();
    }
Exemple #20
0
void Spaceman::updateAction(const vector<GravObject*> *g_objs) {
    switch (_action) {
        case Action::STILL: {
            _action = Action::RUNNING;
            break;
        }

        case Action::RUNNING: {
            if (_on_planet_region == -1) {
                // FIXME
                // float speed = ((_facing == RIGHT) ? _running_speed : -_running_speed)/((_on_planet->getWidth()/150)*2);
                // Point2D pt = Math::rotatePtAroundPt(_on_planet->getCentre(), getCentre(), speed);
                //
                // setX(pt.getX() - (getWidth()/2));
                // setY(pt.getY() - (getHeight()/2));

            }
            else {
                if (_facing == RIGHT) {
                    setX(getX() + (_running_speed*_running_unit_vector.getX()));
                    setY(getY() + (_running_speed*_running_unit_vector.getY()));
                }
                else {
                    setX(getX() + (_running_speed*-_running_unit_vector.getX()));
                    setY(getY() + (_running_speed*-_running_unit_vector.getY()));
                }
            }
            break;
        }

        case Action::FLYING:
        case Action::LANDING: {
            // Convert angle to anti-clockwise direction
            float angle = Math::normalizeAngle(180 - getRotAngle(), 0, 360);

            // Thrust up
            Physics::genInitVel(*this, angle, PLAYER_THRUST_MIN_INIT_V, PLAYER_THRUST_MAX_INIT_V, PLAYER_THRUST_OFFSET);
            resetTime(Game::getElapsedTime());
            _trail.buildTrail(_base.getX(), 
                              _base.getY(), 
                              360 - getRotAngle(), 
                              _colour_theme);
            break;
        }
    }

    // Animate
    if (_frame < 29)
        _frame++;
    else
        _frame = 0;
}
void  test_getTime_it_should_return_100_150_250_300(void){
  resetTime();
  int time = getTime();
  TEST_ASSERT_EQUAL(0,time);
  time = getTime();
  TEST_ASSERT_EQUAL(100,time);
    time = getTime();
  TEST_ASSERT_EQUAL(150,time);
    time = getTime();
  TEST_ASSERT_EQUAL(250,time);
    time = getTime();
  TEST_ASSERT_EQUAL(300,time);
}
void test_buttonFSM_in_Wait_state_prevState_is_equal_curState_the_output_should_be_follow_curState(void){
  resetTime();
  int buttonStateTable[] = {HIGH,HIGH};
  setButtonPointerTable(buttonStateTable);
  ButtonSM *TaskButtonA = malloc(sizeof(ButtonSM));
  buttonConfig(TaskButtonA,100);
  buttonFSM(TaskButtonA);
  TEST_ASSERT_EQUAL(0,TaskButtonA->recordedTime);
  TEST_ASSERT_EQUAL(WAIT,TaskButtonA->state);
  buttonFSM(TaskButtonA);
  TEST_ASSERT_EQUAL(HIGH,TaskButtonA->curState);
  TEST_ASSERT_EQUAL(HIGH,TaskButtonA->output);
  TEST_ASSERT_EQUAL(IDLE,TaskButtonA->state);
}
void CountdownTimer::process()
{
    if (!isFinished_) {
        delay_ += dircetor_->dtTime();
        if (delay_ >= 1.0f) {
            delay_ = 0;
            if (--time_ <= 0) {
                resetTime();
                if (timerProtocolDelegate_) {
                    timerProtocolDelegate_ -> timeFinishProcess();
                }
            }
        }
    }
}
AbstractState* InboundRadioNodeMenu::Down()
{
  resetTime();
  if (cursorIndex < numberOfNodes+1)
  {
    if (cursorIndex > firstRowIndex)
    {
      firstRowIndex++;
    }
    cursorIndex++;
    printArrow();
    printMenu();
  }
  return NULL;
}
AbstractState* InboundRadioNodeMenu::Up()
{
  resetTime();
  if (cursorIndex > 0)
  {
    cursorIndex--;
    if (cursorIndex < firstRowIndex)
    {
      firstRowIndex--;
    }
    printArrow();
    printMenu();
  }
  return NULL;
}
Exemple #26
0
    void Lock::DBLock::lockDB() {
        const bool isRead = (_mode == newlm::MODE_S || _mode == newlm::MODE_IS);
        TrackLockAcquireTime a(isRead ? 'r' : 'w');

        _lockState->lockGlobal(isRead ? newlm::MODE_IS : newlm::MODE_IX);

        if (supportsDocLocking() || isRead) {
            _lockState->lock(_id, _mode);
        }
        else {
            _lockState->lock(_id, newlm::MODE_X);
        }

        resetTime();
    }
Exemple #27
0
int FPS_Manager::canTick(const long long& time)
{
	long long real_time = time - m_startTime;
	
	long long missing_frames = m_desiredFps * real_time / 1000 - m_frameCount;
	if(missing_frames > 25)
	{
		resetTime(time);
		return 1;
	}
	
	if(1000 * m_frameCount / (1 + real_time) < m_desiredFps)
		return 1;
	return 0;
}
AbstractState* SettingsMenu::Up()
{
  resetTime();
  if (cursorIndex > 0)
  {
    cursorIndex--;
    if (cursorIndex < firstRowIndex)
    {
      firstRowIndex--;
      printMenu();
    }
    printArrow();
  }
  return NULL;
}
void test_buttonFSM_in_IDle_state(void){

  resetTime();

  int buttonStateTable[] = {HIGH,LOW};

  setButtonPointerTable(buttonStateTable);

  ButtonSM *TaskButtonA = malloc(sizeof(ButtonSM));

  buttonConfig(TaskButtonA,100);

  buttonFSM(TaskButtonA);

  UnityAssertEqualNumber((_U_SINT)((0)), (_U_SINT)((TaskButtonA->recordedTime)), (((void *)0)), (_U_UINT)86, UNITY_DISPLAY_STYLE_INT);

  UnityAssertEqualNumber((_U_SINT)((WAIT)), (_U_SINT)((TaskButtonA->state)), (((void *)0)), (_U_UINT)87, UNITY_DISPLAY_STYLE_INT);

}
Exemple #30
0
CTimerObject::CTimerObject(QObject* obj, const char* member, quint64 tInterval, bool bMultiShot,
                           QGenericArgument val0, QGenericArgument val1,
                           QGenericArgument val2, QGenericArgument val3,
                           QGenericArgument val4, QGenericArgument val5,
                           QGenericArgument val6, QGenericArgument val7,
                           QGenericArgument val8, QGenericArgument val9) :
    m_tInterval( tInterval ),
    m_bMultiShot( bMultiShot )
{
	resetTime();

	m_sSignal.obj = obj;

	// Copy the c-string we have been given.
	const size_t nLength = strlen( member );
	char* sTmp = new char[nLength + 1];	// We need 1 extra char for the terminal \0.

	// This is supposed to be safe as eventual changes to pTimerObject->
	// m_sSignal.sName should originate from the same thread.
#ifdef _MSC_VER
	strcpy_s( sTmp, nLength + 1, member );
#else
	strcpy( sTmp, member );
#endif

	m_sSignal.sName = sTmp;

	m_sSignal.val0 = val0;
	m_sSignal.val1 = val1;
	m_sSignal.val2 = val2;
	m_sSignal.val3 = val3;
	m_sSignal.val4 = val4;
	m_sSignal.val5 = val5;
	m_sSignal.val6 = val6;
	m_sSignal.val7 = val7;
	m_sSignal.val8 = val8;
	m_sSignal.val9 = val9;

	m_oUUID = QUuid::createUuid();
}