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


C++ ASSERT_LT函数代码示例

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


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

示例1: TEST_F

TEST_F(TypeRegistryTest, VerifyExteriorModuleRegistration) {
  // Verify that there are a bunch of registered types in the test application by looking
  // at the length of the linked list.  We expect that there will be at least 2, because of
  // our declarations in the earlier test in this module, but we also expect there to be
  // (to choose arbitrarily) around 8, because this is a number of autofired fields known
  // to exist at one point.
  //
  // If the number of autowired members in this unit test drops below 10 at some point, it
  // might be necessary to reduce the count from 8 to something lower.
  size_t nTypes = 0;

  for(auto p = g_pFirstTypeEntry; p; p = p->pFlink)
    nTypes++;

  ASSERT_LT(8UL, nTypes) << "Registration failed to pick up the expected minimum number of types in this test";
  ASSERT_EQ(g_typeEntryCount, nTypes) << "Linked list did not contain the same number of entries as reported in g_entryCount";
}
开发者ID:gtremper,项目名称:autowiring,代码行数:17,代码来源:TypeRegistryTest.cpp

示例2: TEST

TEST(Enumerate, Cpp17Support) {
  std::array<char, 5> test = {"test"};
  // Can't use range based for loop until C++17, so test manually
  // Equivalent to:
  // for (const auto&& it : folly::enumerate(CStringRange{test.data()})) { ... }
  {
    auto&& enumerate = folly::enumerate(CStringRange{test.data()});
    auto begin = enumerate.begin();
    auto end = enumerate.end();
    for (; begin != end; ++begin) {
      const auto&& it = *begin;

      ASSERT_LT(it.index, test.size());
      EXPECT_EQ(*it, test[it.index]);
    }
  }
}
开发者ID:JacobMao,项目名称:folly,代码行数:17,代码来源:EnumerateTest.cpp

示例3: TEST

// Does the PRNG generate random floats with approximately even distribution?
TEST(UtilTest, CanGenerateRandomFloats)
{
    const int num_tests = 100000;

    double avg = 0.0f;
    for(size_t i = 0; i < num_tests; i++) {
        float res = rend_randf();
        ASSERT_LT(0.0f, res);
        ASSERT_GE(1.0f, res);
        avg += res;
    }
    avg /= (float)num_tests;
    double mid = 0.5f;
    double err = mid / 100.0f; // Test for +/-1% accuracy
    ASSERT_LE(mid - err, avg);
    ASSERT_GE(mid + err, avg);
}
开发者ID:lmurray,项目名称:rendasaurus,代码行数:18,代码来源:util.cpp

示例4: TEST

TEST(MoneyTest, comparisons) {
  ASSERT_LT(change::Money(10, 99), change::Money(11, 10));
  ASSERT_LE(change::Money(10, 99), change::Money(11, 10));
  ASSERT_EQ(change::Money(10, 99), change::Money(10, 99));
  ASSERT_LE(change::Money(10, 99), change::Money(10, 99));
  ASSERT_GE(change::Money(10, 99), change::Money(10, 99));
  ASSERT_GT(change::Money(11, 00), change::Money(10, 99));
  ASSERT_GE(change::Money(11, 00), change::Money(10, 99));

  EXPECT_TRUE(change::Money(10, 99) < change::Money(11, 10));
  EXPECT_TRUE(change::Money(10, 99) <= change::Money(11, 10));
  EXPECT_TRUE(change::Money(10, 99) == change::Money(10, 99));
  EXPECT_TRUE(change::Money(10, 99) <= change::Money(10, 99));
  EXPECT_TRUE(change::Money(10, 99) >= change::Money(10, 99));
  EXPECT_TRUE(change::Money(11, 00) > change::Money(10, 99));
  EXPECT_TRUE(change::Money(11, 00) >= change::Money(10, 99)); 
}
开发者ID:mgalushka,项目名称:cpp-start,代码行数:17,代码来源:ChangeTest.cpp

示例5: TEST_VM

// Some basic formula tests with confidence = 0.0
TEST_VM(G1Predictions, basic_predictions) {
  G1Predictions predictor(0.0);
  TruncatedSeq s;

  double p0 = predictor.get_new_prediction(&s);
  ASSERT_LT(p0, epsilon) << "Initial prediction of empty sequence must be 0.0";

  s.add(5.0);
  double p1 = predictor.get_new_prediction(&s);
  ASSERT_NEAR(p1, 5.0, epsilon);

  for (int i = 0; i < 40; i++) {
    s.add(5.0);
  }
  double p2 = predictor.get_new_prediction(&s);
  ASSERT_NEAR(p2, 5.0, epsilon);
}
开发者ID:netroby,项目名称:jdk9-dev,代码行数:18,代码来源:test_g1Predictions.cpp

示例6: maybe_pid

void
Setup::stop_ganesha()
{
    // The child_pid_ is not necessarily ganesha's - it could be gdbserver's.
    // So in order to shut things down more or less orderly we send a signal to ganesha
    // and wait for gdbserver to exit.
    const boost::optional<pid_t> maybe_pid(ganesha_pid());

    if (maybe_pid)
    {
        // 2 possibilities:
        // - gdbserver + ganesha still alive
        // - ganesha still alive
        ASSERT_LT(0, child_pid_);
        LOG_TRACE("Shutting down ganesha @ pid " << *maybe_pid);
        // For now we need to use SIGKILL as the orderly shutdown with SIGTERM
        // gets stuck in the shutdown path (cf. OVS-555).
        int ret = ::kill(*maybe_pid, SIGTERM);
        ASSERT_EQ(0, ret) << "failed to kill ganesha @ " << *maybe_pid << ": " <<
            strerror(errno);

        ASSERT_EQ(child_pid_, ::waitpid(child_pid_, &ret, 0));
        child_pid_ = -1;
    }
    else if (child_pid_ > 0)
    {
        // 2 possibilities:
        // - gdbserver + ganesha not alive anymore
        // - ganesha not alive anymore (-> zombie)
        LOG_WARN("We do seem to have a leftover child @ pid " <<
                 child_pid_ << " - killing it");

        int ret = ::kill(child_pid_, SIGKILL);
        ASSERT_EQ(0, ret) << "failed to kill ganesha @ pid " <<
            *maybe_pid << ": " << strerror(errno);

        ASSERT_EQ(child_pid_, ::waitpid(child_pid_, &ret, 0));
        child_pid_ = -1;
    }
    else
    {
        // forking off gdbserver / ganesha failed / never happened
        LOG_WARN("ganesha not running!?");
    }
}
开发者ID:bigclouds,项目名称:volumedriver,代码行数:45,代码来源:GaneshaTestSetup.cpp

示例7: TEST

TEST(bbw, decimated_knight)
{
  Eigen::MatrixXd V,C;
  Eigen::MatrixXi T,F,E;
  igl::readMESH(test_common::data_path("decimated-knight.mesh"),V,T,F);
  igl::readTGF(test_common::data_path("decimated-knight.tgf"),C,E);
  Eigen::MatrixXd W_groundtruth, Was, Wmo;
  igl::readDMAT(
    test_common::data_path("decimated-knight-matlab-active-set.dmat"),W_groundtruth);
  Eigen::VectorXi b;
  Eigen::MatrixXd bc;
  igl::boundary_conditions(V,T,C,Eigen::VectorXi(),E,Eigen::MatrixXi(),b,bc);
  igl::BBWData params;
  params.active_set_params.max_iter = 100;
  igl::bbw(V,T,b,bc,params,Was);
  igl::writeDMAT("decimated-knight-as.dmat",Was);
  ASSERT_LT( (Was-W_groundtruth).array().abs().maxCoeff() ,1e-4);
}
开发者ID:qnzhou,项目名称:libigl-unit-tests,代码行数:18,代码来源:bbw.cpp

示例8: TEST

// Test temperature companding for non-volatile storage.
//
// 20161016 moved from OpenTRV-Arduino-V0p2 Unit_Tests.cpp testTempCompand().
TEST(Stats,TempCompand)
{
  // Ensure that all (whole) temperatures from 0C to 100C are correctly compressed and expanded.
  for(int16_t i = 0; i <= 100; ++i)
    {
    //DEBUG_SERIAL_PRINT(i<<4); DEBUG_SERIAL_PRINT(" => "); DEBUG_SERIAL_PRINT(compressTempC16(i<<4)); DEBUG_SERIAL_PRINT(" => "); DEBUG_SERIAL_PRINT(expandTempC16(compressTempC16(i<<4))); DEBUG_SERIAL_PRINTLN();
    ASSERT_EQ(i<<4, OTV0P2BASE::expandTempC16(OTV0P2BASE::compressTempC16(int16_t(i<<4))));
    }
  // Ensure that out-of-range inputs are coerced to the limits.
  ASSERT_EQ(0, OTV0P2BASE::expandTempC16(OTV0P2BASE::compressTempC16(-1)));
  ASSERT_EQ((100<<4), OTV0P2BASE::expandTempC16(OTV0P2BASE::compressTempC16(101<<4)));
  ASSERT_EQ(OTV0P2BASE::COMPRESSION_C16_CEIL_VAL_AFTER, OTV0P2BASE::compressTempC16(102<<4)); // Verify ceiling.
  ASSERT_LT(OTV0P2BASE::COMPRESSION_C16_CEIL_VAL_AFTER, 0xff);
  // Ensure that 'unset' compressed value expands to 'unset' uncompressed value.
  const int16_t ui = OTV0P2BASE::NVByHourByteStatsBase::UNSET_INT;
  const uint8_t ub = OTV0P2BASE::NVByHourByteStatsBase::UNSET_BYTE;
  ASSERT_EQ(ui, OTV0P2BASE::expandTempC16(ub));
}
开发者ID:opentrv,项目名称:OTRadioLink,代码行数:21,代码来源:ByHourByteStatsTest.cpp

示例9: TEST

TEST(uuid, generator)
{
    cxx::sys::uuid u1 = cxx::sys::nil_uuid()();
    printf("u1=%s\n", cxx::sys::to_string(u1).c_str());
    ASSERT_EQ(u1.is_null(), true);

    cxx::sys::uuid u2 = cxx::sys::sys_uuid()();
    printf("u2=%s\n", cxx::sys::to_string(u2).c_str());
    ASSERT_EQ(u2.is_null(), false);


    ASSERT_NE(u1, u2);
    ASSERT_LT(u1, u2);

    std::size_t h1 = u1.hash();
    std::size_t h2 = u2.hash();
    ASSERT_NE(h1, h2);
}
开发者ID:zigzed,项目名称:common,代码行数:18,代码来源:test_uuid.cpp

示例10: TEST_F

TEST_F(PhyloTreeTest, PrefixCoding) {
    vector<PhyloTreeNode*> nodes1 = Fasta::readFastaFile("tests/aligned.fasta");
    PhyloTree t;
    t.setEvolutionModel(new Kimura(10.0));
    t.buildRandomTree(nodes1);

    double lh1 = t.logLikelihood();
    ASSERT_LT(lh1, 0.0);

    string prefixCoded = PhyloTreeNode::prefixRepresentation(t.getRoot());

    vector<PhyloTreeNode*> nodes2 = Fasta::readFastaFile("tests/aligned.fasta");
    PhyloTree t2 = PhyloTree::decodePrefixNotation(nodes2, prefixCoded, new Kimura(10.0));

    double lh2 = t.logLikelihood();

    ASSERT_DOUBLE_EQ(lh1, lh2);
}
开发者ID:ehamberg,项目名称:phyloea,代码行数:18,代码来源:PhyloTreeTest.cpp

示例11: TEST

TEST(liblog, concurrent_name(__android_log_buf_print, NUM_CONCURRENT)) {
    pthread_t t[NUM_CONCURRENT];
    int i;
    for (i=0; i < NUM_CONCURRENT; i++) {
        ASSERT_EQ(0, pthread_create(&t[i], NULL,
                                    ConcurrentPrintFn,
                                    reinterpret_cast<void *>(i)));
    }
    int ret = 0;
    for (i=0; i < NUM_CONCURRENT; i++) {
        void* result;
        ASSERT_EQ(0, pthread_join(t[i], &result));
        if ((0 == ret) && (0 != reinterpret_cast<int>(result))) {
            ret = reinterpret_cast<int>(result);
        }
    }
    ASSERT_LT(0, ret);
}
开发者ID:davidbrazdil,项目名称:cheri-art_system_core,代码行数:18,代码来源:liblog_test.cpp

示例12: TEST

    TEST(xphoto_DenoisingBm3dGrayscale, regression_L2_8x8)
    {
        std::string folder = std::string(cvtest::TS::ptr()->get_data_path()) + "cv/xphoto/bm3d_image_denoising/";
        std::string original_path = folder + "lena_noised_gaussian_sigma=10.png";
        std::string expected_path = folder + "lena_noised_denoised_bm3d_grayscale_l2_tw=8_sw=16_h=10_bm=2500.png";

        cv::Mat original = cv::imread(original_path, cv::IMREAD_GRAYSCALE);
        cv::Mat expected = cv::imread(expected_path, cv::IMREAD_GRAYSCALE);

        ASSERT_FALSE(original.empty()) << "Could not load input image " << original_path;
        ASSERT_FALSE(expected.empty()) << "Could not load reference image " << expected_path;

        cv::Mat result;
        cv::xphoto::bm3dDenoising(original, result, 10, 8, 16, 2500, -1, 8, 1, 0.0f, cv::NORM_L2, cv::xphoto::BM3D_STEP1);

        DUMP(result, expected_path + ".res.png");

        ASSERT_LT(cvtest::norm(result, expected, cv::NORM_L2), 200);
    }
开发者ID:AmbroiseMoreau,项目名称:opencv_contrib,代码行数:19,代码来源:test_denoise_bm3d.cpp

示例13: TEST_F

TEST_F(MPIProfileTest, outer_sync)
{
    struct geopm_prof_c *prof;
    uint64_t region_id[4];
    int rank;
    int num_node = 0;

    (void) geopm_comm_num_node(MPI_COMM_WORLD, &num_node);
    ASSERT_LT(1, num_node);

    MPI_Comm_rank(MPI_COMM_WORLD, &rank);

    ASSERT_EQ(0, geopm_prof_create("outer_sync_test", m_shm_key, MPI_COMM_WORLD, &prof));

    for (int i = 0; i < 3; i++) {
        ASSERT_EQ(0, geopm_prof_outer_sync(prof));

        ASSERT_EQ(0, geopm_prof_region(prof, "loop_one", GEOPM_POLICY_HINT_UNKNOWN, &region_id[0]));
        ASSERT_EQ(0, geopm_prof_enter(prof, region_id[0]));
        sleep_exact(1.0);
        ASSERT_EQ(0, geopm_prof_exit(prof, region_id[0]));

        ASSERT_EQ(0, geopm_prof_region(prof, "loop_two", GEOPM_POLICY_HINT_UNKNOWN, &region_id[1]));
        ASSERT_EQ(0, geopm_prof_enter(prof, region_id[1]));
        sleep_exact(2.0);
        ASSERT_EQ(0, geopm_prof_exit(prof, region_id[1]));

        ASSERT_EQ(0, geopm_prof_region(prof, "loop_three", GEOPM_POLICY_HINT_UNKNOWN, &region_id[2]));
        ASSERT_EQ(0, geopm_prof_enter(prof, region_id[2]));
        sleep_exact(3.0);
        ASSERT_EQ(0, geopm_prof_exit(prof, region_id[2]));

        MPI_Barrier(MPI_COMM_WORLD);
    }

    ASSERT_EQ(0, geopm_prof_print(prof, m_log_file.c_str(), 0));

    if (m_is_node_root) {
        ASSERT_EQ(0, parse_log_loop());
    }

    ASSERT_EQ(0, geopm_prof_destroy(prof));
}
开发者ID:bgeltz,项目名称:geopm,代码行数:43,代码来源:MPIProfileTest.cpp

示例14: ASSERT_LT

void block_writer::open_segment(size_t segmentid, std::string filename) {
  ASSERT_LT(segmentid, m_index_info.nsegments);
  ASSERT_TRUE(m_output_files[segmentid] == nullptr);
  m_output_files[segmentid].reset(new general_ofstream(filename, 
                                                    /* must not compress! 
                                                     * We need the blocks!*/
                                                     false));
  m_index_info.segment_files[segmentid] = filename;
  // update the per column segment file
  for (size_t col = 0;col < m_index_info.columns.size(); ++col) {
    m_index_info.columns[col].segment_files[segmentid] = 
        m_index_info.segment_files[segmentid] + ":" + std::to_string(col);
  }

  if (m_output_files[segmentid]->fail()) {
    log_and_throw("Unable to open segment data file " + filename);
  }

}
开发者ID:GYGit,项目名称:SFrame,代码行数:19,代码来源:sarray_v2_block_writer.cpp

示例15: TEST

TEST(time, clock_gettime) {
  // Try to ensure that our vdso clock_gettime is working.
  timespec ts1;
  ASSERT_EQ(0, clock_gettime(CLOCK_MONOTONIC, &ts1));
  timespec ts2;
  ASSERT_EQ(0, syscall(__NR_clock_gettime, CLOCK_MONOTONIC, &ts2));

  // What's the difference between the two?
  ts2.tv_sec -= ts1.tv_sec;
  ts2.tv_nsec -= ts1.tv_nsec;
  if (ts2.tv_nsec < 0) {
    --ts2.tv_sec;
    ts2.tv_nsec += NS_PER_S;
  }

  // Should be less than (a very generous, to try to avoid flakiness) 1000000ns.
  ASSERT_EQ(0, ts2.tv_sec);
  ASSERT_LT(ts2.tv_nsec, 1000000);
}
开发者ID:nfxosp,项目名称:platform_bionic,代码行数:19,代码来源:time_test.cpp


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