本文整理汇总了C++中EXPECT_GE函数的典型用法代码示例。如果您正苦于以下问题:C++ EXPECT_GE函数的具体用法?C++ EXPECT_GE怎么用?C++ EXPECT_GE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了EXPECT_GE函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TEST_F
TEST_F(PrintContextTest, LinkTargetSvg)
{
MockCanvas canvas;
setBodyInnerHTML("<svg width='100' height='100'>"
"<a xlink:href='http://www.w3.org'><rect x='20' y='20' width='50' height='50'/></a>"
"<text x='10' y='90'><a xlink:href='http://www.google.com'><tspan>google</tspan></a></text>"
"</svg>");
printSinglePage(canvas);
const Vector<MockCanvas::Operation>& operations = canvas.recordedOperations();
ASSERT_EQ(2u, operations.size());
EXPECT_EQ(MockCanvas::DrawRect, operations[0].type);
EXPECT_SKRECT_EQ(20, 20, 50, 50, operations[0].rect);
EXPECT_EQ(MockCanvas::DrawRect, operations[1].type);
EXPECT_EQ(10, operations[1].rect.x());
EXPECT_GE(90, operations[1].rect.y());
}
示例2: TEST_F
TEST_F(DlExtTest, ReservedHint) {
void* start = mmap(nullptr, LIBSIZE, PROT_NONE, MAP_PRIVATE | MAP_ANONYMOUS,
-1, 0);
ASSERT_TRUE(start != MAP_FAILED);
android_dlextinfo extinfo;
extinfo.flags = ANDROID_DLEXT_RESERVED_ADDRESS_HINT;
extinfo.reserved_addr = start;
extinfo.reserved_size = LIBSIZE;
handle_ = android_dlopen_ext(LIBNAME, RTLD_NOW, &extinfo);
ASSERT_DL_NOTNULL(handle_);
fn f = reinterpret_cast<fn>(dlsym(handle_, "getRandomNumber"));
ASSERT_DL_NOTNULL(f);
EXPECT_GE(f, start);
EXPECT_LT(reinterpret_cast<void*>(f),
reinterpret_cast<char*>(start) + LIBSIZE);
EXPECT_EQ(4, f());
}
示例3: TEST_F
TEST_F(StackTest, stressInsertion)
{
using us = std::chrono::microseconds;
using clock = std::chrono::high_resolution_clock;
const int qty = 1 << 20;
stack<int, qty> t;
auto start = clock::now();
for (auto i = 0; i < qty; ++i) {
t.push(i);
ASSERT_EQ(i, t.top());
}
auto duration = std::chrono::duration_cast<us>(clock::now() - start);
EXPECT_GE(100000, duration.count());
}
示例4: run
ErrorStack run(thread::Thread* context) {
start_rendezvous.wait();
assorted::UniformRandom rand;
rand.set_current_seed(client_id_);
Epoch highest_commit_epoch;
xct::XctManager* xct_manager = context->get_engine()->get_xct_manager();
xct::XctId prev_xct_id;
for (int i = 0; i < kXctsPerThread; ++i) {
uint64_t account_id;
if (contended) {
account_id = rand.next_uint32() % (kBranches * kAccounts);
} else {
const uint64_t accounts_per_thread = (kBranches * kAccounts / kMaxTestThreads);
account_id = rand.next_uint32() % accounts_per_thread
+ (client_id_ * accounts_per_thread);
}
uint64_t teller_id = account_id / kAccountsPerTellers;
uint64_t branch_id = account_id / kAccounts;
uint64_t history_id = client_id_ * kXctsPerThread + i;
int64_t amount = rand.uniform_within(kAmountRangeFrom, kAmountRangeTo);
EXPECT_GE(amount, kAmountRangeFrom);
EXPECT_LE(amount, kAmountRangeTo);
while (true) {
ErrorStack error_stack = try_transaction(context, &highest_commit_epoch,
branch_id, teller_id, account_id, history_id, amount);
if (!error_stack.is_error()) {
xct::XctId xct_id = context->get_current_xct().get_id();
if (prev_xct_id.get_epoch() == xct_id.get_epoch()) {
EXPECT_LT(prev_xct_id.get_ordinal(), xct_id.get_ordinal());
}
prev_xct_id = context->get_current_xct().get_id();
break;
} else if (error_stack.get_error_code() == kErrorCodeXctRaceAbort) {
// abort and retry
if (context->get_current_xct().is_active()) {
CHECK_ERROR(xct_manager->abort_xct(context));
}
} else {
COERCE_ERROR(error_stack);
}
}
}
CHECK_ERROR(xct_manager->wait_for_commit(highest_commit_epoch));
return foedus::kRetOk;
}
示例5: TEST
TEST(MonotoneCubicInterpolationTest, fitAkimaDataSet)
{
std::vector<double> x(11);
std::vector<double> y(11);
x[0] = 0;
y[0] = 10;
x[1] = 2;
y[1] = 10;
x[2] = 3;
y[2] = 10;
x[3] = 5;
y[3] = 10;
x[4] = 6;
y[4] = 10;
x[5] = 8;
y[5] = 10;
x[6] = 9;
y[6] = 10.5;
x[7] = 11;
y[7] = 15;
x[8] = 12;
y[8] = 50;
x[9] = 14;
y[9] = 60;
x[10] = 15;
y[10] = 85;
MonotoneCubicInterpolation interp(x, y);
EXPECT_NEAR(interp.sample(0.), 10., tol);
EXPECT_NEAR(interp.sample(2.), 10., tol);
EXPECT_NEAR(interp.sample(3.), 10., tol);
EXPECT_NEAR(interp.sample(5.), 10., tol);
EXPECT_NEAR(interp.sample(6.), 10., tol);
EXPECT_NEAR(interp.sample(8.), 10., tol);
EXPECT_NEAR(interp.sample(9.), 10.5, tol);
EXPECT_NEAR(interp.sample(11.), 15., tol);
EXPECT_NEAR(interp.sample(12.), 50., tol);
EXPECT_NEAR(interp.sample(14.), 60., tol);
EXPECT_NEAR(interp.sample(15.), 85., tol);
for (double z = 0; z <= 15.; z += .1)
EXPECT_GE(interp.sampleDerivative(z), -tol);
}
示例6: TYPED_TEST
TYPED_TEST(InnerProductLayerTest, TestCPU) {
LayerParameter layer_param;
Caffe::set_mode(Caffe::CPU);
layer_param.set_num_output(10);
layer_param.mutable_weight_filler()->set_type("uniform");
layer_param.mutable_bias_filler()->set_type("uniform");
layer_param.mutable_bias_filler()->set_min(1);
layer_param.mutable_bias_filler()->set_max(2);
shared_ptr<InnerProductLayer<TypeParam> > layer(
new InnerProductLayer<TypeParam>(layer_param));
layer->SetUp(this->blob_bottom_vec_, &(this->blob_top_vec_));
layer->Forward(this->blob_bottom_vec_, &(this->blob_top_vec_));
const TypeParam* data = this->blob_top_->cpu_data();
const int count = this->blob_top_->count();
for (int i = 0; i < count; ++i) {
EXPECT_GE(data[i], 1.);
}
}
示例7: fibonacciConst
///\brief This implements an algorithm for the calculation of the fibonacci number that has a
///linear runtime and a constant memory usage.
int fibonacciConst(int n)
{
#ifdef TEST_RUN
EXPECT_GE(n,0)<< "A negative value" << n << "was passed to fibonacciConst";
#endif
if (n<2)
return n;
int fib1=0;
int fib2=1;
int ret=0;
for (int i=2;i<n+1;i++)
{
ret=fib1+fib2;
fib1=fib2;
fib2=ret;
}
return ret;
}
示例8: TEST
TEST(ComediSysfs, CanReadMaxReadBuffer ) {
lsampl_t data;
int ret;
int subdev = 0;
int chan = 0;
int range = 0;
int aref = AREF_GROUND;
FILE *fp;
char buf[100];
int bufsize;
std::string sysfs_entry("/sys/class/comedi/comedi0/max_read_buffer_kb");
fp = fopen(sysfs_entry.c_str(),"r");
ASSERT_TRUE( fp ) << "Able to open file " << sysfs_entry << "\n";
fscanf(fp,"%d", &bufsize );
EXPECT_GE( bufsize, 0 );
comedi_close( dev );
}
示例9: TEST_F
TEST_F(ResourceOffersTest, ResourceOfferWithMultipleSlaves)
{
Try<Owned<cluster::Master>> master = StartMaster();
ASSERT_SOME(master);
Owned<MasterDetector> detector = master.get()->createDetector();
vector<Owned<cluster::Slave>> slaves;
// Start 10 slaves.
for (int i = 0; i < 10; i++) {
slave::Flags flags = CreateSlaveFlags();
flags.resources = Option<std::string>("cpus:2;mem:1024");
Try<Owned<cluster::Slave>> slave = StartSlave(detector.get(), flags);
ASSERT_SOME(slave);
slaves.push_back(slave.get());
}
MockScheduler sched;
MesosSchedulerDriver driver(
&sched, DEFAULT_FRAMEWORK_INFO, master.get()->pid, DEFAULT_CREDENTIAL);
EXPECT_CALL(sched, registered(&driver, _, _))
.Times(1);
Future<vector<Offer>> offers;
EXPECT_CALL(sched, resourceOffers(&driver, _))
.WillOnce(FutureArg<1>(&offers))
.WillRepeatedly(Return()); // All 10 slaves might not be in first offer.
driver.start();
AWAIT_READY(offers);
EXPECT_NE(0u, offers.get().size());
EXPECT_GE(10u, offers.get().size());
Resources resources(offers.get()[0].resources());
EXPECT_EQ(2, resources.get<Value::Scalar>("cpus").get().value());
EXPECT_EQ(1024, resources.get<Value::Scalar>("mem").get().value());
driver.stop();
driver.join();
}
示例10: TEST_F
TEST_F(RandomInterfaceTest, rand)
{
// Test range and distribution of xme_hal_random_rand()
const double safetyFactor = 2.0;
double sum = 0;
uint16_t minExpected = ((uint16_t)(numSamples / ((double)XME_HAL_RANDOM_RAND_MAX+1) / safetyFactor));
uint16_t maxExpected = ((uint16_t)(numSamples / ((double)XME_HAL_RANDOM_RAND_MAX+1) * safetyFactor));
for (uint64_t i = 0; i <= (double)numRounds*65536U; i++)
{
uint16_t r = xme_hal_random_rand();
// Prevent overflow
if (distribution[r] < 0xFFFF)
{
distribution[r]++;
}
sum += r;
}
printf("xme_hal_random_rand() test:\n");
printf("- Minimum expected value per bin: %d (should be >> 0 for the test to be effective)\n", minExpected);
printf("- Maximum expected value per bin: %d (must be <= 65535 for the test to be effective)\n", maxExpected);
for (uint64_t i = 0; i <= XME_HAL_RANDOM_RAND_MAX; i++)
{
// In a truly uniform distribution, each item would be incremented
// numSamples/(XME_HAL_RANDOM_RAND_MAX+1) times. These are safety bounds
// that should always be true, given a somehow uniform distribution.
EXPECT_GE(distribution[i], minExpected);
EXPECT_LE(distribution[i], maxExpected);
}
// Check whether mean over all random number
// is almost the mean of the interval
{
double mean = sum / (XME_HAL_RANDOM_RAND_MAX+1) / numSamples;
EXPECT_LT(0.499, mean);
EXPECT_LT(mean, 0.501);
}
}
示例11: TYPED_TEST
TYPED_TEST(StochasticPoolingLayerTest, TestStochasticGPU) {
Caffe::set_mode(Caffe::GPU);
Caffe::set_phase(Caffe::TRAIN);
LayerParameter layer_param;
PoolingParameter* pooling_param = layer_param.mutable_pooling_param();
pooling_param->set_kernel_size(3);
pooling_param->set_stride(2);
pooling_param->set_pool(PoolingParameter_PoolMethod_STOCHASTIC);
PoolingLayer<TypeParam> layer(layer_param);
layer.SetUp(this->blob_bottom_vec_, &(this->blob_top_vec_));
layer.Forward(this->blob_bottom_vec_, &(this->blob_top_vec_));
// Check if the output is correct - it should do random sampling
const TypeParam* bottom_data = this->blob_bottom_->cpu_data();
const TypeParam* top_data = this->blob_top_->cpu_data();
TypeParam total = 0;
for (int n = 0; n < this->blob_top_->num(); ++n) {
for (int c = 0; c < this->blob_top_->channels(); ++c) {
for (int ph = 0; ph < this->blob_top_->height(); ++ph) {
for (int pw = 0; pw < this->blob_top_->width(); ++pw) {
TypeParam pooled = top_data[this->blob_top_->offset(n, c, ph, pw)];
total += pooled;
int hstart = ph * 2;
int hend = min(hstart + 3, this->blob_bottom_->height());
int wstart = pw * 2;
int wend = min(wstart + 3, this->blob_bottom_->width());
bool has_equal = false;
for (int h = hstart; h < hend; ++h) {
for (int w = wstart; w < wend; ++w) {
has_equal |= (pooled == bottom_data[this->blob_bottom_->
offset(n, c, h, w)]);
}
}
EXPECT_TRUE(has_equal);
}
}
}
}
// When we are doing stochastic pooling, the average we get should be higher
// than the simple data average since we are weighting more on higher-valued
// ones.
EXPECT_GE(total / this->blob_top_->count(), 0.55);
}
示例12: doResize
void doResize(T& target, std::vector<bool>& valid, std::size_t newSize) {
auto oldSize = target.size();
auto before = validData(target, valid);
target.resize(newSize);
valid.resize(newSize);
for (auto i = oldSize; i < newSize; ++i) {
valid[i] = true;
}
auto after = validData(target, valid);
if (oldSize == newSize) {
EXPECT_EQ(before, after);
} else if (oldSize < newSize) {
EXPECT_LT(before.size(), after.size());
EXPECT_TRUE(std::equal(before.begin(), before.end(), after.begin()));
} else {
EXPECT_GE(before.size(), after.size());
EXPECT_TRUE(std::equal(after.begin(), after.end(), before.begin()));
}
}
示例13: TEST
TEST(ArrayBufferBuilderTest, Append)
{
const char data[] = "HelloWorld";
size_t dataSize = sizeof(data) - 1;
ArrayBufferBuilder builder(2 * dataSize);
EXPECT_EQ(dataSize, builder.append(data, dataSize));
EXPECT_EQ(dataSize, builder.byteLength());
EXPECT_EQ(dataSize * 2, builder.capacity());
EXPECT_EQ(dataSize, builder.append(data, dataSize));
EXPECT_EQ(dataSize * 2, builder.byteLength());
EXPECT_EQ(dataSize * 2, builder.capacity());
EXPECT_EQ(dataSize, builder.append(data, dataSize));
EXPECT_EQ(dataSize * 3, builder.byteLength());
EXPECT_GE(builder.capacity(), dataSize * 3);
}
示例14: TEST
// Test queue without concurrency.
TEST(ThreadSafePriorityQueue, Serial)
{
const U32 min = 0;
const U32 max = 9;
const U32 len = 11;
U32 indices[len] = { 2, 7, 4, 6, 1, 5, 3, 8, 6, 9, 0};
F32 priorities[len] = {0.2, 0.7, 0.4, 0.6, 0.1, 0.5, 0.3, 0.8, 0.6, 0.9, 0};
ThreadSafePriorityQueue<U32, F32, true> minQueue;
ThreadSafePriorityQueue<U32, F32, false> maxQueue;
for(U32 i = 0; i < len; i++)
{
minQueue.insert(priorities[i], indices[i]);
maxQueue.insert(priorities[i], indices[i]);
}
EXPECT_FALSE(minQueue.isEmpty());
EXPECT_FALSE(maxQueue.isEmpty());
U32 index = min;
for(U32 i = 0; i < len; i++)
{
U32 popped;
EXPECT_TRUE(minQueue.takeNext(popped))
<< "Failed to pop element from minQueue";
EXPECT_LE(index, popped)
<< "Element from minQueue was not in sort order";
index = popped;
}
index = max;
for(U32 i = 0; i < len; i++)
{
U32 popped;
EXPECT_TRUE(maxQueue.takeNext(popped))
<< "Failed to pop element from maxQueue";
EXPECT_GE(index, popped)
<< "Element from maxQueue was not in sort order";
index = popped;
}
}
示例15: hash
unsigned
hash(int h, bfpid_t const &pid)
{
if(debug) cout << "h=" << h << " pid=" << pid << endl;
EXPECT_GE(h, 0);
EXPECT_LT(h, (int) HASH_COUNT); // this cast is required to avoid "an unnamed type..." error in suncc
unsigned x = pid.vol();
if(debug) cout << " x= " << x << endl;
x ^= pid.page; // XOR doesn't do much, since
// most of the time the volume is the same for all pages
if(debug) cout << " x= " << x << endl;
EXPECT_LT(h, (int) HASH_COUNT);
unsigned retval = w_hashing::uhash::hash64(_hash_seeds[h], x);
if(debug) cout << " retval= " << retval << endl;
retval %= unsigned(_size);
if(debug) cout << " retval= " << retval << endl;
return retval;
}