这篇教程C++ ASSERT_GE函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ASSERT_GE函数的典型用法代码示例。如果您正苦于以下问题:C++ ASSERT_GE函数的具体用法?C++ ASSERT_GE怎么用?C++ ASSERT_GE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ASSERT_GE函数的21个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: testSortingvoid testSorting(std::vector<uint64_t> values, uint64_t memSize) { char inFileName[] = "unsortedXXXXXX"; char outFileName[] = "sortedXXXXXX"; //create temporary input and output files int fdIn = mkstemp(inFileName); ASSERT_GE(fdIn, 0) << "unable to create input file: " << strerror(errno); int fdOut = mkstemp(outFileName); ASSERT_GE(fdOut, 0) << "unable to create output file: " << strerror(errno); //store the input numbers into the input file uint64_t bytesWritten = 0; uint64_t bytesToBeWritten = values.size()*sizeof(uint64_t); while(bytesWritten < bytesToBeWritten) { int pwriteRet = pwrite(fdIn, &values[0], bytesToBeWritten - bytesWritten, bytesWritten); ASSERT_GE(pwriteRet, 0) << "unable to write values to input file: " << strerror(errno); bytesWritten += pwriteRet; } //sort the values dbImpl::externalSort(fdIn, values.size(), fdOut, memSize); //check the file size of the output file struct stat outStat; ASSERT_EQ(0, fstat(fdOut, &outStat)) << strerror(errno); EXPECT_EQ(values.size()*sizeof(uint64_t), outStat.st_size); //read back the results std::unique_ptr<uint64_t[]> results(new uint64_t[values.size()]); uint64_t bytesRead = 0; uint64_t bytesToBeRead = values.size()*sizeof(uint64_t); while(bytesRead < bytesToBeRead) { int preadRet = pread(fdOut, &results[0], bytesToBeRead - bytesRead, bytesRead); ASSERT_GE(preadRet, 0) << "unable to read values from output file: " << strerror(errno); bytesRead += preadRet; } //they should be sorted now... ASSERT_TRUE(std::is_sorted(&results[0], &results[values.size()])); //close both file descriptors //since they were created using O_TMPFILE, the files will be //deleted automatically ASSERT_EQ(0, close(fdOut)) << strerror(errno); ASSERT_EQ(0, close(fdIn)) << strerror(errno); //unlink the files ASSERT_EQ(0, unlink(inFileName)) << strerror(errno); ASSERT_EQ(0, unlink(outFileName)) << strerror(errno);}
开发者ID:vogelsgesang,项目名称:dbimpl,代码行数:47,
示例2: ASSERT_GE void bar_widget::set_value(const std::string& key, const variant& value) { if(key == "segments") { segments_ = value.as_int(); ASSERT_GE(segments_, 0); init(); } else if(key == "segment_length") { segment_length_ = value.as_int(); ASSERT_GT(segment_length_, 0); init(); } else if(key == "tick_width") { tick_width_ = value.as_int(); ASSERT_GT(tick_width_, 0); init(); } else if(key == "scale") { scale_ = value.as_decimal().as_float(); ASSERT_GT(scale_, 0.0f); init(); } else if(key == "drain_rate") { drain_rate_ = value.as_decimal().as_float(); ASSERT_GE(drain_rate_, 0.0); } else if(key == "drained") { int drain = value.as_int(); if(drain == drained_segments_) { return; } int animation_start_position = segments_-drained_segments_; animation_current_position_ = 0; drained_segments_after_anim_ = drain; if(drained_segments_after_anim_ < 0) { drained_segments_after_anim_ = 0; } if(drained_segments_after_anim_ > segments_) { drained_segments_after_anim_ = segments_; } int animation_end_position = segments_-drained_segments_after_anim_; animation_end_point_unscaled_ = animation_end_position - animation_start_position; animating_ = true; init(); } else if(key == "max_width") { bar_max_width_ = value.as_int(); init(); } else if(key == "animation_position") { animation_current_position_ = value.as_decimal().as_float(); } widget::set_value(key, value); }
开发者ID:emmasteimann,项目名称:frogatto,代码行数:47,
示例3: TEST_FTEST_F(LayoutTextTest, WidthLengthBeyondLength) { setBasicBody("x"); // Width may vary by platform and we just want to make sure it's something // roughly reasonable. float width = getBasicText()->width(0u, 2u, LayoutUnit(), LTR, false); ASSERT_GE(width, 4.f); ASSERT_LE(width, 20.f);}
开发者ID:mirror,项目名称:chromium,代码行数:8,
示例4: TEST_FTEST_F(SemaphoreTest, timedwait) { semaphore->post(); ASSERT_TRUE(semaphore->timedwait(0.1)); Time start_time(Time::now()); semaphore->timedwait(0.1); Time elapsed_time(Time::now() - start_time); ASSERT_GE(elapsed_time, Time(0.1));}
开发者ID:respu,项目名称:yield,代码行数:8,
示例5: TESTTEST(BugKillingTests, RemoveLastBugIfDead) { bug_list.clear(); bug_list.push_back(initBug(0, 0, EAST, 0)); bug_list.push_back(initBug(0, 1, EAST, MOVE_HEALTH * 3)); bug_list.push_back(initBug(0, 2, EAST, MOVE_HEALTH * 3)); bug_list.push_back(initBug(0, 3, EAST, 0)); initWorld(); moveBugs(); killDeadBugs(); ASSERT_EQ(bug_list.size(), 2); ASSERT_EQ(world[0][1], EMPTY); ASSERT_GE(world[0][2], 0); ASSERT_GE(world[0][3], 0); ASSERT_EQ(world[0][4], EMPTY);}
开发者ID:lemonade512,项目名称:EE312,代码行数:17,
示例6: TEST/** * The only process we are really guaranteed to have is this test process itself. */TEST( Process_List_Test, find_our_process ){ std::vector< PROCESSENTRY32W > v ; initialize_process_list( v, our_process_by_name(), copy_all() ) ; size_t size( v.size() ); EXPECT_EQ( 1u, size ); // Please, don't run multiple test executables simultaneously ASSERT_GE( 1u, size );}
开发者ID:suninf,项目名称:adblockplusie,代码行数:11,
示例7: TEST/** * Locate the PID of our process using the */TEST(Process_List_Test, find_our_process_in_set){ std::vector<DWORD> v; initialize_process_list(v, find_in_set, CopyPID()); size_t size(v.size()); EXPECT_EQ(size, 1u); // Please, don't run multiple test executables simultaneously ASSERT_GE(size, 1u);}
开发者ID:erikvold,项目名称:new-adblockplusie,代码行数:11,
示例8: TEST// Does the PRNG generate random integers with approximately even distribution?TEST(UtilTest, CanGenerateRandomInts){ const int num_tests = 100000; long long avg = 0; for(size_t i = 0; i < num_tests; i++) { int res = rend_rand(); ASSERT_LE(REND_RAND_MIN, res); ASSERT_GE(REND_RAND_MAX, res); avg += res; } avg /= num_tests; long long mid = REND_RAND_MIN + (REND_RAND_MAX - REND_RAND_MIN) / 2; long long err = mid / 100; // Test for +/-1% accuracy ASSERT_LE(mid - err, avg); ASSERT_GE(mid + err, avg);}
开发者ID:lmurray,项目名称:rendasaurus,代码行数:18,
示例9: TEST_FTEST_F(Allocate, Zeroed){ void *zeroes = calloc(4096, 1); for (unsigned int heapMask : m_allHeaps) { SCOPED_TRACE(::testing::Message() << "heap " << heapMask); int fds[16]; for (unsigned int i = 0; i < 16; i++) { int map_fd = -1; ASSERT_EQ(0, ion_alloc_fd(m_ionFd, 4096, 0, heapMask, 0, &map_fd)); ASSERT_GE(map_fd, 0); void *ptr = NULL; ptr = mmap(NULL, 4096, PROT_WRITE, MAP_SHARED, map_fd, 0); ASSERT_TRUE(ptr != NULL); memset(ptr, 0xaa, 4096); ASSERT_EQ(0, munmap(ptr, 4096)); fds[i] = map_fd; } for (unsigned int i = 0; i < 16; i++) { ASSERT_EQ(0, close(fds[i])); } int newIonFd = ion_open(); int map_fd = -1; ASSERT_EQ(0, ion_alloc_fd(newIonFd, 4096, 0, heapMask, 0, &map_fd)); ASSERT_GE(map_fd, 0); void *ptr = NULL; ptr = mmap(NULL, 4096, PROT_READ, MAP_SHARED, map_fd, 0); ASSERT_TRUE(ptr != NULL); ASSERT_EQ(0, memcmp(ptr, zeroes, 4096)); ASSERT_EQ(0, munmap(ptr, 4096)); ASSERT_EQ(0, close(map_fd)); } free(zeroes);}
开发者ID:00zhengfu00,项目名称:platform_system_core,代码行数:46,
示例10: TESTTEST(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,
示例11: TEST_FTEST_F( JihankiTest, GetJuiceList ) { auto list = jihanki.insert(1000).second; ASSERT_GE(list.size(), 1); Juice tmp = list[0]; ASSERT_EQ("cola", tmp.name); ASSERT_EQ(120, tmp.price);}
开发者ID:datsuns,项目名称:jihanki,代码行数:8,
示例12: TEST_FTEST_F(StateMachineTests, AdvancedConnection) { ASSERT_EQ(BST_MODE_CONNECTING_TO_BOOTSTRAP, bst_get_state()); bst_periodic(); ASSERT_EQ(BST_MODE_WAITING_FOR_DATA, bst_get_state()); prv_instance.options.retry_connecting_to_destination_network = 2; prv_instance.options.need_advanced_connection = true; { // Send hello packet now bst_udp_hello_receive_pkt_t pkt; prv_generate_test_hello(&pkt); bst_network_input((char*)&pkt,sizeof(bst_udp_hello_receive_pkt_t)); } bst_periodic(); { // Send bootstrap packet bst_udp_bootstrap_receive_pkt_t pkt; prv_generate_test_data(&pkt, true); bst_network_input((char*)&pkt,sizeof(bst_udp_bootstrap_receive_pkt_t)); } ASSERT_EQ(BST_MODE_WAITING_FOR_DATA, prv_instance.state.state); bst_periodic(); ASSERT_EQ(BST_STATE_CONNECTED, bst_get_connection_state()); ASSERT_EQ(BST_MODE_CONNECTING_TO_DEST, prv_instance.state.state); ASSERT_EQ(0, retry_advanced_connection); // Expect no further connect to advanced until timeout_connecting_state_ms is over for(unsigned i=0;i<5;++i) { bst_periodic(); } ASSERT_EQ(BST_STATE_CONNECTED, bst_get_connection_state()); ASSERT_GE(1, retry_advanced_connection); // Expect second try to connect to advanced addTimeMsOverwrite(prv_instance.options.timeout_connecting_state_ms+10); ASSERT_GE(2, retry_advanced_connection); next_connect_state = BST_STATE_CONNECTED_ADVANCED; bst_periodic(); ASSERT_EQ(BST_STATE_CONNECTED_ADVANCED, bst_get_connection_state());}
开发者ID:Openhab-Nodes,项目名称:libNodesBootstrap,代码行数:46,
示例13: TEST_FTEST_F(ConstexprMathTest, constexpr_add_overflow_clamped) { for (int a = kInt8Min; a <= kInt8Max; a++) { for (int b = kInt8Min; b <= kInt8Max; b++) { int c = folly::constexpr_clamp(a + b, int(kInt8Min), int(kInt8Max)); int8_t a1 = a; int8_t b1 = b; int8_t c1 = folly::constexpr_add_overflow_clamped(a1, b1); ASSERT_LE(c1, kInt8Max); ASSERT_GE(c1, kInt8Min); ASSERT_EQ(c1, c); } } for (int a = 0; a <= kUInt8Max; a++) { for (int b = 0; b <= kUInt8Max; b++) { int c = folly::constexpr_clamp(a + b, 0, int(kUInt8Max)); uint8_t a1 = a; uint8_t b1 = b; uint8_t c1 = folly::constexpr_add_overflow_clamped(a1, b1); ASSERT_LE(c1, kUInt8Max); ASSERT_GE(c1, 0); ASSERT_EQ(c1, c); } } constexpr auto v1 = folly::constexpr_add_overflow_clamped(int64_t(23), kInt64Max - 12); EXPECT_EQ(kInt64Max, v1); constexpr auto v2 = folly::constexpr_add_overflow_clamped(int64_t(23), int64_t(12)); EXPECT_EQ(int64_t(35), v2); constexpr auto v3 = folly::constexpr_add_overflow_clamped(int64_t(-23), int64_t(12)); EXPECT_EQ(int64_t(-11), v3); constexpr auto v4 = folly::constexpr_add_overflow_clamped(int64_t(-23), int64_t(-12)); EXPECT_EQ(int64_t(-35), v4); constexpr auto v5 = folly::constexpr_add_overflow_clamped(uint64_t(23), kUInt64Max - 12); EXPECT_EQ(kUInt64Max, v5);}
开发者ID:JacobMao,项目名称:folly,代码行数:45,
示例14: advance_head void safe_circular_char_buffer:: advance_head(const std::streamsize advance_len) { ASSERT_GE(advance_len, 0); ASSERT_LE(advance_len, size()); // advance the head forward as far as possible head += advance_len; // If head wraps around move head to begginning and then offset if (head >= bufsize) head -= bufsize; } // end of advance head
开发者ID:Bhushan1002,项目名称:SFrame,代码行数:9,
示例15: TESTTEST(scheduledreporter, test) { StubScheduledReporter scheduled_reporter(MetricRegistry::DEFAULT_REGISTRY(), boost::chrono::milliseconds(1)); scheduled_reporter.start(boost::chrono::milliseconds(100)); boost::this_thread::sleep(boost::posix_time::seconds(1)); scheduled_reporter.stop(); ASSERT_LE((size_t)9, scheduled_reporter.invocation_count()); ASSERT_GE((size_t)11, scheduled_reporter.invocation_count());}
开发者ID:QuantScientist3,项目名称:cppmetrics,代码行数:9,
示例16: TESTTEST ( Heap, make_heap ){ std::vector<int> numbers { 4, 3, 2, 5, 1 }; AP::algorithms::make_heap(begin(numbers), end(numbers)); for ( size_t i=0; i < numbers.size(); i++ ) { ASSERT_GE( numbers[i], numbers[std::floor( (i-1)/2 )]); }}
开发者ID:uahic,项目名称:AlgorithmPractice,代码行数:9,
示例17: TESTTEST(getcwd, manual_path_max) { char* buf = new char[PATH_MAX]; errno = 0; char* cwd = getcwd(buf, PATH_MAX); ASSERT_TRUE(cwd == buf); ASSERT_EQ(0, errno); ASSERT_GE(strlen(cwd), 1U); delete[] cwd;}
开发者ID:0xDEC0DE8,项目名称:platform_bionic,代码行数:9,
示例18: TESTTEST(adf, devices) { adf_id_t *devs; ssize_t n_devs = adf_devices(&devs); free(devs); ASSERT_GE(n_devs, 0) << "enumerating ADF devices failed: " << strerror(-n_devs); ASSERT_TRUE(devs != NULL);}
开发者ID:2Habibie,项目名称:platform_system_core,代码行数:9,
示例19: lockvoid ReqRepHelloWorldRequester::waitDiscovery(){ std::unique_lock<std::mutex> lock(mutexDiscovery_); if(matched_ < 2) cvDiscovery_.wait_for(lock, std::chrono::seconds(10)); ASSERT_GE(matched_, 2u);}
开发者ID:dhood,项目名称:Fast-RTPS,代码行数:9,
示例20: TEST_FTEST_F(MongoDriverTest, FindOneProject){ bson::Document d = c.findOne(FINDCOLL, {{"a", 5}}, {{"a", 1}}); ASSERT_GE(2, d.field_names().size()); //can still have the _id apparently... ugh ASSERT_EQ(5, d["a"].data<int>()); ASSERT_EQ(1, d.field_names().count("a")); ASSERT_EQ(1, d.field_names().count("_id")); ASSERT_EQ(0, d.field_names().count("b"));}
开发者ID:Lumate,项目名称:MongoDB-Cpp,代码行数:9,
示例21: SetUp virtual void SetUp() { int err = adf_device_open(dev_id, O_RDWR, &dev); ASSERT_GE(err, 0) << "opening ADF device " << dev_id << " failed: " << strerror(-err); err = adf_find_simple_post_configuration(&dev, fmt8888, n_fmt8888, &intf_id, &eng_id); ASSERT_GE(err, 0) << "finding ADF configuration failed: " << strerror(-err); intf = adf_interface_open(&dev, intf_id, O_RDWR); ASSERT_GE(intf, 0) << "opening ADF interface " << dev_id << "." << intf_id << " failed: " << strerror(-intf); eng = adf_overlay_engine_open(&dev, eng_id, O_RDWR); ASSERT_GE(eng, 0) << "opening ADF overlay engine " << dev_id << "." << eng_id << " failed: " << strerror(-eng); }
开发者ID:2Habibie,项目名称:platform_system_core,代码行数:18,
注:本文中的ASSERT_GE函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ASSERT_HOST函数代码示例 C++ ASSERT_GC_OBJECT_INHERITS函数代码示例 |