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


C++ DOUBLES_EQUAL函数代码示例

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


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

示例1: TEST

TEST(MatrixTest, should_multiply_correctly) {
    float as[6] = {
        0, 1, 2, 
        3, 4, 5
    };
    Matrix *a = new Matrix(2, 3, as);
    float bs[6] = {
        -1, -2, 
        3, 4, 
        5, 6
    };
    Matrix *b = new Matrix(3, 2, bs);

    Matrix c = a[0] * b[0];

    CHECK_EQUAL(2, c.getRows());
    CHECK_EQUAL(2, c.getCols());

    DOUBLES_EQUAL(13.0f, c.getCell(0, 0), 0.001);
    DOUBLES_EQUAL(16.0f, c.getCell(0, 1), 0.001);
    DOUBLES_EQUAL((float)(-3+12+25), c.getCell(1, 0), 0.001);
    DOUBLES_EQUAL((float)(-6+16+30), c.getCell(1, 1), 0.001);
    delete a;
    delete b;
}
开发者ID:sondrele,项目名称:NTNU,代码行数:25,代码来源:matrix_test.cpp

示例2: TEST

TEST(RTMaterial, shouldSupportAddition) {

  RTMaterial m1;
  m1.setKTransparency(0.1);
  m1.setShininess(0.2);
  m1.setDiffColor(RTColor(0,0.1,0.2));
  m1.setSpecColor(RTColor(0,0.1,0.2));
  m1.setAmbColor(RTColor(0,0.1,0.2));
  m1.setEmissColor(RTColor(0,0.1,0.2));

  RTMaterial m2;
  m2.setKTransparency(0.3);
  m2.setShininess(0.2);
  m2.setDiffColor(RTColor(0,0.1,0.2));
  m2.setSpecColor(RTColor(0,0.1,0.2));
  m2.setAmbColor(RTColor(0,0.1,0.2));
  m2.setEmissColor(RTColor(0,0.1,0.2));

  m1 += m2;

  DOUBLES_EQUAL( 0.4, m1.getKTransparency(), 0.00001 );
  DOUBLES_EQUAL( 0.4, m1.getShininess(), 0.00001 );
  COLOR_EQUAL(0, 51, 102, m1.getDiffColor() );
  COLOR_EQUAL(0, 51, 102, m1.getSpecColor() );
  COLOR_EQUAL(0, 51, 102, m1.getAmbColor() );
  COLOR_EQUAL(0, 51, 102, m1.getEmissColor() );
}
开发者ID:havardh,项目名称:ECE594Q,代码行数:27,代码来源:RTMaterialTest.cpp

示例3: set_test_name

void TestRegistry::test<1>()
{
    set_test_name("Determinant (2x2 matrix)");

    m2f[0] = 1.0f; m2f[2] = 3.0f;
    m2f[1] = 2.0f; m2f[3] = 4.0f;

    result = jship::Hazmat::Determinant(m2f);
    
    DOUBLES_EQUAL(m2f[0], 1.0, 1e-5);
    DOUBLES_EQUAL(m2f[1], 2.0, 1e-5);
    DOUBLES_EQUAL(m2f[2], 3.0, 1e-5);
    DOUBLES_EQUAL(m2f[3], 4.0, 1e-5);
    
    DOUBLES_EQUAL(result, -2.0, 1e-5);
    
    m2f[0] =  1.0f; m2f[2] =  2.0f;
    m2f[1] = -3.0f; m2f[3] =  1.0f;
    
    result = jship::Hazmat::Determinant(m2f);
    
    DOUBLES_EQUAL(m2f[0],  1.0, 1e-5);
    DOUBLES_EQUAL(m2f[1], -3.0, 1e-5);
    DOUBLES_EQUAL(m2f[2],  2.0, 1e-5);
    DOUBLES_EQUAL(m2f[3],  1.0, 1e-5);

    DOUBLES_EQUAL(result, 7.0, 1e-5);
}
开发者ID:jship,项目名称:Hazmat,代码行数:28,代码来源:TestDeterminant.cpp

示例4: TEST

TEST(MS4525DO, pressure_conversion_absolute_type_A)
{
    ms4525do_init(&d, &i2c, 'A', 'I', 2, 'A');
    DOUBLES_EQUAL(0, ms4525do_pressure_raw_to_Pa(&d, 1638), 1); // values from datasheet table
    DOUBLES_EQUAL(1*PSI, ms4525do_pressure_raw_to_Pa(&d, 8192), 1);
    DOUBLES_EQUAL(2*PSI, ms4525do_pressure_raw_to_Pa(&d, 14746), 3);
}
开发者ID:Stapelzeiger,项目名称:sensor-drivers,代码行数:7,代码来源:test_ms4525do.cpp

示例5: TEST

TEST(MockSupport_c, whenNoReturnValueIsGivenReturnDoubleValueOrDefaultShouldlUseTheDefaultValue)
{
    double defaultValue = 2.2;
    mock_c()->expectOneCall("foo");
    DOUBLES_EQUAL(defaultValue, mock_c()->actualCall("foo")->returnDoubleValueOrDefault(defaultValue), 0.005);
    DOUBLES_EQUAL(defaultValue, mock_c()->returnDoubleValueOrDefault(defaultValue), 0.005);
}
开发者ID:DynonAvionics,项目名称:cpputest,代码行数:7,代码来源:MockSupport_cTest.cpp

示例6: TEST

TEST(PositioningTestGroup, OutputParamIsNULL)
{
    position_t p_a = {POINT_A_X, POINT_A_Y};
    position_t p_b = {POINT_B_X, POINT_B_Y};
    position_t p_c = {POINT_C_X, POINT_C_Y};

    reference_triangle_t t = {NULL, NULL, NULL, 0, 0, 0};

    positioning_reference_triangle_from_points(&p_a, &p_b, &p_c, &t);

    position_t some_point = {1.0f, 1.0f};

    Angles angles = Vec2D(&some_point).angles_relative_to_triangle(&t);

    position_t result = {0, 0};

    bool valid = positioning_from_angles(
            angles.alpha,
            angles.beta,
            angles.gamma,
            &t,
            NULL);
    CHECK(!valid);
    DOUBLES_EQUAL(0.0, result.x, 0.0001);
    DOUBLES_EQUAL(0.0, result.y, 0.0001);
}
开发者ID:31415us,项目名称:beacons,代码行数:26,代码来源:positioning_test.cpp

示例7: TEST

TEST(RayTracer, can_compute_point) {
    RayTracer r(30, 20, Vect(0, 0, -1), Vect(0, 1, 0));

    Point_2D pt = r.computePoint(10, 5);
    DOUBLES_EQUAL(0.35, pt.x, 0.00001);
    DOUBLES_EQUAL(0.275, pt.y, 0.00001);
}
开发者ID:sondrele,项目名称:NTNU,代码行数:7,代码来源:raytracer_test.cpp

示例8: TEST

TEST(Matrix, shouldHaveFourComponentVectorConstructor) {

  Matrix m(1, 2, 3, 4);
  
  DOUBLES_EQUAL(1.0, m.get(0), 0.0001);
  DOUBLES_EQUAL(2.0, m.get(1), 0.0001);
  DOUBLES_EQUAL(3.0, m.get(2), 0.0001);
  DOUBLES_EQUAL(4.0, m.get(3), 0.0001);
}
开发者ID:havardh,项目名称:ECE594Q,代码行数:9,代码来源:MatrixTest.cpp

示例9: TEST

TEST(Mesh, shouldComputeBoundingBox) {


	Mesh *m = new MeshMock(values, 2, 2);

  BoundingBox box = m->getBoundingBox();

  DOUBLES_EQUAL(-1, box.getX(), 0.0001);
  DOUBLES_EQUAL(-3, box.getY(), 0.0001);
  DOUBLES_EQUAL(3, box.getDX(), 0.0001);
  DOUBLES_EQUAL(5, box.getDY(), 0.0001);

  delete m;
}
开发者ID:havardh,项目名称:ECE594Q,代码行数:14,代码来源:MeshTest.cpp

示例10: functionThatReturnsAValue

static int functionThatReturnsAValue()
{
    CHECK(0 == 0);
    CHECK_TEXT(0 == 0, "Shouldn't fail");
    CHECK_TRUE(0 == 0);
    CHECK_TRUE_TEXT(0 == 0, "Shouldn't fail");
    CHECK_FALSE(0 != 0);
    CHECK_FALSE_TEXT(0 != 0, "Shouldn't fail");
    LONGS_EQUAL(1,1);
    LONGS_EQUAL_TEXT(1, 1, "Shouldn't fail");
    BYTES_EQUAL(0xab,0xab);
    BYTES_EQUAL_TEXT(0xab, 0xab, "Shouldn't fail");
    CHECK_EQUAL(100,100);
    CHECK_EQUAL_TEXT(100, 100, "Shouldn't fail");
    STRCMP_EQUAL("THIS", "THIS");
    STRCMP_EQUAL_TEXT("THIS", "THIS", "Shouldn't fail");
    DOUBLES_EQUAL(1.0, 1.0, .01);
    DOUBLES_EQUAL_TEXT(1.0, 1.0, .01, "Shouldn't fail");
    POINTERS_EQUAL(0, 0);
    POINTERS_EQUAL_TEXT(0, 0, "Shouldn't fail");
    MEMCMP_EQUAL("THIS", "THIS", 5);
    MEMCMP_EQUAL_TEXT("THIS", "THIS", 5, "Shouldn't fail");
    BITS_EQUAL(0x01, (unsigned char )0x01, 0xFF);
    BITS_EQUAL(0x0001, (unsigned short )0x0001, 0xFFFF);
    BITS_EQUAL(0x00000001, (unsigned long )0x00000001, 0xFFFFFFFF);
    BITS_EQUAL_TEXT(0x01, (unsigned char )0x01, 0xFF, "Shouldn't fail");
    return 0;
}
开发者ID:Andne,项目名称:cpputest,代码行数:28,代码来源:TestUTestMacro.cpp

示例11: TEST

TEST(Vector, shouldComputeLength) {

  Vector v( 3, 3, 2 );

  DOUBLES_EQUAL( 4.69041576, v.length(), 0.0001 );
  
}
开发者ID:havardh,项目名称:ECE594Q,代码行数:7,代码来源:VectorTest.cpp


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