这篇教程C++ ASSERT_DOUBLE_EQ函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ASSERT_DOUBLE_EQ函数的典型用法代码示例。如果您正苦于以下问题:C++ ASSERT_DOUBLE_EQ函数的具体用法?C++ ASSERT_DOUBLE_EQ怎么用?C++ ASSERT_DOUBLE_EQ使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ASSERT_DOUBLE_EQ函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: TESTTEST(math, hypotl) { ASSERT_DOUBLE_EQ(5.0L, hypotl(3.0L, 4.0L));}
开发者ID:316181444,项目名称:platform_bionic,代码行数:3,
示例2: TESTTEST(ParticleCUDA, Random) { rand2_seed(1080); ASSERT_DOUBLE_EQ(rand2(), 0.6554163483485531); ASSERT_DOUBLE_EQ(rand2(), 0.2009951854518572); ASSERT_DOUBLE_EQ(rand2(), 0.8936223876466522); ASSERT_DOUBLE_EQ(rand2(), 0.2818865431288053); ASSERT_DOUBLE_EQ(rand2(), 0.5250003829714993); ASSERT_DOUBLE_EQ(rand2(), 0.3141267749950177); ASSERT_DOUBLE_EQ(rand2(), 0.4446156782993733); ASSERT_DOUBLE_EQ(rand2(), 0.2994744556282315); ASSERT_DOUBLE_EQ(rand2(), 0.4712494933308135); ASSERT_DOUBLE_EQ(rand2(), 0.5913675200502571); rand2_seed(1080); ASSERT_DOUBLE_EQ(rand2(), 0.6554163483485531); ASSERT_DOUBLE_EQ(rand2(), 0.2009951854518572); ASSERT_DOUBLE_EQ(rand2(), 0.8936223876466522); ASSERT_DOUBLE_EQ(rand2(), 0.2818865431288053); ASSERT_DOUBLE_EQ(rand2(), 0.5250003829714993); ASSERT_DOUBLE_EQ(rand2(), 0.3141267749950177); ASSERT_DOUBLE_EQ(rand2(), 0.4446156782993733); ASSERT_DOUBLE_EQ(rand2(), 0.2994744556282315); ASSERT_DOUBLE_EQ(rand2(), 0.4712494933308135); ASSERT_DOUBLE_EQ(rand2(), 0.5913675200502571);}
开发者ID:Omegaice,项目名称:LES-GPU,代码行数:25,
示例3: TEST_FTEST_F(RectangleTest, rectangleSize) { ASSERT_EQ(myRectangle->getHeight(), 3); ASSERT_EQ(myRectangle->getWidth(), 4); ASSERT_EQ(myRectangle->getRadius(), 0); ASSERT_DOUBLE_EQ(myRectangle->getArea(), 12);}
开发者ID:gi-tux,项目名称:CppExamples,代码行数:6,
示例4: TESTTEST(Circle, Length){ ASSERT_DOUBLE_EQ(Circle(Point(1,2),3).length(), 3. * 2 * M_PI );};
开发者ID:Interiya,项目名称:Lines,代码行数:3,
示例5: TEST_FTEST_F(test_move, independents_gradmanual){ independent_variables independents(1, 2); independents(1) = 1.5; independents(2) = 3.5; gradient_structure gs; ASSERT_EQ(0, gradient_structure::GRAD_STACK1->total()); ASSERT_EQ(1750, gradient_structure::GRAD_LIST->total_addresses()); dvar_vector variables(independents); auto sum = [&variables]() { dvariable a(variables(1)); dvariable b(variables(2)); return a + b; }; dvariable result = sum(); ASSERT_EQ(4, gradient_structure::GRAD_STACK1->total()); ASSERT_EQ(1752, gradient_structure::GRAD_LIST->total_addresses()); ASSERT_DOUBLE_EQ(value(result), 5.0); --gradient_structure::GRAD_STACK1->ptr; double_and_int* ptr = (double_and_int*)gradient_structure::get_ARRAY_MEMBLOCK_BASE(); unsigned long int imax = gradient_structure::ARR_LIST1->get_max_last_offset() / sizeof(double_and_int); for (unsigned int i = 0; i < imax; ++i) { ptr->x = 0.0; ++ptr; } gradient_structure::GRAD_LIST->initialize(); *gradient_structure::GRAD_STACK1->ptr->dep_addr = 1.0; //Sum ASSERT_DOUBLE_EQ(*(gradient_structure::GRAD_STACK1->ptr->dep_addr), 1.0); ASSERT_DOUBLE_EQ(*(gradient_structure::GRAD_STACK1->ptr->ind_addr1), 0.0); (*(gradient_structure::GRAD_STACK1->ptr->func))(); ASSERT_DOUBLE_EQ(*(gradient_structure::GRAD_STACK1->ptr->dep_addr), 0.0); ASSERT_DOUBLE_EQ(*(gradient_structure::GRAD_STACK1->ptr->ind_addr1), 1.0); ASSERT_TRUE(gradient_structure::GRAD_STACK1->ptr->ind_addr2 == NULL); ASSERT_DOUBLE_EQ(gradient_structure::GRAD_STACK1->ptr->mult1, 0.0); ASSERT_DOUBLE_EQ(gradient_structure::GRAD_STACK1->ptr->mult2, 0.0); //Addition --gradient_structure::GRAD_STACK1->ptr; ASSERT_DOUBLE_EQ(*(gradient_structure::GRAD_STACK1->ptr->dep_addr), 1.0); ASSERT_DOUBLE_EQ(*(gradient_structure::GRAD_STACK1->ptr->ind_addr1), 0.0); ASSERT_DOUBLE_EQ(*(gradient_structure::GRAD_STACK1->ptr->ind_addr2), 0.0); (*(gradient_structure::GRAD_STACK1->ptr->func))(); ASSERT_DOUBLE_EQ(*(gradient_structure::GRAD_STACK1->ptr->dep_addr), 0.0); ASSERT_DOUBLE_EQ(*(gradient_structure::GRAD_STACK1->ptr->ind_addr1), 1.0); ASSERT_DOUBLE_EQ(*(gradient_structure::GRAD_STACK1->ptr->ind_addr2), 1.0); ASSERT_DOUBLE_EQ(gradient_structure::GRAD_STACK1->ptr->mult1, 0.0); ASSERT_DOUBLE_EQ(gradient_structure::GRAD_STACK1->ptr->mult2, 0.0); //Constructor --gradient_structure::GRAD_STACK1->ptr; ASSERT_DOUBLE_EQ(*(gradient_structure::GRAD_STACK1->ptr->dep_addr), 1.0); ASSERT_DOUBLE_EQ(*(gradient_structure::GRAD_STACK1->ptr->ind_addr1), 0.0); (*(gradient_structure::GRAD_STACK1->ptr->func))(); ASSERT_DOUBLE_EQ(*(gradient_structure::GRAD_STACK1->ptr->dep_addr), 0.0); ASSERT_DOUBLE_EQ(*(gradient_structure::GRAD_STACK1->ptr->ind_addr1), 1.0); ASSERT_TRUE(gradient_structure::GRAD_STACK1->ptr->ind_addr2 == NULL); ASSERT_DOUBLE_EQ(gradient_structure::GRAD_STACK1->ptr->mult1, 0.0); ASSERT_DOUBLE_EQ(gradient_structure::GRAD_STACK1->ptr->mult2, 0.0); //Constructor --gradient_structure::GRAD_STACK1->ptr; ASSERT_DOUBLE_EQ(*(gradient_structure::GRAD_STACK1->ptr->dep_addr), 1.0); ASSERT_DOUBLE_EQ(*(gradient_structure::GRAD_STACK1->ptr->ind_addr1), 0.0); (*(gradient_structure::GRAD_STACK1->ptr->func))(); ASSERT_DOUBLE_EQ(*(gradient_structure::GRAD_STACK1->ptr->dep_addr), 0.0); ASSERT_DOUBLE_EQ(*(gradient_structure::GRAD_STACK1->ptr->ind_addr1), 1.0); ASSERT_TRUE(gradient_structure::GRAD_STACK1->ptr->ind_addr2 == NULL); ASSERT_DOUBLE_EQ(gradient_structure::GRAD_STACK1->ptr->mult1, 0.0); ASSERT_DOUBLE_EQ(gradient_structure::GRAD_STACK1->ptr->mult2, 0.0); //ASSERT_DOUBLE_EQ(*gradient_structure::INDVAR_LIST->get_address(1), 0.0); //ASSERT_DOUBLE_EQ(*gradient_structure::INDVAR_LIST->get_address(2), 0.0); ASSERT_DOUBLE_EQ(value(variables(1)), 1.0); ASSERT_DOUBLE_EQ(value(variables(2)), 1.0);}
开发者ID:colemonnahan,项目名称:admb,代码行数:87,
示例6: TESTTEST(stdlib, atof) { ASSERT_DOUBLE_EQ(1.23, atof("1.23"));}
开发者ID:happyroom99,项目名称:platform_bionic,代码行数:3,
示例7: testBSplineSetBasicint testBSplineSetBasic() { PrintTimeStamp(PETSC_COMM_SELF, "set basics", NULL); MPI_Comm comm = PETSC_COMM_SELF; BPS bps; BPSCreate(comm, &bps); BPSSetLine(bps, 5.0, 6); int order = 3; BSS bss; BSSCreate(comm, &bss); BSSSetKnots(bss, order, bps); BSSSetUp(bss); ASSERT_EQ(order, bss->order); ASSERT_EQ(5, bss->num_ele); ASSERT_EQ(5, bss->num_basis); ASSERT_EQ(1, bss->b_idx_list[0]); ASSERT_EQ(2, bss->b_idx_list[1]); ASSERT_EQ(4, bss->b_idx_list[3]); PetscReal *zs; BPSGetZs(bps, &zs, NULL); for(int i = 0; i < 6; i++) ASSERT_DOUBLE_EQ(1.0*i, zs[i]); PetscFree(zs); ASSERT_DOUBLE_EQ(0.0, bss->ts_r[0]); ASSERT_DOUBLE_EQ(0.0, bss->ts_r[1]); ASSERT_DOUBLE_EQ(0.0, bss->ts_r[2]); ASSERT_DOUBLE_EQ(1.0, bss->ts_r[3]); ASSERT_DOUBLE_EQ(2.0, bss->ts_r[4]); ASSERT_DOUBLE_EQ(3.0, bss->ts_r[5]); ASSERT_DOUBLE_EQ(4.0, bss->ts_r[6]); ASSERT_DOUBLE_EQ(5.0, bss->ts_r[7]); ASSERT_DOUBLE_EQ(5.0, bss->ts_r[8]); ASSERT_DOUBLE_EQ(5.0, bss->ts_r[9]); double x = 0.34; PetscScalar y1; BSSBasisPsi(bss, 2-1, x, &y1); ASSERT_DOUBLE_EQ(0.5*x*x, PetscRealPart(y1)); ASSERT_DOUBLE_NEAR(0.11270167, bss->xs[0], pow(10.0, -8.0)); ASSERT_DOUBLE_NEAR(0.5, bss->xs[1], pow(10.0, -8.0)); ASSERT_DOUBLE_NEAR(0.88729833, bss->xs[2], pow(10.0, -8.0)); ASSERT_DOUBLE_NEAR(0.2777777777777, bss->ws[0], pow(10.0, -8.0)); ASSERT_DOUBLE_NEAR(0.4444444444444, bss->ws[1], pow(10.0, -8.0)); ASSERT_DOUBLE_NEAR(0.2777777777777, bss->ws[14], pow(10.0, -8.0)); ASSERT_DOUBLE_NEAR(0.20635083, bss->vals[0], pow(10.0, -8.0)); ASSERT_DOUBLE_EQ(0.625, bss->vals[1]); ASSERT_DOUBLE_EQ(0.0, bss->vals[10]); ASSERT_DOUBLE_EQ(0.125, bss->vals[15*2+4]); ASSERT_DOUBLE_NEAR(1.66189500386, bss->derivs[0], pow(10.0, -8.0)); ASSERT_DOUBLE_NEAR(-0.5 , bss->derivs[4], pow(10.0, -8.0)); ASSERT_DOUBLE_NEAR(-0.887298334621, bss->derivs[21],pow(10.0, -8.0)); BSSDestroy(&bss); return 0;}
开发者ID:ReiMatsuzaki,项目名称:rescol,代码行数:59,
示例8: TEST_FTEST_F(TestVariant, MinLimitReal){ vmf::vmf_real limitReal = vmf::Variant::minLimit<vmf::vmf_real>(vmf::Variant::type_real); ASSERT_DOUBLE_EQ(limitReal, std::numeric_limits<vmf::vmf_real>::lowest());}
开发者ID:SSE4,项目名称:vmf-1,代码行数:5,
示例9: TESTTEST(wchar, wcstold) { ASSERT_DOUBLE_EQ(1.23L, wcstold(L"1.23", NULL));}
开发者ID:happyroom99,项目名称:platform_bionic,代码行数:3,
示例10: TESTTEST(ByteStreamTest, testRandomReadWrite) { ByteStream byteStream; srandom(SDL_GetTicks()); TypeValueList _typeValueList; TypeValueListIter _typeValueListIter; unsigned int iterations = random() % 20 + 1; unsigned int index = 0; size_t size = 0; //add random types to byte stream do { DataType dataType = DataType(random() % count); TypeValue typeValue; typeValue.type = dataType; switch (dataType) { case e_byte: { uint8_t* byte = new uint8_t(random() % BYTE_ADD); byteStream.addByte(*byte); typeValue.pValue = byte; size += 1; break; } case e_short: { int16_t* word = new int16_t(random() % SHORT_ADD); byteStream.addShort(*word); typeValue.pValue = word; size += 2; break; } case e_int: { int32_t* dword = new int32_t(random() % INT_ADD); byteStream.addInt(*dword); typeValue.pValue = dword; size += 4; break; } case e_float: { float* dword = new float( floorf((random() % INT_ADD) / float(INT_ADD) * 100.0) / 100.0); byteStream.addFloat(*dword); typeValue.pValue = dword; size += 4; break; } case e_string: { std::string* str = new std::string("hello IT!"); byteStream.addString(*str); typeValue.pValue = str; size += str->length() + 1; //plus the '/0' char break; } default: ASSERT_TRUE(false); break; } _typeValueList.push_back(typeValue); } while (index++ < iterations); ASSERT_EQ(byteStream.getSize(), size); //read and verify added types in byte stream index = 0; do { DataType dataType = _typeValueList.front().type; void* value = _typeValueList.front().pValue; switch (dataType) { case e_byte: { uint8_t byte = byteStream.readByte(); size -= 1; ASSERT_EQ(byte, *(uint8_t* ) value); delete (uint8_t*) value; break; } case e_short: { int16_t word = byteStream.readShort(); size -= 2; ASSERT_EQ(word, *(int16_t* ) value); delete (int16_t*) value; break; } case e_int: { int32_t dword = byteStream.readInt(); size -= 4; ASSERT_EQ(dword, *(int32_t* ) value); delete (int32_t*) value; break; } case e_float: { float dword = byteStream.readFloat(); size -= 4; ASSERT_DOUBLE_EQ(dword, *(float* ) value); delete (float*) value; break; } case e_string: { std::string str = byteStream.readString(); size -= str.length() + 1; //plus the '/0' char ASSERT_EQ(str, *(std::string* ) value);//.........这里部分代码省略.........
开发者ID:RobertoMalatesta,项目名称:caveexpress,代码行数:101,
注:本文中的ASSERT_DOUBLE_EQ函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ASSERT_EFI_ERROR函数代码示例 C++ ASSERT_DEBUG函数代码示例 |