当前位置: 首页>>代码示例>>C++>>正文


C++ EXPECT_LE函数代码示例

本文整理汇总了C++中EXPECT_LE函数的典型用法代码示例。如果您正苦于以下问题:C++ EXPECT_LE函数的具体用法?C++ EXPECT_LE怎么用?C++ EXPECT_LE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了EXPECT_LE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: TEST_F

TEST_F(EventsDatabaseTests, test_optimize) {
  auto sub = std::make_shared<DBFakeEventSubscriber>();
  for (size_t i = 800; i < 800 + 10; ++i) {
    sub->testAdd(i);
  }

  // Lie about the tool type to enable optimizations.
  auto default_type = kToolType;
  kToolType = ToolType::DAEMON;
  FLAGS_events_optimize = true;

  // Must also define an executing query.
  setDatabaseValue(kPersistentSettings, kExecutingQuery, "events_db_test");

  auto t = getUnixTime();
  auto results = genRows(sub.get());
  EXPECT_EQ(10U, results.size());
  // Optimization will set the time NOW as the minimum event time.
  // Thus it is not possible to set event in past.
  EXPECT_GE(sub->optimize_time_ + 100, t);
  EXPECT_LE(sub->optimize_time_ - 100, t);
  // The last EID returned will also be stored for duplication checks.
  EXPECT_EQ(10U, sub->optimize_eid_);

  for (size_t i = t + 800; i < t + 800 + 10; ++i) {
    sub->testAdd(i);
  }

  results = genRows(sub.get());
  EXPECT_EQ(10U, results.size());

  // The optimize time should have been written to the database.
  // It should be the same as the current (relative) optimize time.
  std::string content;
  getDatabaseValue("events", "optimize.events_db_test", content);
  EXPECT_EQ(std::to_string(sub->optimize_time_), content);

  // Restore the tool type.
  kToolType = default_type;
}
开发者ID:Centurion89,项目名称:osquery,代码行数:40,代码来源:events_database_tests.cpp

示例2: TYPED_TEST

TYPED_TEST(NeuronLayerTest, TestTanH) {
  typedef typename TypeParam::Dtype Dtype;
  LayerParameter layer_param;
  TanHLayer<Dtype> layer(layer_param);
  layer.SetUp(this->blob_bottom_vec_, this->blob_top_vec_);
  layer.Forward(this->blob_bottom_vec_, this->blob_top_vec_);
  // Test exact values
  for (int i = 0; i < this->blob_bottom_->num(); ++i) {
    for (int j = 0; j < this->blob_bottom_->channels(); ++j) {
      for (int k = 0; k < this->blob_bottom_->height(); ++k) {
        for (int l = 0; l < this->blob_bottom_->width(); ++l) {
          EXPECT_GE(this->blob_top_->data_at(i, j, k, l) + 1e-4,
             (exp(2*this->blob_bottom_->data_at(i, j, k, l)) - 1) /
             (exp(2*this->blob_bottom_->data_at(i, j, k, l)) + 1));
          EXPECT_LE(this->blob_top_->data_at(i, j, k, l) - 1e-4,
             (exp(2*this->blob_bottom_->data_at(i, j, k, l)) - 1) /
             (exp(2*this->blob_bottom_->data_at(i, j, k, l)) + 1));
        }
      }
    }
  }
}
开发者ID:Claire00000,项目名称:caffe-fcn,代码行数:22,代码来源:test_neuron_layer.cpp

示例3: MPI_Comm_rank

void ProfilerTest::test_petsc_memory() {
    int ierr, mpi_rank;
    ierr = MPI_Comm_rank(MPI_COMM_WORLD, &mpi_rank);
    EXPECT_EQ( ierr, 0 );
    
    Profiler::initialize(); {
        PetscLogDouble mem;
        START_TIMER("A");
            PetscInt size = 100*1000;
            PetscScalar value = 0.1;
            Vec tmp_vector;
            VecCreateSeq(PETSC_COMM_SELF, size, &tmp_vector);
            VecSet(tmp_vector, value);
            // VecSetRandom(tmp_vector, NULL);
        END_TIMER("A");
        
        START_TIMER("A");
            // allocated memory MUST be greater or equal to size * size of double
            EXPECT_GE(AN.petsc_memory_difference, size*sizeof(double));
        END_TIMER("A");
        
        START_TIMER("B");
            PetscScalar sum;
            VecSum(tmp_vector, &sum);
        END_TIMER("B");
        
        START_TIMER("C");
            VecDestroy(&tmp_vector);
        END_TIMER("C");
        
        START_TIMER("C");
            // since we are destroying vector, we expect to see negative memory difference
            EXPECT_LE(AN.petsc_memory_difference, 0);
        END_TIMER("C");
    }
    PI->output(MPI_COMM_WORLD, cout);
    Profiler::uninitialize();
}
开发者ID:jbrezmorf,项目名称:flow123d,代码行数:38,代码来源:profiler_test.cpp

示例4: TEST_F

TEST_F(TestObjList, WriteAndRead) {
    ObjList<Obj> list_to_write;
    for (int i = 10; i > 0; --i) {
        Obj obj(i);
        list_to_write.add_object(std::move(obj));
    }
    list_to_write.sort();
    list_to_write.add_object(std::move(Obj(13)));
    list_to_write.add_object(std::move(Obj(12)));
    list_to_write.add_object(std::move(Obj(11)));
    std::vector<Obj>& v = list_to_write.get_data();
    Obj* p = &v[0];
    Obj* p2 = &v[10];
    list_to_write.delete_object(p);   // rm 1
    list_to_write.delete_object(p2);  // rm 13
    size_t old_objlist_size = list_to_write.get_size();

    EXPECT_TRUE(list_to_write.write_to_disk());
    size_t data_capacity_after_write = list_to_write.get_data().capacity();
    size_t bitmap_capacity_after_write = list_to_write.get_del_bitmap().capacity();
    EXPECT_EQ(data_capacity_after_write, 0);
    EXPECT_EQ(bitmap_capacity_after_write, 0);

    std::string list_to_write_path = list_to_write.id2str();
    ObjList<Obj> list_to_read;
    list_to_read.read_from_disk(list_to_write_path);

    EXPECT_EQ(list_to_read.get_size(), old_objlist_size);
    EXPECT_EQ(list_to_read.get_size(), list_to_read.get_sorted_size());
    EXPECT_EQ(list_to_read.get_size(), list_to_read.get_del_bitmap().size());
    EXPECT_EQ(list_to_read.get_hashed_size(), 0);
    EXPECT_EQ(list_to_read.get_num_del(), 0);

    for (size_t i = 0; i < list_to_read.get_size() - 1; i++)
        EXPECT_LE(list_to_read.get(i).id(), list_to_read.get(i + 1).id());
    for (size_t i = 0; i < list_to_read.get_size() - 1; i++)
        EXPECT_EQ(list_to_read.get_del(i), false);
}
开发者ID:WuZihao1,项目名称:husky,代码行数:38,代码来源:objlist_unittest.cpp

示例5: TEST

TEST(DurationTest, Comparison)
{
  EXPECT_EQ(Duration::zero(), Seconds(0));
  EXPECT_EQ(Minutes(180), Hours(3));
  EXPECT_EQ(Seconds(10800), Hours(3));
  EXPECT_EQ(Milliseconds(10800000), Hours(3));

  EXPECT_EQ(Milliseconds(1), Microseconds(1000));
  EXPECT_EQ(Milliseconds(1000), Seconds(1));

  EXPECT_GT(Weeks(1), Days(6));

  EXPECT_LT(Hours(23), Days(1));

  EXPECT_LE(Hours(24), Days(1));
  EXPECT_GE(Hours(24), Days(1));

  EXPECT_NE(Minutes(59), Hours(1));

  // Maintains precision for a 100 year duration.
  EXPECT_GT(Weeks(5217) + Nanoseconds(1), Weeks(5217));
  EXPECT_LT(Weeks(5217) - Nanoseconds(1), Weeks(5217));
}
开发者ID:CodeTickler,项目名称:mesos,代码行数:23,代码来源:duration_tests.cpp

示例6: TEST

TEST(SimpleTest, FirstTest)
{
  // ASSERT_* can be replaced by EXPECT_*.
  // ASSERT_* yields fatal failure and EXPECT_* yields nonfatal failure.

  ASSERT_TRUE(true);
  ASSERT_FALSE(false);

  ASSERT_EQ(42, 42);
  ASSERT_NE(false, true);
  ASSERT_LT(1, 2);
  ASSERT_LE(1, 1);
  EXPECT_LE(1, 2);
  ASSERT_GT(1, 0);
  ASSERT_GE(1, 0);
  ASSERT_GE(0, 0);

  ASSERT_STREQ("foo", "foo");
  ASSERT_STRNE("foo", "Foo");
  ASSERT_STRCASEEQ("foo", "FOO");
  ASSERT_STRCASENE("foo", "bar");
  ASSERT_STRCASENE("", nullptr);
}
开发者ID:xeonchen,项目名称:simpletest,代码行数:23,代码来源:test.cpp

示例7: TEST_F

TEST_F(PageIOTestEnv, test_dealloc_reuse_many) {
    constexpr size_t SIZE_FACTOR = 10;
    size_t nr_page = m_page_io->page_size() * SIZE_FACTOR,
           max_alloc = nr_page * sizeof(PageIO::page_id_t) /
               (m_page_io->page_size() - LinkedStackImpl::header_size()) + 1
               + nr_page;
    for (int test = 0; test < 10; test ++) {
        std::unordered_set<PageIO::page_id_t> used_id;
        std::vector<PageIO::Page> pages;
        for (size_t i = 0; i < nr_page; i ++) {
            pages.emplace_back(m_page_io->alloc());
            used_id.insert(pages.back().id());
        }

        EXPECT_EQ(nr_page, used_id.size());

        for (auto &&i: pages) {
            m_page_io->free(std::move(i));
            EXPECT_FALSE(i.valid());
        }
    }
    EXPECT_LE(m_page_io->file_io().get_meta().nr_page_allocated, max_alloc);
}
开发者ID:jia-kai,项目名称:uSQL,代码行数:23,代码来源:test_page_io.cpp

示例8: TEST

TEST(BasicThreadPoolTest, StopJoinTest) {
  ReleaseWaitArg arg_data;
  ContainedThreadPool<2, 10> thread_pool;

  ASSERT_TRUE(thread_pool.Start());
  EXPECT_FALSE(thread_pool.Join(0));

  ASSERT_TRUE(thread_pool.EnqueueRun(ReleaseWaitSemaphoreRoutine, &arg_data));
  ASSERT_TRUE(arg_data.release_semaphore.Wait(50));
  thread_pool.Stop(0);

  YPlatform::Timer test_timer;
  test_timer.Start();
  EXPECT_FALSE(thread_pool.Join(100));
  test_timer.Pulse();

  EXPECT_LE(95, test_timer.GetPulsedTimeMilli());
  EXPECT_GE(120, test_timer.GetPulsedTimeMilli());

  // Releasing the semaphore should let the join succeed.
  arg_data.wait_semaphore.Release();
  EXPECT_TRUE(thread_pool.Join(50));
}
开发者ID:DavidYen,项目名称:YEngine,代码行数:23,代码来源:ThreadPool_Test.cpp

示例9: TEST

TEST(Type, Specialized) {
  auto packed = Type::Array(ArrayData::kPackedKind);
  EXPECT_LE(packed, TArr);
  EXPECT_LT(packed, TArr);
  EXPECT_FALSE(TArr <= packed);
  EXPECT_LT(packed, TArr | TObj);
  EXPECT_EQ(packed, packed & (TArr | TCounted));
  EXPECT_GE(packed, TBottom);
  EXPECT_GT(packed, TBottom);

  EXPECT_TRUE(TInt <= (packed | TInt));

  EXPECT_EQ(TBottom, packed & Type::Array(ArrayData::kMixedKind));
  EXPECT_EQ(TBottom, packed - TArr);

  EXPECT_EQ(TPtrToSPropCell, TPtrToSPropGen - TPtrToBoxedCell);

  auto const array = make_packed_array(1, 2, 3, 4);
  auto const mixed = make_map_array(1, 1, 2, 2);
  auto const arrData = ArrayData::GetScalarArray(array.get());
  auto const arrDataMixed = ArrayData::GetScalarArray(mixed.get());
  auto constArray = Type::cns(arrData);
  auto constArrayMixed = Type::cns(arrDataMixed);
  auto const spacked = Type::StaticArray(ArrayData::kPackedKind);
  EXPECT_EQ(spacked, spacked - constArray); // conservative
  EXPECT_EQ(TBottom, constArray - spacked);

  // Implemented conservatively right now, but the following better not return
  // bottom:
  EXPECT_EQ(constArrayMixed, constArrayMixed - spacked);

  // Checking specialization dropping.
  EXPECT_EQ(TArr | TBoxedInitCell, packed | TBoxedInitCell);
  auto specializedObj = Type::SubObj(SystemLib::s_IteratorClass);
  EXPECT_EQ(TArr | TObj, packed | specializedObj);
}
开发者ID:hariharanravi,项目名称:hhvm,代码行数:36,代码来源:type.cpp

示例10: TEST

TEST(EscapeObstaclesPathPlanner, run) {
    // The robot is at the origin
    MotionInstant startInstant({0, 0}, {0, 0});
    // EmptyCommand cmd;  // "None" command
    std::unique_ptr<MotionCommand> cmd =
        std::make_unique<EmptyCommand>();  // "None" command

    // Add an circle of radius 5 centered at the origin as an obstacle
    ShapeSet obstacles;
    const float circleRadius = 5;
    obstacles.add(std::make_shared<Circle>(Point(0, 0), circleRadius));

    SystemState systemState;

    EscapeObstaclesPathPlanner planner;
    std::vector<DynamicObstacle> dynamicObstacles;
    PlanRequest request(systemState, startInstant, std::move(cmd),
                        RobotConstraints(), nullptr, obstacles,
                        dynamicObstacles, 0);
    auto path = planner.run(request);

    ASSERT_NE(nullptr, path) << "Planner returned null path";

    // Ensure that the path escapes the obstacle
    RJ::Seconds hitTime;
    EXPECT_FALSE(path->hit(obstacles, 0s, &hitTime))
        << "Returned path hits obstacles";

    // Make sure the path's endpoint is close to the original point.  It
    // shouldn't be further than two steps outside of the closest possible
    // point.
    const float stepSize = EscapeObstaclesPathPlanner::stepSize();
    const float pathLength = (path->end().motion.pos - startInstant.pos).mag();
    EXPECT_LE(pathLength, circleRadius + Robot_Radius + stepSize * 2)
        << "Path is longer than it should be";
}
开发者ID:RoboJackets,项目名称:robocup-software,代码行数:36,代码来源:EscapeObstaclesPathPlannerTest.cpp

示例11: TEST_F

TEST_F(IGraphicBufferProducerTest, Query_Succeeds) {
    ASSERT_NO_FATAL_FAILURE(ConnectProducer());

    int32_t value = -1;
    EXPECT_OK(mProducer->query(NATIVE_WINDOW_WIDTH, &value));
    EXPECT_EQ(DEFAULT_WIDTH, static_cast<uint32_t>(value));

    EXPECT_OK(mProducer->query(NATIVE_WINDOW_HEIGHT, &value));
    EXPECT_EQ(DEFAULT_HEIGHT, static_cast<uint32_t>(value));

    EXPECT_OK(mProducer->query(NATIVE_WINDOW_FORMAT, &value));
    EXPECT_EQ(DEFAULT_FORMAT, value);

    EXPECT_OK(mProducer->query(NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &value));
    EXPECT_LE(0, value);
    EXPECT_GE(BufferQueue::NUM_BUFFER_SLOTS, value);

    EXPECT_OK(mProducer->query(NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND, &value));
    EXPECT_FALSE(value); // Can't run behind when we haven't touched the queue

    EXPECT_OK(mProducer->query(NATIVE_WINDOW_CONSUMER_USAGE_BITS, &value));
    EXPECT_EQ(DEFAULT_CONSUMER_USAGE_BITS, value);

}
开发者ID:debian-pkg-android-tools,项目名称:android-platform-frameworks-native,代码行数:24,代码来源:IGraphicBufferProducer_test.cpp

示例12: TEST_F

/* Tests the rcl_steady_time_point_now() function.
 */
TEST_F(TestTimeFixture, test_rcl_steady_time_point_now) {
  assert_no_realloc_begin();
  rcl_ret_t ret;
  // Check for invalid argument error condition (allowed to alloc).
  ret = rcl_steady_time_point_now(nullptr);
  EXPECT_EQ(ret, RCL_RET_INVALID_ARGUMENT) << rcl_get_error_string_safe();
  rcl_reset_error();
  assert_no_malloc_begin();
  assert_no_free_begin();
  // Check for normal operation (not allowed to alloc).
  rcl_steady_time_point_t now = {0};
  ret = rcl_steady_time_point_now(&now);
  assert_no_malloc_end();
  assert_no_realloc_end();
  assert_no_free_end();
  stop_memory_checking();
  EXPECT_EQ(ret, RCL_RET_OK) << rcl_get_error_string_safe();
  EXPECT_NE(now.nanoseconds, 0u);
  // Compare to std::chrono::steady_clock difference of two times (within a second).
  now = {0};
  ret = rcl_steady_time_point_now(&now);
  std::chrono::steady_clock::time_point now_sc = std::chrono::steady_clock::now();
  EXPECT_EQ(ret, RCL_RET_OK) << rcl_get_error_string_safe();
  // Wait for a little while.
  std::this_thread::sleep_for(std::chrono::milliseconds(100));
  // Then take a new timestamp with each and compare.
  rcl_steady_time_point_t later;
  ret = rcl_steady_time_point_now(&later);
  std::chrono::steady_clock::time_point later_sc = std::chrono::steady_clock::now();
  EXPECT_EQ(ret, RCL_RET_OK) << rcl_get_error_string_safe();
  int64_t steady_diff = later.nanoseconds - now.nanoseconds;
  int64_t sc_diff =
    std::chrono::duration_cast<std::chrono::nanoseconds>(later_sc - now_sc).count();
  const int k_tolerance_ms = 1;
  EXPECT_LE(llabs(steady_diff - sc_diff), RCL_MS_TO_NS(k_tolerance_ms)) << "steady_clock differs";
}
开发者ID:shizhexu,项目名称:rcl,代码行数:38,代码来源:test_time.cpp

示例13: TEST

TEST(Trims, invertedThrottlePlusthrottleTrimWithZeroWeightOnThrottle)
{
  MODEL_RESET();
  modelDefault(0);
  g_model.throttleReversed = 1;
  g_model.thrTrim = 1;
#if defined(PCBTARANIS)
  // the input already exists
  ExpoData *expo = expoAddress(THR_STICK);
#else
  ExpoData *expo = expoAddress(0);
  expo->mode = 3;
  expo->chn = THR_STICK;
#endif
  expo->weight = 0;
  // stick max + trim max
  anaInValues[THR_STICK] = +1024;
  setTrimValue(0, THR_STICK, TRIM_MAX);
  evalMixes(1);
  EXPECT_EQ(channelOutputs[2], 0);
  // stick max + trim mid
  anaInValues[THR_STICK] = +1024;
  setTrimValue(0, THR_STICK, 0);
  evalMixes(1);
  EXPECT_LE(abs(channelOutputs[2] - 125), 1);
  // stick max + trim min
  anaInValues[THR_STICK] = +1024;
  setTrimValue(0, THR_STICK, TRIM_MIN);
  evalMixes(1);
  EXPECT_EQ(channelOutputs[2], 250);
  // stick min + trim max
  anaInValues[THR_STICK] = -1024;
  setTrimValue(0, THR_STICK, TRIM_MAX);
  evalMixes(1);
  EXPECT_EQ(channelOutputs[2], 0);
  // stick min + trim mid
  anaInValues[THR_STICK] = -1024;
  setTrimValue(0, THR_STICK, 0);
  evalMixes(1);
  EXPECT_LE(abs(channelOutputs[2] - 125), 1);
  // stick min + trim min
  anaInValues[THR_STICK] = -1024;
  setTrimValue(0, THR_STICK, TRIM_MIN);
  evalMixes(1);
  EXPECT_EQ(channelOutputs[2], 250);

  // now some tests with extended Trims
  g_model.extendedTrims = 1;
  // trim min + various stick positions = should always be same value
  setTrimValue(0, THR_STICK, TRIM_EXTENDED_MIN);
  anaInValues[THR_STICK] = -1024;
  evalMixes(1);
  EXPECT_EQ(channelOutputs[2], 1000);
  anaInValues[THR_STICK] = -300;
  evalMixes(1);
  EXPECT_EQ(channelOutputs[2], 1000);
  anaInValues[THR_STICK] = +300;
  evalMixes(1);
  EXPECT_EQ(channelOutputs[2], 1000);
  anaInValues[THR_STICK] = +1024;
  evalMixes(1);
  EXPECT_EQ(channelOutputs[2], 1000);

  // trim max + various stick positions = should always be same value
  setTrimValue(0, THR_STICK, TRIM_EXTENDED_MAX);
  anaInValues[THR_STICK] = -1024;
  evalMixes(1);
  EXPECT_EQ(channelOutputs[2], 0);
  anaInValues[THR_STICK] = -300;
  evalMixes(1);
  EXPECT_EQ(channelOutputs[2], 0);
  anaInValues[THR_STICK] = +300;
  evalMixes(1);
  EXPECT_EQ(channelOutputs[2], 0);
  anaInValues[THR_STICK] = +1024;
  evalMixes(1);
  EXPECT_EQ(channelOutputs[2], 0);
}
开发者ID:BenZoFly,项目名称:opentx,代码行数:78,代码来源:mixer.cpp

示例14: TEST

TEST(logcat, blocking_tail) {
    FILE *fp;
    unsigned long long v = 0xA55FDEADBEEF0000ULL;

    pid_t pid = getpid();

    v += pid & 0xFFFF;

    LOG_FAILURE_RETRY(__android_log_btwrite(0, EVENT_TYPE_LONG, &v, sizeof(v)));

    v &= 0xFFFAFFFFFFFFFFFFULL;

    ASSERT_TRUE(NULL != (fp = popen(
      "( trap exit HUP QUIT INT PIPE KILL ; sleep 6; echo DONE )&"
      " logcat -v brief -b events -T 5 2>&1",
      "r")));

    char buffer[5120];

    int count = 0;

    int signals = 0;

    signal(SIGALRM, caught_blocking_tail);
    alarm(2);
    while (fgets(buffer, sizeof(buffer), fp)) {

        if (!strncmp(buffer, "DONE", 4)) {
            break;
        }

        ++count;

        int p;
        unsigned long long l;

        if ((2 != sscanf(buffer, "I/[0] ( %u): %lld", &p, &l))
         || (p != pid)) {
            continue;
        }

        if (l == v) {
            if (count >= 5) {
                ++signals;
            }
            break;
        }
    }
    alarm(0);
    signal(SIGALRM, SIG_DFL);

    // Generate SIGPIPE
    fclose(fp);
    caught_blocking_tail(0);

    pclose(fp);

    EXPECT_LE(2, count);

    EXPECT_EQ(1, signals);
}
开发者ID:Jendorski,项目名称:platform_system_core,代码行数:61,代码来源:logcat_test.cpp

示例15: TEST_F


//.........这里部分代码省略.........
    knotPoint.motionState.velocities.push_back(0.f);
    knotPoint.motionState.velocities.push_back(0.f);
    knotPoint.motionState.velocities.push_back(0.f);
    knotPoint.motionState.time = 0;    
    _path.points.push_back(knotPoint);
    }
    
    // -----------------------------------------------------

    { // Scop the variables & Seed the sixth knot point 
    ramp_msgs::KnotPoint knotPoint;
    knotPoint.motionState.positions.push_back(3.25f);
    knotPoint.motionState.positions.push_back(0.f);
    knotPoint.motionState.positions.push_back((3.f*PI/4.f));
    knotPoint.motionState.velocities.push_back(0.f);
    knotPoint.motionState.velocities.push_back(0.f);
    knotPoint.motionState.velocities.push_back(0.f);
    knotPoint.motionState.time = 0;    
    _path.points.push_back(knotPoint);
    }
    
    // -----------------------------------------------------

    { // Scop the variables & Seed the seventh knot point 
    ramp_msgs::KnotPoint knotPoint;
    knotPoint.motionState.positions.push_back(3.25f);
    knotPoint.motionState.positions.push_back(0.f);
    knotPoint.motionState.positions.push_back((3.f*PI/4.f));
    knotPoint.motionState.velocities.push_back(0.f);
    knotPoint.motionState.velocities.push_back(0.f);
    knotPoint.motionState.velocities.push_back(0.f);
    knotPoint.motionState.time = 0;    
    _path.points.push_back(knotPoint);
    }
    
    // -----------------------------------------------------

    { // Scop the variables & Seed the eight knot point 
    ramp_msgs::KnotPoint knotPoint;
    knotPoint.motionState.positions.push_back(3.25f);
    knotPoint.motionState.positions.push_back(0.f);
    knotPoint.motionState.positions.push_back((3.f*PI/4.f));
    knotPoint.motionState.velocities.push_back(0.f);
    knotPoint.motionState.velocities.push_back(0.f);
    knotPoint.motionState.velocities.push_back(0.f);
    knotPoint.motionState.time = 0;    
    _path.points.push_back(knotPoint);
    }
    
    // -----------------------------------------------------

    { // Scop the variables & Seed the ninth knot point 
    ramp_msgs::KnotPoint knotPoint;
    knotPoint.motionState.positions.push_back(3.25f);
    knotPoint.motionState.positions.push_back(0.f);
    knotPoint.motionState.positions.push_back((3.f*PI/4.f));
    knotPoint.motionState.velocities.push_back(0.f);
    knotPoint.motionState.velocities.push_back(0.f);
    knotPoint.motionState.velocities.push_back(0.f);
    knotPoint.motionState.time = 0;    
    _path.points.push_back(knotPoint);
    }
    
    // -----------------------------------------------------

    
    // Initialize the bezier curve  ------------------------
     ramp_msgs::BezierCurve _temp;
    _temp.segmentPoints.push_back(_path.points.at(0).motionState);
    _temp.segmentPoints.push_back(_path.points.at(1).motionState);
    _temp.segmentPoints.push_back(_path.points.at(2).motionState);
    // -----------------------------------------------------

    ramp_msgs::TrajectoryRequest tr;
    tr.path = _path;
    tr.type = HYBRID;
    tr.bezierCurves.push_back(_temp);
    
    // Initialize the trajectory request -------------------
    _trajectorySrv.request.reqs.push_back(tr);
    //_trajectorySrv.request.path = _path;
    //_trajectorySrv.request.type = HYBRID;
    //_trajectorySrv.request.bezierCurves.push_back(_temp);
    // -----------------------------------------------------

    try{          
          // Request a trajectory
          _client.call(_trajectorySrv);
          
          // Expectations
          EXPECT_LE(50, (_trajectorySrv.response.trajectory.trajectory.points.size()))
                    <<"Size of the trajectory is less than 50 point";

          EXPECT_GE(500, (_trajectorySrv.response.trajectory.trajectory.points.size()))
                    <<"Size of the trajectory is greater than 75 point";
          
    }catch(...){
        FAIL() << "Failed to call trajectory generator service.";
    }
}
开发者ID:sterlingm,项目名称:ramp,代码行数:101,代码来源:trajectory_generator_testFunctionality.cpp


注:本文中的EXPECT_LE函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。