Exemplo n.º 1
0
TEST(Tag6, set_get) {
    OpenPGP::Packet::Tag6 tag6;
    EXPECT_NO_THROW(TAG6_FILL(tag6));
    TAG6_EQ(tag6);
}
Exemplo n.º 2
0
TEST(AssertionTests, DoesNotThrowForFalsyExpressionsWhenDEBUGNotDefined) {
  EXPECT_NO_THROW(assert::that(false));
  EXPECT_NO_THROW(assert::that(5 == 7));
  EXPECT_NO_THROW(assert::that(std::string("foo") == std::string("bar")));
}
Exemplo n.º 3
0
TEST(Tag6, show) {
    OpenPGP::Packet::Tag6 tag6;
    EXPECT_NO_THROW(TAG6_FILL(tag6));
    EXPECT_NO_THROW(tag6.show());
}
Exemplo n.º 4
0
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
TEST_P(FacilityModelTests, CopyFacility) {
  FacilityModel* new_facility = facility_model_;
  EXPECT_NO_THROW(new_facility->copy(facility_model_)); 
}
Exemplo n.º 5
0
TEST(AssertionTests, WorksForTruthyExpressions) {
  EXPECT_NO_THROW(assert::that(5 == 5));
  EXPECT_NO_THROW(assert::that(std::string("foo") != std::string("bar")));
}
  TEST(ExtendedKalmanFilterTest, functionality)
  {
    ExtendedKalmanFilter ekf;

    ekf.setStateTransitionModel(f);
    ekf.setJacobianOfStateTransitionModel(df);
    ekf.setObservationModel(h);
    ekf.setJacobianOfObservationModel(dh);
    MatrixXd Q(1,1); Q << 0.1;
    ekf.setProcessNoiseCovariance(Q);
    MatrixXd R(1,1); R << 10;
    ekf.setMeasurementNoiseCovariance(R);

    ekf.validate();

    // check if the calculation of an estimate is correct
    // first measurement z1:
    InputValue measurement(1);
    Input in(measurement);
    Output out;

    // u contained in a state transition formula, so an error will be
    // thrown when u is not initialized with the correct size
    //out = ekf.estimate(in);		// fail assertion produced by Eigen (out-of-range error)
    ekf.setControlInputSize(1);
    ekf.validate();
    EXPECT_NO_THROW(out = ekf.estimate(in));

    EXPECT_EQ(out.size(), 1);
    EXPECT_NEAR(out[0].getValue(), 0.0099, 0.0001);
    EXPECT_NEAR(out[0].getVariance(), 0.0990, 0.0001);

    // next measurement z2:
    in[0].setValue(5);

    // setting a control input = 0 does not change the result, it can
    // be calculated as if there is no control input
    InputValue ctrl(0);
    Input in_ctrl(ctrl);
    ekf.setControlInput(in_ctrl);	// (no validation needed, cannot be validated)

    EXPECT_NO_THROW(out = ekf.estimate(in));
  
    EXPECT_NEAR(out[0].getValue(), 0.1073, 0.0001);
    EXPECT_NEAR(out[0].getVariance(), 0.1951, 0.0001);

    // missing measurement
    InputValue missingValue;
    Input inMissing(missingValue);
    EXPECT_NO_THROW(out = ekf.estimate(inMissing));
  
    EXPECT_NEAR(out[0].getValue(), 0.1073, 0.0001);
    EXPECT_NEAR(out[0].getVariance(), 0.2866, 0.0001);

    // another example -----------------------------------
    ExtendedKalmanFilter ekf2;
    ekf2.setStateTransitionModel(f2);
    ekf2.setJacobianOfStateTransitionModel(df2);
    ekf2.setObservationModel(h2);
    ekf2.setJacobianOfObservationModel(dh2);
    MatrixXd Q2(2,2); Q2 << 0.1, 0, 0, 0.1;
    ekf2.setProcessNoiseCovariance(Q2);
    MatrixXd R2(1,1); R2 << 10;
    ekf2.setMeasurementNoiseCovariance(R2);

    ekf2.validate();

    in[0].setValue(1);
    EXPECT_NO_THROW(out = ekf2.estimate(in));
    EXPECT_EQ(out.size(), 2);
    
    EXPECT_NEAR(out[0].getValue(), 0.0, 0.0001);
    EXPECT_NEAR(out[0].getVariance(), 0.1, 0.0001);
    EXPECT_NEAR(out[1].getValue(), 0.0099, 0.0001);
    EXPECT_NEAR(out[1].getVariance(), 0.0990, 0.0001);

    // missing measurement
    EXPECT_NO_THROW(out = ekf2.estimate(inMissing));
    
    EXPECT_NEAR(out[0].getValue(), 0.00099, 0.0001);
    EXPECT_NEAR(out[1].getValue(), 0.0099, 0.0001);
  }
Exemplo n.º 7
0
TEST_F(lagi_mru, add_entry) {
	agi::fs::Copy("data/mru_ok.json", "data/mru_tmp");
	agi::MRUManager mru("data/mru_tmp", default_mru);
	EXPECT_NO_THROW(mru.Add("Valid", "/path/to/file"));
	EXPECT_STREQ("/path/to/file", mru.Get("Valid")->front().string().c_str());
}
Exemplo n.º 8
0
TEST_F(lagi_mru, MRUKeyValid) {
	util::copy("data/mru_ok.json", "data/mru_tmp");
	agi::MRUManager mru("data/mru_tmp", default_mru);
	EXPECT_NO_THROW(mru.Add("Valid", "/path/to/file"));
}
Exemplo n.º 9
0
TEST_F(TestTransitionWrapper, empty_transition) {
  auto a = std::make_shared<rclcpp_lifecycle::Transition>(1, "my_transition");
  EXPECT_NO_THROW(a.reset());
}
Exemplo n.º 10
0
TEST_F( host, gramschmidt ) {
  EXPECT_NO_THROW(run_test_gramschmidt< Kokkos::Threads>( 10, 20, "Kokkos::Threads" ));
}
Exemplo n.º 11
0
TEST_F(lagi_mru, MRUConstructFromFile) {
	EXPECT_NO_THROW(agi::MRUManager mru(conf_ok, default_mru));
}
Exemplo n.º 12
0
TEST_F( host, hexgrad ) {
  EXPECT_NO_THROW(run_test_hexgrad< Kokkos::Threads>( 10, 20, "Kokkos::Threads" ));
}
Exemplo n.º 13
0
TEST_F(StanCommonRecorder, messages_noargs) {
  EXPECT_NO_THROW(recorder());
  EXPECT_NO_THROW(recorder());
  
  EXPECT_EQ("\n\n", ss.str());
}
Exemplo n.º 14
0
TEST_P(SnapshotRestoreTest, SimpleRestore)
{
    auto ns_ptr = make_random_namespace();
    SharedVolumePtr v = newVolume(VolumeId("volume1"),
                          ns_ptr->ns());

    const std::string pattern1("Frederik");

    writeToVolume(*v, 0, 4096, pattern1);
    waitForThisBackendWrite(*v);
    v->createSnapshot(SnapshotName("snap1"));

    const std::string pattern2("Frederik");

    writeToVolume(*v, 0, 4096, pattern2);
    waitForThisBackendWrite(*v);
    v->createSnapshot(SnapshotName("snap2"));


    const std::string pattern3("Arne");

    writeToVolume(*v, 0, 4096, pattern3);
    waitForThisBackendWrite(*v);
    v->createSnapshot(SnapshotName("snap3"));

    const std::string pattern4("Bart");

    writeToVolume(*v, 0, 4096, pattern4);
    waitForThisBackendWrite(*v);
    v->createSnapshot(SnapshotName("snap4"));

    const std::string pattern5("Wouter");
    writeToVolume(*v, 0, 4096, pattern5);

    checkVolume(*v,0,4096,pattern5);
    waitForThisBackendWrite(*v);

    EXPECT_NO_THROW(restoreSnapshot(*v,
                                    "snap4"));

    checkVolume(*v,0,4096,pattern4);
    writeToVolume(*v, 0, 4096, "Bollocks");
    waitForThisBackendWrite(*v);
    v->createSnapshot(SnapshotName("snapper"));
    waitForThisBackendWrite(*v);

    EXPECT_NO_THROW(restoreSnapshot(*v,
                                    "snap3"));

    checkVolume(*v,0,4096,pattern3);
    writeToVolume(*v, 0, 4096, "Bollocks");
    waitForThisBackendWrite(*v);
    v->createSnapshot(SnapshotName("snapper"));
    waitForThisBackendWrite(*v);

    EXPECT_NO_THROW(restoreSnapshot(*v,
                                    "snap2"));

    checkVolume(*v,0,4096,pattern2);
    writeToVolume(*v, 0, 4096, "Bollocks");
    waitForThisBackendWrite(*v);
    v->createSnapshot(SnapshotName("snapper"));
    waitForThisBackendWrite(*v);

    EXPECT_NO_THROW(restoreSnapshot(*v,
                                    "snap1"));

    checkVolume(*v,0,4096,pattern1);
    writeToVolume(*v, 0, 4096, "Bollocks");
    waitForThisBackendWrite(*v);
    v->createSnapshot(SnapshotName("snapper"));
    waitForThisBackendWrite(*v);
    checkCurrentBackendSize(*v);
}
Exemplo n.º 15
0
TEST_F( cuda, hexgrad ) {
  EXPECT_NO_THROW(test_cuda_hexgrad( 10, 20 ));
}
Exemplo n.º 16
0
TEST_F(TestFittableFunction, ConstructingWithValidParametersDoesNotThrow) {
    EXPECT_NO_THROW(FittableFunction("test", "gaus(0)", 1.0, 3.0));
}
Exemplo n.º 17
0
TEST_F( cuda, gramschmidt ) {
  EXPECT_NO_THROW(test_cuda_gramschmidt( 10, 20 ));
}
TEST_F(DictTest, comparison)
{
    EXPECT_NO_THROW(this->_l <  this->_r);
    EXPECT_NO_THROW(this->_l <  this->_l);
    EXPECT_NO_THROW(this->_l <= this->_r);
    EXPECT_NO_THROW(this->_l <= this->_l);
    EXPECT_NO_THROW(this->_r >  this->_l);
    EXPECT_NO_THROW(this->_r >  this->_r);
    EXPECT_NO_THROW(this->_r >= this->_l);
    EXPECT_NO_THROW(this->_r >= this->_r);
    EXPECT_NO_THROW(this->_l == this->_l);
    EXPECT_NO_THROW(this->_l == this->_r);
    EXPECT_NO_THROW(this->_l != this->_l);
    EXPECT_NO_THROW(this->_l != this->_r);
}
TEST( MEMORY, ERASE_INSERT_THROW_CLEAR ) {
	dout << __LINE__ << std::endl;

	rlimit a;
	a.rlim_cur = rlim_t( 0 );
	a.rlim_max = rlim_t( 0 );
	if( setrlimit( RLIMIT_AS, &a ) != 0 ) {
		if( errno == EFAULT ) std::cerr << __LINE__ << ": EFAULT" << std::endl;
		else if( errno == EINVAL ) std::cerr << __LINE__ << ": EINVAL" << std::endl;
		else if( errno == EPERM ) std::cerr << __LINE__ << ": EPERM" << std::endl;
		else if( errno == ESRCH ) std::cerr << __LINE__ << ": ESRCH" << std::endl;
		else std::cerr << __LINE__ << ": SOME ERROR" << std::endl;
	}

	dout << __LINE__ << std::endl;

	treap<A> abba;

	dout << __LINE__ << std::endl;

	auto it = abba.emplace("a", "ab", "ac");

	dout << __LINE__ << std::endl;

	try {
		std::string d = "";
		while( true ) {
			d += "a";
			abba.emplace(d, d + "b", d + "c");
		}

		dout << __LINE__ << std::endl;
	} catch( std::bad_alloc const & ) {
		dout << __LINE__ << std::endl;

		try {
			while( true )
				new bool( true );

			dout << __LINE__ << std::endl;
		} catch( std::bad_alloc const & ) {
			dout << __LINE__ << std::endl;

			unsigned long long count_now = count_constructed - count_destroyed;

			dout << __LINE__ << std::endl;

			EXPECT_NO_THROW( abba.erase( it ) );

			dout << __LINE__ << std::endl;

			EXPECT_EQ( count_now - 1, count_constructed - count_destroyed );

			dout << __LINE__ << std::endl;

			EXPECT_THROW( abba.emplace("dsgdasbtdfgbsvakhgljhljhsdfbhfbdsfa", "dsgdasbtafshdfhdfdfgbsvasdfbhfbdsfa", "dsgdasbtdfghdsjgfbsvasdfbhfkhgbdsfa"), std::bad_alloc );

			dout << __LINE__ << std::endl;

			EXPECT_EQ( count_now - 1, count_constructed - count_destroyed );

			dout << __LINE__ << std::endl;

			EXPECT_NO_THROW( abba.emplace("a", "ab", "ac") );

			dout << __LINE__ << std::endl;

			EXPECT_EQ( count_now, count_constructed - count_destroyed );

			dout << __LINE__ << std::endl;

			EXPECT_NO_THROW( abba.clear() );

			dout << __LINE__ << std::endl;

			EXPECT_EQ( 0, count_constructed - count_destroyed );

			dout << __LINE__ << std::endl;
		}

		dout << __LINE__ << std::endl;
	}

	dout << __LINE__ << std::endl;
}
Exemplo n.º 20
0
TEST(SmCommonTestSuite,testAssertMacros) 
{
  
  SM_DEFINE_EXCEPTION(Exception, std::runtime_error);
  
  {
    double* val = new double;
    EXPECT_NO_THROW( SM_ASSERT_TRUE(Exception, true, "") );
    EXPECT_NO_THROW( SM_ASSERT_FALSE(Exception, false, "") );
    EXPECT_NO_THROW( SM_ASSERT_GE_LT(Exception, 0.0, 0.0, 1.0, "") );
    EXPECT_NO_THROW( SM_ASSERT_GT_LE(Exception, 0.1, 0.0, 1.0, "") );
    EXPECT_NO_THROW( SM_ASSERT_GE_LE(Exception, 0.0, 0.0, 1.0, "") );
    EXPECT_NO_THROW( SM_ASSERT_GE_LE(Exception, 1.0, 0.0, 1.0, "") );
    EXPECT_NO_THROW( SM_ASSERT_LT(Exception, 0.0, 1.0, "") );
    EXPECT_NO_THROW( SM_ASSERT_GT(Exception, 1.0, 0.0, "") );
    EXPECT_NO_THROW( SM_ASSERT_POSITIVE(Exception, 1.0, "") );
    EXPECT_NO_THROW( SM_ASSERT_NONNEGATIVE(Exception, 0.0, "") );
    EXPECT_NO_THROW( SM_ASSERT_NEGATIVE(Exception, -1.0, "") );
    EXPECT_NO_THROW( SM_ASSERT_NONPOSITIVE(Exception, 0.0, "") );
    EXPECT_NO_THROW( SM_ASSERT_ZERO(Exception, 0.0, "") );
    EXPECT_NO_THROW( SM_ASSERT_NOTNULL(Exception, val, "") );
    EXPECT_NO_THROW( SM_ASSERT_LE(Exception, 0.0, 0.0, "") );
    EXPECT_NO_THROW( SM_ASSERT_GE(Exception, 0.0, 0.0, "") );
    EXPECT_NO_THROW( SM_ASSERT_NE(Exception, 0.0, 1.0, "") );
    EXPECT_NO_THROW( SM_ASSERT_EQ(Exception, 0.0, 0.0, "") );
    EXPECT_NO_THROW( SM_ASSERT_NEAR(Exception, 0.0, 1.0, 2.0, "") );
    EXPECT_NO_THROW( SM_ASSERT_FINITE(Exception, 0.0, "") );
    EXPECT_NO_THROW( SM_ASSERT_NOTNAN(Exception, 0.0, "") );
    delete val;
  }
    
  {
    double* val = NULL;
    EXPECT_THROW( SM_ASSERT_TRUE(Exception, false, ""), Exception);
    EXPECT_THROW( SM_ASSERT_FALSE(Exception, true, ""), Exception );
    EXPECT_THROW( SM_ASSERT_GE_LT(Exception, 1.0, 0.0, 1.0, ""), Exception );
    EXPECT_THROW( SM_ASSERT_GT_LE(Exception, 0.0, 0.0, 1.0, ""), Exception );
    EXPECT_THROW( SM_ASSERT_GE_LE(Exception, -0.1, 0.0, 1.0, ""), Exception );
    EXPECT_THROW( SM_ASSERT_GE_LE(Exception, 1.1, 0.0, 1.0, ""), Exception );
    EXPECT_THROW( SM_ASSERT_LT(Exception, 1.0, 1.0, ""), Exception );
    EXPECT_THROW( SM_ASSERT_GT(Exception, 0.0, 0.0, ""), Exception );
    EXPECT_THROW( SM_ASSERT_POSITIVE(Exception, 0.0, ""), Exception );
    EXPECT_THROW( SM_ASSERT_NONNEGATIVE(Exception, -1.0, ""), Exception );
    EXPECT_THROW( SM_ASSERT_NEGATIVE(Exception, 0.0, ""), Exception );
    EXPECT_THROW( SM_ASSERT_NONPOSITIVE(Exception, 1.0, ""), Exception );
    EXPECT_THROW( SM_ASSERT_ZERO(Exception, 1.0, ""), Exception );
    EXPECT_THROW( SM_ASSERT_NOTNULL(Exception, val, ""), Exception );
    EXPECT_THROW( SM_ASSERT_LE(Exception, 1.0, 0.0, ""), Exception );
    EXPECT_THROW( SM_ASSERT_GE(Exception, -1.0, 0.0, ""), Exception );
    EXPECT_THROW( SM_ASSERT_NE(Exception, 0.0, 0.0, ""), Exception );
    EXPECT_THROW( SM_ASSERT_EQ(Exception, 1.0, 0.0, ""), Exception );
    EXPECT_THROW( SM_ASSERT_NEAR(Exception, 0.0, 1.0, 0.5, ""), Exception );
    EXPECT_THROW( SM_ASSERT_FINITE(Exception, std::numeric_limits<float>::infinity(), ""), Exception );
    EXPECT_THROW( SM_ASSERT_NOTNAN(Exception, std::numeric_limits<float>::signaling_NaN(), ""), Exception );
  }
}
Exemplo n.º 21
0
TEST_F(lagi_mru, valid_mru_key_doesnt_throw) {
	agi::fs::Copy("data/mru_ok.json", "data/mru_tmp");
	agi::MRUManager mru("data/mru_tmp", default_mru);
	EXPECT_NO_THROW(mru.Add("Valid", "/path/to/file"));
}
Exemplo n.º 22
0
//- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 
TEST_P(FacilityModelTests, Tock) {
  int time = 1;
  EXPECT_NO_THROW(facility_model_->handleTock(time));
}