예제 #1
0
 bool redirectReceived(Resource*,
                       const ResourceRequest&,
                       const ResourceResponse&) override {
     ADD_FAILURE();
     return true;
 }
예제 #2
0
// 直接返回成功 失败
TEST(casename, testname5)
{
    SUCCEED();
    ADD_FAILURE();
}
예제 #3
0
파일: test.cpp 프로젝트: hnhbdss/workspace
TEST(FailureTest, NormalTest) {
    ADD_FAILURE() << "sorry dushishuang!";
    SUCCEED();
}
TEST(PlanningInterfaceTester, loadAllPlanners)
{
  pluginlib::ClassLoader<planning_interface::Planner>* planner_loader;
  try
  {
    planner_loader = new pluginlib::ClassLoader<planning_interface::Planner>("planning_interface", "planning_interface::Planner");
  }
  catch(pluginlib::PluginlibException& ex)
  {
    FAIL() << "Exception while creating class loader " << ex.what();
  }

  std::vector<std::string> classes;
  std::vector<boost::shared_ptr<planning_interface::Planner> > planners;
  planning_scene::PlanningSceneConstPtr scene = g_psm->getPlanningScene();
  planning_models::RobotModelConstPtr model = scene->getRobotModel();

  classes = planner_loader->getDeclaredClasses();
  // Must have some planners
  ASSERT_GT(classes.size(), 0);
  printf("Loading classes:\n");
  for(std::vector<std::string>::const_iterator it = classes.begin();
      it != classes.end();
      ++it)
    printf("  %s\n", it->c_str());
  fflush(stdout);
  return;

  for(std::vector<std::string>::const_iterator it = classes.begin();
      it != classes.end();
      ++it)
  {
    try
    {
      boost::shared_ptr<planning_interface::Planner> p(planner_loader->createUnmanagedInstance(*it));
      p->init(model);
      planners.push_back(p);
    }
    catch(pluginlib::PluginlibException& ex)
    {
      // All planners must load
      ADD_FAILURE() << "Exception while loading planner: " << *it << ": " << ex.what();
    }
  }

  for(std::vector<boost::shared_ptr<planning_interface::Planner> >::const_iterator it = planners.begin();
      it != planners.end();
      ++it)
  {
    // A dumb test: require that the planners return true from
    // canServiceRequest
    moveit_msgs::GetMotionPlan::Request req;
    planning_interface::PlannerCapability capabilities;
    bool can_service = (*it)->canServiceRequest(req, capabilities);
    EXPECT_TRUE(can_service);

    // Another dumb test: require that the planners return false from solve
    moveit_msgs::GetMotionPlan::Response res;
    bool solved = (*it)->solve(scene, req, res);
    EXPECT_FALSE(solved);
  }
}
예제 #5
0
TEST(FloatPrecision, Snapshots) {

    // Initialise the data path with en empty modulename,
    // to get the data from the root of the test data path
    cvtest::TS::ptr()->init("");

    chilitags::Chilitags3Df chilitagsf;
    chilitagsf.getChilitags().setPerformance(chilitags::Chilitags::ROBUST);
    chilitagsf.enableFilter(false);

    chilitags::Chilitags3Dd chilitagsd;
    chilitagsd.getChilitags().setPerformance(chilitags::Chilitags::ROBUST);
    chilitagsd.enableFilter(false);

    for (auto testCase : TestMetadata::all) {
        std::string path = std::string(cvtest::TS::ptr()->get_data_path())+testCase.filename;
        cv::Mat image = cv::imread(path);

        if(image.data) {

            auto tagsd = chilitagsd.estimate(image, chilitags::Chilitags::DETECT_ONLY);
            auto tagsf = chilitagsf.estimate(image, chilitags::Chilitags::DETECT_ONLY);

            ASSERT_EQ(tagsf.size(), tagsd.size()) <<
                "Single precision found " << tagsf.size() <<
                " tags while double precision found " << tagsd.size() << " tags in " << testCase.filename;

            double diff;
            for(const auto& tag : tagsf){
                const auto& matf = tag.second;
                const auto& matd = tagsd[tag.first];

                //Test rotation component
                double failThreshold = 1e-5; //TODO: What does this threshold actually mean?
                for(int i=0;i<3;i++)
                    for(int j=0;j<3;j++){
                        diff = (double)matf(i,j) - matd(i,j);
                        if(!std::isnan(diff))
                            ASSERT_LT(diff, failThreshold) <<
                                tag.first << "'s single and double precision transforms differ more than " << failThreshold << "%% in ("
                                << i << "," << j << ");" << std::endl << " Single precision transform: " << matf << std::endl
                                << "Double precision transform:" << matd;
                    }

                //Test translation component
                failThreshold = 1e-1; //Tenth of a millimeter
                for(int i=0;i<3;i++){
                    diff = (double)matf(i,3) - matd(i,3);
                    if(!std::isnan(diff))
                        ASSERT_LT(diff, failThreshold) <<
                            tag.first << "'s single and double precision transforms differ more than " << failThreshold << "%% in ("
                            << i << "," << "3);" << std::endl << " Single precision transform: " << matf << std::endl
                            << "Double precision transform:" << matd;
                }

                //Test last row
                ASSERT_EQ(matf(3,0), 0.0f); ASSERT_EQ(matf(3,1), 0.0f); ASSERT_EQ(matf(3,2), 0.0f); ASSERT_EQ(matf(3,3), 1.0f);
                ASSERT_EQ(matd(3,0), 0.0);  ASSERT_EQ(matd(3,1), 0.0);  ASSERT_EQ(matd(3,2), 0.0);  ASSERT_EQ(matd(3,3), 1.0);
            }
        }
        else {
            ADD_FAILURE()
                << "Unable to read: " << path << "\n"
                << "Did you correctly set the OPENCV_TEST_DATA_PATH environment variable?\n"
                << "CMake takes care of this if you set its TEST_DATA variable.\n"
                << "You can download the test data from\n"
                << "https://github.com/chili-epfl/chilitags-testdata";
        }
    }
}