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


C++ EXPECT_EQ函数代码示例

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


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

示例1: TEST_F

TEST_F(HookRegistrationTest, contextIsAccessibleInAfterHooks) {
    beginScenario(0);
    endScenario();
    EXPECT_EQ(CONTEXT_MARKER, contextContents);
}
开发者ID:AbdelghaniDr,项目名称:cucumber-cpp,代码行数:5,代码来源:HookRegistrationTest.cpp

示例2: TEST_F

TEST_F(TestFileFactory, Write)
{
    XFILE::CFile file, inputfile;
    std::string str;
    unsigned int size, i;
    unsigned char buf[16];
    int64_t count = 0;

    str = CXBMCTestUtils::Instance().getTestFileFactoryWriteInputFile();
    ASSERT_TRUE(inputfile.Open(str));

    std::vector<std::string> urls =
        CXBMCTestUtils::Instance().getTestFileFactoryWriteUrls();

    std::vector<std::string>::iterator it;
    for (it = urls.begin(); it < urls.end(); ++it)
    {
        std::cout << "Testing URL: " << *it << std::endl;
        std::cout << "Writing...";
        ASSERT_TRUE(file.OpenForWrite(*it, true));
        while ((size = inputfile.Read(buf, sizeof(buf))) > 0)
        {
            EXPECT_GE(file.Write(buf, size), 0);
        }
        file.Close();
        std::cout << "done." << std::endl;
        std::cout << "Reading..." << std::endl;
        ASSERT_TRUE(file.Open(*it));
        EXPECT_EQ(inputfile.GetLength(), file.GetLength());
        std::cout << "file.Seek(file.GetLength() / 2, SEEK_CUR) return value: " <<
                  testing::PrintToString(file.Seek(file.GetLength() / 2, SEEK_CUR)) << std::endl;
        std::cout << "file.Seek(0, SEEK_END) return value: " <<
                  testing::PrintToString(file.Seek(0, SEEK_END)) << std::endl;
        std::cout << "file.Seek(0, SEEK_SET) return value: " <<
                  testing::PrintToString(file.Seek(0, SEEK_SET)) << std::endl;
        std::cout << "File contents:\n";
        while ((size = file.Read(buf, sizeof(buf))) > 0)
        {
            str = StringUtils::Format("  %08lX", count);
            std::cout << str << "  ";
            count += size;
            for (i = 0; i < size; i++)
            {
                str = StringUtils::Format("%02X ", buf[i]);
                std::cout << str;
            }
            while (i++ < sizeof(buf))
                std::cout << "   ";
            std::cout << " [";
            for (i = 0; i < size; i++)
            {
                if (buf[i] >= ' ' && buf[i] <= '~')
                    std::cout << buf[i];
                else
                    std::cout << ".";
            }
            std::cout << "]" << std::endl;
        }
        file.Close();
    }
    inputfile.Close();
}
开发者ID:KeTao,项目名称:kodi-cmake,代码行数:62,代码来源:TestFileFactory.cpp

示例3: TEST

TEST(Utils, Config) {
    Config c("data/s3test.conf");
    EXPECT_EQ(c.Get("configtest", "config1", "aaaaaa"), "abcdefg");
    EXPECT_EQ(c.Get("configtest", "config2", "tttt"), "12345");
    EXPECT_EQ(c.Get("configtest", "config3", "tttt"), "aaaaa");
    EXPECT_EQ(c.Get("configtest", "config4", "tttt"), "123");
    EXPECT_EQ(c.Get("configtest", "config5", "tttt"), "tttt");
    EXPECT_EQ(c.Get("configtest", "config6", "tttt"), "tttt");
    EXPECT_EQ(c.Get("configtest", "config7", "xx"), "xx");

    EXPECT_EQ(c.Get("configtest", "", "xx"), "xx");
    EXPECT_EQ(c.Get("configtest", "config7", ""), "");

    EXPECT_EQ(c.Get("configtest", "", "xx"), "xx");

    uint64_t value = 0;
    EXPECT_TRUE(c.Scan("configtest", "config2", "%" PRIu64, &value));
    EXPECT_EQ((uint64_t)12345, value);

    EXPECT_TRUE(c.Scan("configtest", "config4", "%" PRIu64, &value));
    EXPECT_EQ((uint64_t)123, value);

    EXPECT_FALSE(c.Scan("configtest", "config7", "%" PRIu64, &value));
    EXPECT_FALSE(c.Scan("", "config7", "%" PRIu64, &value));
    EXPECT_FALSE(c.Scan("configtest", "", "%" PRIu64, &value));

    EXPECT_FALSE(c.Scan("configtest", "config5", "%" PRIu64, &value));

    char str[128];
    EXPECT_TRUE(c.Scan("configtest", "config3", "%s", str));
    EXPECT_STREQ(str, "aaaaa");
}
开发者ID:50wu,项目名称:gpdb,代码行数:32,代码来源:s3utils_test.cpp

示例4: TEST

TEST(Type, ToString) {
  EXPECT_EQ("Int", Type::Int.toString());
  EXPECT_EQ("Cell", Type::Cell.toString());
  EXPECT_EQ("BoxedDbl", Type::BoxedDbl.toString());
}
开发者ID:TingoZhou,项目名称:hiphop-php,代码行数:5,代码来源:type.cpp

示例5: TEST

TEST( regular_vector, usage )
{
    comma::regular_vector< double, int > v( 1.2, 0.5, 10 );
    v( 2.1 ) = 5;
    EXPECT_EQ( 5, v[ v.index( 2.1 ) ] );
}
开发者ID:sheenzhaox,项目名称:comma,代码行数:6,代码来源:vector_test.cpp

示例6: elementAtIndexMustBe

 void elementAtIndexMustBe(int index, T expected) {
   EXPECT_EQ(expected, (*_array)[index].as<T>());
 }
开发者ID:AugustoPujato,项目名称:ArduinoJson,代码行数:3,代码来源:JsonParser_Array_Tests.cpp

示例7: TEST_F

TEST_F(SubMakefileCreatorTest, setOutputter) {
	IOutputter* outputter = new OutputterMock();
	sut->setOutputter( outputter );

	EXPECT_EQ(outputter, sut->getOutputter());
}
开发者ID:yfurukawa,项目名称:classMaker,代码行数:6,代码来源:SubMakefileCreatorTest.cpp

示例8: TEST

TEST(CircleTests, CircumferenceTest) {
    Circle myCircle(3);
    EXPECT_EQ(6*M_PI,myCircle.getCircumference());
}
开发者ID:CleanCodeTutorium,项目名称:shapes,代码行数:4,代码来源:CircleTests.cpp

示例9: check_item

static inline void check_item (undo_handler &handler, int index, int value)
{
  undoable_stub *item = dynamic_cast<undoable_stub *>(handler.get_item (index));
  EXPECT_NE (nullptr, item);
  EXPECT_EQ (value, item->m_data);
}
开发者ID:telishev,项目名称:sneakPic,代码行数:6,代码来源:undo_handler_test.cpp

示例10: TEST_F

TEST_F(DBHandleTests, test_delete) {
  db->Put(kQueries, "test_delete", "baz");
  auto s = db->Delete(kQueries, "test_delete");
  EXPECT_TRUE(s.ok());
  EXPECT_EQ(s.toString(), "OK");
}
开发者ID:JessicaWhite17,项目名称:osquery,代码行数:6,代码来源:db_handle_tests.cpp

示例11: TEST_F

TEST_F(DepotTest, fire) {
    Depot depot(loc, entr, size, name, health);

    EXPECT_FALSE(depot.isBurning());

    EXPECT_DEATH(depot.burningDown(), "");	// ooops, depot is not on fire
    EXPECT_DEATH(depot.stopFire(), "");	// oops, depot is not on fire

    EXPECT_FALSE(depot.isDead());
    EXPECT_FALSE(depot.startSpreadingFire());
    EXPECT_FALSE(depot.startRepair());

    EXPECT_DEATH(depot.repair(), "");	// oops, Depot has still it's original health

    EXPECT_FALSE(depot.isFireTruckAssigned());
    EXPECT_DEATH(depot.assignFireTruck(), "");	// oops, the Depot is not on fire
    EXPECT_DEATH(depot.withdrawFireTruckAssignment(), "");	// oops, there is no firetruck assigned

    // okay, start the fire scenario
    EXPECT_NO_FATAL_FAILURE(depot.setFire());
    EXPECT_TRUE(depot.isBurning());
    EXPECT_NO_FATAL_FAILURE(depot.burningDown());
    EXPECT_EQ(health - reducer, depot.getHealth());
    EXPECT_FALSE(depot.isDead());
    EXPECT_FALSE(depot.startSpreadingFire());	// No, it has lost "only" 2 health points
    EXPECT_FALSE(depot.startRepair());

    EXPECT_DEATH(depot.repair(), "");	// oops, Depot is still on fire

    // let's send a firetruck
    EXPECT_NO_FATAL_FAILURE(depot.assignFireTruck());
    EXPECT_TRUE(depot.isFireTruckAssigned());

    // extinguish fire, repair and sendback firetruck
    EXPECT_DEATH(depot.withdrawFireTruckAssignment(), "");	// oops, Depot is still on fire

    EXPECT_NO_FATAL_FAILURE(depot.stopFire());
    EXPECT_FALSE(depot.isBurning());
    EXPECT_TRUE(depot.startRepair());
    EXPECT_NO_FATAL_FAILURE(depot.repair());
    EXPECT_EQ(health - reducer + 0.5, depot.getHealth());
    EXPECT_NO_FATAL_FAILURE(depot.withdrawFireTruckAssignment());
    EXPECT_FALSE(depot.isFireTruckAssigned());
    EXPECT_FALSE(depot.isDead());

    // fire breaks out again
    EXPECT_NO_FATAL_FAILURE(depot.setFire());
    EXPECT_TRUE(depot.isBurning());
    EXPECT_NO_FATAL_FAILURE(depot.burningDown());
    EXPECT_EQ(health - reducer + 0.5 - reducer, depot.getHealth());
    EXPECT_FALSE(depot.isDead());
    EXPECT_TRUE(depot.startSpreadingFire());

    // let them burning down 'till death
    EXPECT_NO_FATAL_FAILURE(depot.burningDown());
    EXPECT_TRUE(depot.isDead());
    EXPECT_EQ(health - reducer + 0.5 - reducer - reducer, depot.getHealth());

    // now, Depot is not on fire anymore
    EXPECT_FALSE(depot.isBurning());
    EXPECT_FALSE(depot.startRepair());	// you cannot repair a dead Depot
    EXPECT_FALSE(depot.startSpreadingFire());
}
开发者ID:rubenvanassche,项目名称:City-Simulator,代码行数:63,代码来源:Depot_test.cpp

示例12: TEST

TEST(NullIterator, HasZeroValues)
{
	auto it = Iterators::browseNothing<int>();
	EXPECT_EQ(countValues(it), 0);
}
开发者ID:vsv,项目名称:cpp-smart-iterators,代码行数:5,代码来源:test_null_iterator.cpp

示例13: parseMustFail

 void parseMustFail() {
   _array = &_jsonBuffer.parseArray(_jsonString);
   EXPECT_FALSE(_array->success());
   EXPECT_EQ(0, _array->size());
 }
开发者ID:AugustoPujato,项目名称:ArduinoJson,代码行数:5,代码来源:JsonParser_Array_Tests.cpp

示例14: TEST_F

TEST_F(TestArrayHandler, generateArray) {
  EXPECT_EQ(expected, actual) << "Expected and actual values are not the same";
}
开发者ID:lamtev,项目名称:travis_training,代码行数:3,代码来源:test2.cpp

示例15: TEST

  TEST(bodyPartTest, GetAndSetTest)
  {
    BodyPart bp1;
    int partID = 3;
    string partName = "Part Name";
    int parentJoint = 0;
    int childJoint = 0;
    bool isOccluded = false;
    float expectedDistance = 1.343f;
    POSERECT <Point2f> polygon(Point2f(1.0f, 2.0f), Point2f(2.0f, 3.0f), Point2f(3.0f, 4.0f), Point2f(4.0f, 5.0f));
    float lwRatio = 1.3f;
    float relativeLength = 0.6f;

    float searchRadius = 0.5f;
    float rotationSearchRange = 3.14f;

    bp1.setPartID(partID);
    bp1.setPartName(partName);
    bp1.setParentJoint(parentJoint);
    bp1.setChildJoint(childJoint);
    bp1.setIsOccluded(isOccluded);
    bp1.setExpectedDistance(expectedDistance);
    bp1.setPartPolygon(polygon);
    bp1.setLWRatio(lwRatio);
    bp1.setRelativeLength(relativeLength);
    bp1.setSearchRadius(searchRadius);
    bp1.setRotationSearchRange(rotationSearchRange);


    EXPECT_EQ(partID, bp1.getPartID());
    EXPECT_EQ(partName, bp1.getPartName());
    EXPECT_EQ(parentJoint, bp1.getParentJoint());
    EXPECT_EQ(childJoint, bp1.getChildJoint());
    EXPECT_EQ(isOccluded, bp1.getIsOccluded());
    EXPECT_EQ(expectedDistance, bp1.getExpectedDistance());
    EXPECT_EQ(polygon, bp1.getPartPolygon());
    EXPECT_EQ(lwRatio, bp1.getLWRatio());
    EXPECT_EQ(relativeLength, bp1.getRelativeLength());
    EXPECT_EQ(searchRadius, bp1.getSearchRadius());
    EXPECT_EQ(rotationSearchRange, bp1.getRotationSearchRange());
  }
开发者ID:spelteam,项目名称:spel,代码行数:41,代码来源:bodyPart_get_and_set_tests.cpp


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