コード例 #1
0
TEST_F(FileIOIntegrationTest, ReadCovariates) {
  EXPECT_CALL(configMock, getPhenotypeCoding()).Times(AtLeast(1)).WillRepeatedly(Return(ONE_TWO_CODING));

  DataFilesReaderFactory dataFilesReaderFactory;
  DataFilesReader* dataFilesReader = dataFilesReaderFactory.constructDataFilesReader(configMock);
  Container::HostMatrix* covariatesData = dataFilesReader->readCovariates();

  int covNumberOfRows = covariatesData->getNumberOfRows();
  ASSERT_EQ(numberOfIndividualsToInclude, covNumberOfRows);
  ASSERT_EQ(2, covariatesData->getNumberOfColumns());

  EXPECT_EQ(1, (*covariatesData)(0, 0));
  EXPECT_EQ(2, (*covariatesData)(1, 0));
  EXPECT_EQ(0, (*covariatesData)(2, 0));
  EXPECT_EQ(0, (*covariatesData)(3, 0));
  EXPECT_EQ(1, (*covariatesData)(4, 0));
  EXPECT_EQ(1, (*covariatesData)(5, 0));
  EXPECT_EQ(1, (*covariatesData)(6, 0));
  EXPECT_EQ(1, (*covariatesData)(7, 0));
  EXPECT_EQ(0, (*covariatesData)(8, 0));

  EXPECT_EQ(1, (*covariatesData)(0, 1));
  EXPECT_EQ(0, (*covariatesData)(1, 1));
  EXPECT_EQ(1, (*covariatesData)(2, 1));
  EXPECT_EQ(1, (*covariatesData)(3, 1));
  EXPECT_EQ(2, (*covariatesData)(4, 1));
  EXPECT_EQ(0, (*covariatesData)(5, 1));
  EXPECT_EQ(1, (*covariatesData)(6, 1));
  EXPECT_EQ(0, (*covariatesData)(7, 1));
  EXPECT_EQ(2, (*covariatesData)(8, 1));

  delete covariatesData;
  delete dataFilesReader;
}
コード例 #2
0
TEST_F(TestActiveStateWithArgs,DirectTransition2)
{
    ::testing::NiceMock<TestStateMachineWithEventArgsMock> stateMachine;
    ::testing::NiceMock
        < TestActiveStateWithArgsMock<TestStateMachineWithEventArgsMock>
        > state(false,sttcl::TimeDuration<>(0,0,0,100),"state1");

    stateMachine.autoFinalize(false);
    stateMachine.initialState(&state);
    state.finalizeOnNextDirectTransit(true);

    // Setup mock call expectations
    //----------------------------------------------------------------------------
    EXPECT_CALL(state,checkDirectTransitionImpl(_,_,_))
        .Times(AtLeast(1));
    EXPECT_CALL(state,endDoImpl(_))
        .Times(1);
    EXPECT_CALL(stateMachine,finalizeImpl(_))
        .Times(1);

    // Run the state machine
    //----------------------------------------------------------------------------
//    stateMachine.enableLogging(true);
//    state.enableLogging(true);

    stateMachine.initialize(false);
    EXPECT_TRUE(state.waitForDoActionExited(sttcl::TimeDuration<>(0,0,0,100),5));
    stateMachine.finalize(true);
}
コード例 #3
0
TEST_F(APZHitTestingTester, TestRepaintFlushOnWheelEvents) {
  // The purpose of this test is to ensure that wheel events trigger a repaint
  // flush as per bug 1166871, and that the wheel event untransform is a no-op.

  CreateSimpleScrollingLayer();
  ScopedLayerTreeRegistration registration(manager, 0, root, mcc);
  manager->UpdateHitTestingTree(nullptr, root, false, 0, 0);
  TestAsyncPanZoomController* apzcroot = ApzcOf(root);

  EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(AtLeast(3));
  ScreenPoint origin(100, 50);
  for (int i = 0; i < 3; i++) {
    ScrollWheelInput swi(MillisecondsSinceStartup(mcc->Time()), mcc->Time(), 0,
      ScrollWheelInput::SCROLLMODE_INSTANT, ScrollWheelInput::SCROLLDELTA_PIXEL,
      origin, 0, 10, false);
    EXPECT_EQ(nsEventStatus_eConsumeDoDefault, manager->ReceiveInputEvent(swi, nullptr, nullptr));
    EXPECT_EQ(origin, swi.mOrigin);

    AsyncTransform viewTransform;
    ParentLayerPoint point;
    apzcroot->SampleContentTransformForFrame(&viewTransform, point);
    EXPECT_EQ(0, point.x);
    EXPECT_EQ((i + 1) * 10, point.y);
    EXPECT_EQ(0, viewTransform.mTranslation.x);
    EXPECT_EQ((i + 1) * -10, viewTransform.mTranslation.y);

    mcc->AdvanceByMillis(5);
  }
}
コード例 #4
0
TEST_F(FileIOIntegrationTest, ReadSNPInfo) {
  EXPECT_CALL(configMock, excludeSNPsWithNegativePosition()).Times(AtLeast(1)).WillRepeatedly(Return(true));
  EXPECT_CALL(configMock, getPhenotypeCoding()).Times(1).WillRepeatedly(Return(ZERO_ONE_CODING));

  DataFilesReaderFactory dataFilesReaderFactory;
  DataFilesReader* dataFilesReader = dataFilesReaderFactory.constructDataFilesReader(configMock);

  std::vector<SNP*>* snpInformation = dataFilesReader->readSNPInformation();

  int numSNPToInclude = 0;
  int snpSize = snpInformation->size();
  for(int i = 0; i < snpSize; ++i){
    SNP* snp = (*snpInformation)[i];
    if(snp->shouldInclude()){
      ++numSNPToInclude;
    }
  }

  EXPECT_EQ(10, snpSize);
  EXPECT_EQ(8, numSNPToInclude);

  delete dataFilesReader;

  for(int i = 0; i < snpSize; ++i){
    delete (*snpInformation)[i];
  }
  delete snpInformation;
}
コード例 #5
0
ファイル: mock_MeterS0.cpp プロジェクト: schnello/vzlogger
TEST(mock_MeterS0, basic_non_blocking)
{
	mock_S0hwif *hwif = new mock_S0hwif();
	std::list<Option> opt;
	opt.push_back(Option("send_zero", true));

	EXPECT_CALL(*hwif, _open()).Times(1).WillRepeatedly(Return(true));
	EXPECT_CALL(*hwif, _close()).Times(1).WillOnce(Return(true));
	EXPECT_CALL(*hwif, is_blocking()).Times(2).WillRepeatedly(Return(false));
	EXPECT_CALL(*hwif, status()).Times(AtLeast(0)).WillRepeatedly(Return(0));
	MeterS0 m(opt, hwif);
	ASSERT_EQ(SUCCESS, m.open());
	m.close(); // this might be called and should not cause problems
}
// Test that Init() calls DisconnectAllSupportedDevices().
TEST_F(AudioDeviceHandlerTest, InitCallsDisconnectAllSupportedDevices) {
  EXPECT_CALL(handler_,
              NotifyAudioPolicyService(
                  _, AUDIO_POLICY_DEVICE_STATE_UNAVAILABLE)).Times(3);
  EXPECT_CALL(handler_, TriggerCallback(
      AudioDeviceHandlerMock::DeviceConnectionState::kDevicesDisconnected))
      .Times(AtLeast(1));
  EXPECT_CALL(handler_,
              NotifyAudioPolicyService(
                  _, AUDIO_POLICY_DEVICE_STATE_AVAILABLE)).Times(AnyNumber());
  EXPECT_CALL(handler_, TriggerCallback(
      AudioDeviceHandlerMock::DeviceConnectionState::kDevicesConnected))
      .Times(AnyNumber());
  handler_.Init(nullptr);
}
コード例 #7
0
TEST_F(TestActiveStateWithArgs,DirectTransition1)
{
    ::testing::NiceMock<TestStateMachineWithEventArgsMock> stateMachine;
    ::testing::NiceMock
        < TestActiveStateWithArgsMock<TestStateMachineWithEventArgsMock>
        > state1(false,sttcl::TimeDuration<>(0,0,0,100),"state1");
    ::testing::NiceMock
        < TestSimpleStateWithArgsMock<TestStateMachineWithEventArgsMock>
        > state2("state2");

    stateMachine.autoFinalize(false);
    stateMachine.initialState(&state1);
    state1.setDirectTransitState(&state2);

    // Setup mock call expectations
    //----------------------------------------------------------------------------
    EXPECT_CALL(state1,checkDirectTransitionImpl(_,_,_))
        .Times(AtLeast(1));
    EXPECT_CALL(state1,exitingDoActionImpl())
        .Times(1);

    EXPECT_CALL(state2,entryImpl(&stateMachine))
        .Times(1);
    EXPECT_CALL(state2,startDoImpl(&stateMachine))
        .Times(1);
// Direct transition prevents initializing sub state machines
//    EXPECT_CALL(state2,initSubStateMachinesImpl(_))
//        .Times(1);
    EXPECT_CALL(state2,finalizeSubStateMachinesImpl(true))
        .Times(1);
    EXPECT_CALL(state2,endDoImpl(&stateMachine))
        .Times(1);
    EXPECT_CALL(state2,exitImpl(&stateMachine))
        .Times(1);

    // Run the state machine
    //----------------------------------------------------------------------------
//    stateMachine.enableLogging(true);
//    state1.enableLogging(true);
//    state2.enableLogging(true);

    stateMachine.initialize(true);
    EXPECT_TRUE(state1.waitForDoActionExited(sttcl::TimeDuration<>(0,0,0,100),5));
    stateMachine.finalize(true);
}
コード例 #8
0
TEST_F(CConnectionFinderTest, Method_setReady)
{

    CConnectivityAgentMock theConnectivityAgentMock(true);
    EGenderType theGenderType(eServerGender);
    pConnectionFinderM = new CTcpAutoConnectionFinder(theConnectivityAgentMock, theGenderType);
	//CCF8
	pConnectionFinderM->startSearch();

	CCarrierAdapter* pCarrierAdapter = pConnectionFinderM->getConnectedAdapter();

	//pConnectionFinderM->setReadyTest(pCarrierAdapter);

	//EXPECT_EQ(1, signal->second);
	EXPECT_CALL(theConnectivityAgentMock, connectionFound(pConnectionFinderM)).Times(AtLeast(1));
	pConnectionFinderM->setReadyTest(pCarrierAdapter);

}
コード例 #9
0
void FileIOIntegrationTest::SetUp() {
  //Expect Configuration
  EXPECT_CALL(configMock, getBimFilePath()).Times(AtLeast(1)).WillRepeatedly(
      Return(std::string(CuEira_BUILD_DIR) + std::string("/test.bim")));
  EXPECT_CALL(configMock, getFamFilePath()).Times(AtLeast(1)).WillRepeatedly(
      Return(std::string(CuEira_BUILD_DIR) + std::string("/test.fam")));
  EXPECT_CALL(configMock, getCSVFilePath()).Times(AtLeast(1)).WillRepeatedly(
      Return(std::string(CuEira_BUILD_DIR) + std::string("/test_env.txt")));

  EXPECT_CALL(configMock, getEnvironmentColumnName()).Times(AtLeast(1)).WillRepeatedly(Return("env1"));
  EXPECT_CALL(configMock, getCSVIdColumnName()).Times(AtLeast(1)).WillRepeatedly(Return("indid"));
  EXPECT_CALL(configMock, getCSVDelimiter()).Times(AtLeast(1)).WillRepeatedly(Return("\t "));
}
コード例 #10
0
TEST_F(FileIOIntegrationTest, ReadPersonInformation) {
  EXPECT_CALL(configMock, getPhenotypeCoding()).Times(AtLeast(1)).WillRepeatedly(Return(ONE_TWO_CODING));

  DataFilesReaderFactory dataFilesReaderFactory;
  DataFilesReader* dataFilesReader = dataFilesReaderFactory.constructDataFilesReader(configMock);

  const PersonHandler& personHandler = dataFilesReader->getPersonHandler();

  EXPECT_EQ(numberOfIndividualsTotal, personHandler.getNumberOfIndividualsTotal());
  EXPECT_EQ(numberOfIndividualsToInclude, personHandler.getNumberOfIndividualsToInclude());

  const std::vector<Person*>& persons = personHandler.getPersons();

  //TODO check stuff
  for(auto person : persons){

  }

  delete dataFilesReader;
}
コード例 #11
0
TEST_F(FileIOIntegrationTest, ReadEnvironment) {
  EXPECT_CALL(configMock, getPhenotypeCoding()).Times(AtLeast(1)).WillRepeatedly(Return(ONE_TWO_CODING));

  DataFilesReaderFactory dataFilesReaderFactory;
  DataFilesReader* dataFilesReader = dataFilesReaderFactory.constructDataFilesReader(configMock);
  EnvironmentFactorHandler* environmentFactorHandler = dataFilesReader->readEnvironmentFactorInformation();

  Id id("env1");
  EnvironmentFactor envFactor(id);

  const Container::HostVector* envData = environmentFactorHandler->getData(envFactor);
  const std::vector<const EnvironmentFactor*>& envInfo = environmentFactorHandler->getHeaders();

  ASSERT_EQ(numberOfIndividualsToInclude, envData->getNumberOfRows());
  ASSERT_EQ(2, envInfo.size());

  ASSERT_EQ(BINARY, envInfo[0]->getVariableType());
  ASSERT_EQ(OTHER, envInfo[1]->getVariableType());

  EXPECT_EQ(Id("env1"), envInfo[0]->getId());
  EXPECT_EQ(Id("env2"), envInfo[1]->getId());

  EXPECT_EQ(1, (*envData)(0));
  EXPECT_EQ(1, (*envData)(1));
  EXPECT_EQ(0, (*envData)(2));
  EXPECT_EQ(0, (*envData)(3));
  EXPECT_EQ(1, (*envData)(4));
  EXPECT_EQ(1, (*envData)(5));
  EXPECT_EQ(1, (*envData)(6));
  EXPECT_EQ(1, (*envData)(7));
  EXPECT_EQ(0, (*envData)(8));

  delete envData;
  delete dataFilesReader;
  delete environmentFactorHandler;
}
コード例 #12
0
TEST_F(APZHitTestingTester, TestRepaintFlushOnNewInputBlock) {
  SCOPED_GFX_PREF(TouchActionEnabled, bool, false);

  // The main purpose of this test is to verify that touch-start events (or anything
  // that starts a new input block) don't ever get untransformed. This should always
  // hold because the APZ code should flush repaints when we start a new input block
  // and the transform to gecko space should be empty.

  CreateSimpleScrollingLayer();
  ScopedLayerTreeRegistration registration(manager, 0, root, mcc);
  manager->UpdateHitTestingTree(nullptr, root, false, 0, 0);
  TestAsyncPanZoomController* apzcroot = ApzcOf(root);

  // At this point, the following holds (all coordinates in screen pixels):
  // layers[0] has content from (0,0)-(500,500), clipped by composition bounds (0,0)-(200,200)

  MockFunction<void(std::string checkPointName)> check;

  {
    InSequence s;

    EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(AtLeast(1));
    EXPECT_CALL(check, Call("post-first-touch-start"));
    EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(AtLeast(1));
    EXPECT_CALL(check, Call("post-second-fling"));
    EXPECT_CALL(*mcc, RequestContentRepaint(_)).Times(AtLeast(1));
    EXPECT_CALL(check, Call("post-second-touch-start"));
  }

  // This first pan will move the APZC by 50 pixels, and dispatch a paint request.
  ApzcPanNoFling(apzcroot, 100, 50);

  // Verify that a touch start doesn't get untransformed
  ScreenIntPoint touchPoint(50, 50);
  MultiTouchInput mti = CreateMultiTouchInput(MultiTouchInput::MULTITOUCH_START, mcc->Time());
  mti.mTouches.AppendElement(SingleTouchData(0, touchPoint, ScreenSize(0, 0), 0, 0));

  EXPECT_EQ(nsEventStatus_eConsumeDoDefault, manager->ReceiveInputEvent(mti, nullptr, nullptr));
  EXPECT_EQ(touchPoint, mti.mTouches[0].mScreenPoint);
  check.Call("post-first-touch-start");

  // Send a touchend to clear state
  mti.mType = MultiTouchInput::MULTITOUCH_END;
  manager->ReceiveInputEvent(mti, nullptr, nullptr);

  mcc->AdvanceByMillis(1000);

  // Now do two pans. The first of these will dispatch a repaint request, as above.
  // The second will get stuck in the paint throttler because the first one doesn't
  // get marked as "completed", so this will result in a non-empty LD transform.
  // (Note that any outstanding repaint requests from the first half of this test
  // don't impact this half because we advance the time by 1 second, which will trigger
  // the max-wait-exceeded codepath in the paint throttler).
  ApzcPanNoFling(apzcroot, 100, 50);
  check.Call("post-second-fling");
  ApzcPanNoFling(apzcroot, 100, 50);

  // Ensure that a touch start again doesn't get untransformed by flushing
  // a repaint
  mti.mType = MultiTouchInput::MULTITOUCH_START;
  EXPECT_EQ(nsEventStatus_eConsumeDoDefault, manager->ReceiveInputEvent(mti, nullptr, nullptr));
  EXPECT_EQ(touchPoint, mti.mTouches[0].mScreenPoint);
  check.Call("post-second-touch-start");

  mti.mType = MultiTouchInput::MULTITOUCH_END;
  EXPECT_EQ(nsEventStatus_eConsumeDoDefault, manager->ReceiveInputEvent(mti, nullptr, nullptr));
  EXPECT_EQ(touchPoint, mti.mTouches[0].mScreenPoint);
}
コード例 #13
0
		virtual void AtLeast(const Quantity & q) {
			AtLeast(q.quantity);
		}