您当前的位置:首页 > IT编程 > C++
| C语言 | Java | VB | VC | python | Android | TensorFlow | C++ | oracle | 学术与代码 | cnn卷积神经网络 | gnn | 图像修复 | Keras | 数据集 | Neo4j | 自然语言处理 | 深度学习 | 医学CAD | 医学影像 | 超参数 | pointnet | pytorch | 异常检测 | Transformers | 情感分类 | 知识图谱 |

自学教程:C++ EXPECT_STREQ函数代码示例

51自学网 2021-06-01 20:36:17
  C++
这篇教程C++ EXPECT_STREQ函数代码示例写得很实用,希望能帮到您。

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

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

示例1: TEST

TEST(stdio, snprintf_smoke) {  char buf[BUFSIZ];  snprintf(buf, sizeof(buf), "a");  EXPECT_STREQ("a", buf);  snprintf(buf, sizeof(buf), "%%");  EXPECT_STREQ("%", buf);  snprintf(buf, sizeof(buf), "01234");  EXPECT_STREQ("01234", buf);  snprintf(buf, sizeof(buf), "a%sb", "01234");  EXPECT_STREQ("a01234b", buf);  char* s = NULL;  snprintf(buf, sizeof(buf), "a%sb", s);  EXPECT_STREQ("a(null)b", buf);  snprintf(buf, sizeof(buf), "aa%scc", "bb");  EXPECT_STREQ("aabbcc", buf);  snprintf(buf, sizeof(buf), "a%cc", 'b');  EXPECT_STREQ("abc", buf);  snprintf(buf, sizeof(buf), "a%db", 1234);  EXPECT_STREQ("a1234b", buf);  snprintf(buf, sizeof(buf), "a%db", -8123);  EXPECT_STREQ("a-8123b", buf);  snprintf(buf, sizeof(buf), "a%hdb", static_cast<short>(0x7fff0010));  EXPECT_STREQ("a16b", buf);  snprintf(buf, sizeof(buf), "a%hhdb", static_cast<char>(0x7fffff10));  EXPECT_STREQ("a16b", buf);  snprintf(buf, sizeof(buf), "a%lldb", 0x1000000000LL);  EXPECT_STREQ("a68719476736b", buf);  snprintf(buf, sizeof(buf), "a%ldb", 70000L);  EXPECT_STREQ("a70000b", buf);  snprintf(buf, sizeof(buf), "a%pb", reinterpret_cast<void*>(0xb0001234));  EXPECT_STREQ("a0xb0001234b", buf);  snprintf(buf, sizeof(buf), "a%xz", 0x12ab);  EXPECT_STREQ("a12abz", buf);  snprintf(buf, sizeof(buf), "a%Xz", 0x12ab);  EXPECT_STREQ("a12ABz", buf);  snprintf(buf, sizeof(buf), "a%08xz", 0x123456);  EXPECT_STREQ("a00123456z", buf);  snprintf(buf, sizeof(buf), "a%5dz", 1234);  EXPECT_STREQ("a 1234z", buf);  snprintf(buf, sizeof(buf), "a%05dz", 1234);  EXPECT_STREQ("a01234z", buf);  snprintf(buf, sizeof(buf), "a%8dz", 1234);  EXPECT_STREQ("a    1234z", buf);  snprintf(buf, sizeof(buf), "a%-8dz", 1234);  EXPECT_STREQ("a1234    z", buf);  snprintf(buf, sizeof(buf), "A%-11sZ", "abcdef");  EXPECT_STREQ("Aabcdef     Z", buf);  snprintf(buf, sizeof(buf), "A%s:%dZ", "hello", 1234);  EXPECT_STREQ("Ahello:1234Z", buf);  snprintf(buf, sizeof(buf), "a%03d:%d:%02dz", 5, 5, 5);  EXPECT_STREQ("a005:5:05z", buf);  void* p = NULL;  snprintf(buf, sizeof(buf), "a%d,%pz", 5, p);#if defined(__BIONIC__)  EXPECT_STREQ("a5,0x0z", buf);#else // __BIONIC__  EXPECT_STREQ("a5,(nil)z", buf);#endif // __BIONIC__  snprintf(buf, sizeof(buf), "a%lld,%d,%d,%dz", 0x1000000000LL, 6, 7, 8);  EXPECT_STREQ("a68719476736,6,7,8z", buf);  snprintf(buf, sizeof(buf), "a_%f_b", 1.23f);  EXPECT_STREQ("a_1.230000_b", buf);  snprintf(buf, sizeof(buf), "a_%g_b", 3.14);  EXPECT_STREQ("a_3.14_b", buf);  snprintf(buf, sizeof(buf), "%1$s %1$s", "print_me_twice");  EXPECT_STREQ("print_me_twice print_me_twice", buf);}
开发者ID:Bruce-Zou,项目名称:android-actions,代码行数:96,


示例2: GetGitRevRefMap

static void GetGitRevRefMap(){	g_Git.SetConfigValue(L"branch.master.description", L"test");	g_Git.SetConfigValue(L"branch.subdir/branch.description", L"multi/nline");	MAP_REF_GITREVREFBROWSER refMap;	CString err;	EXPECT_EQ(0, GitRevRefBrowser::GetGitRevRefMap(refMap, 0, err));	EXPECT_STREQ(L"", err);	EXPECT_EQ(12U, refMap.size());	GitRevRefBrowser rev = refMap[L"refs/heads/master"];	EXPECT_STREQ(L"7c3cbfe13a929d2291a574dca45e4fd2d2ac1aa6", rev.m_CommitHash.ToString());	EXPECT_STREQ(L"Sven Strickroth", rev.GetAuthorName());	EXPECT_STREQ(L"2015-03-07 18:03:58", rev.GetAuthorDate().FormatGmt(L"%Y-%m-%d %H:%M:%S"));	EXPECT_STREQ(L"Changed ASCII file", rev.GetSubject());	EXPECT_STREQ(L"refs/remotes/origin/master", rev.m_UpstreamRef);	EXPECT_STREQ(L"test", rev.m_Description);	rev = refMap[L"refs/heads/signed-commit"];	EXPECT_STREQ(L"4c5c93d2a0b368bc4570d5ec02ab03b9c4334d44", rev.m_CommitHash.ToString());	EXPECT_STREQ(L"Sven Strickroth", rev.GetAuthorName());	EXPECT_STREQ(L"2015-03-16 12:52:29", rev.GetAuthorDate().FormatGmt(L"%Y-%m-%d %H:%M:%S"));	EXPECT_STREQ(L"Several actions", rev.GetSubject());	EXPECT_STREQ(L"", rev.m_UpstreamRef);	EXPECT_STREQ(L"", rev.m_Description);	rev = refMap[L"refs/tags/also-signed"];	EXPECT_STREQ(L"e89cb722e0f9b2eb763bb059dc099ee6c502a6d8", rev.m_CommitHash.ToString());	EXPECT_STREQ(L"Sven Strickroth", rev.GetAuthorName());	EXPECT_STREQ(L"2015-03-04 17:45:40", rev.GetAuthorDate().FormatGmt(L"%Y-%m-%d %H:%M:%S"));	EXPECT_STREQ(L"Also signed", rev.GetSubject());	EXPECT_STREQ(L"", rev.m_UpstreamRef);	EXPECT_STREQ(L"", rev.m_Description);	rev = refMap[L"refs/heads/subdir/branch"];	EXPECT_STREQ(L"31ff87c86e9f6d3853e438cb151043f30f09029a", rev.m_CommitHash.ToString());	EXPECT_STREQ(L"Sven Strickroth", rev.GetAuthorName());	EXPECT_STREQ(L"2015-03-16 12:52:29", rev.GetAuthorDate().FormatGmt(L"%Y-%m-%d %H:%M:%S")); // used here, because author and commit time differ	EXPECT_STREQ(L"Several actions", rev.GetSubject());	EXPECT_STREQ(L"", rev.m_UpstreamRef);	EXPECT_STREQ(L"multi/nline", rev.m_Description);	refMap.clear();	EXPECT_EQ(0, GitRevRefBrowser::GetGitRevRefMap(refMap, 0, err, [](const CString& refName) { return CStringUtils::StartsWith(refName, L"refs/heads/"); }));	EXPECT_STREQ(L"", err);	EXPECT_EQ(6U, refMap.size());	EXPECT_TRUE(refMap.find(L"refs/heads/master") != refMap.end());	for (auto it = refMap.cbegin(); it != refMap.cend(); ++it)		EXPECT_TRUE(CStringUtils::StartsWith(it->first, L"refs/heads/"));	refMap.clear();	EXPECT_EQ(0, GitRevRefBrowser::GetGitRevRefMap(refMap, 1, err));	EXPECT_STREQ(L"", err);	EXPECT_EQ(6U, refMap.size());	for (const auto& branch : { L"refs/heads/master", L"refs/heads/master2", L"refs/remotes/origin/master", L"refs/tags/all-files-signed", L"refs/tags/also-signed", L"refs/tags/normal-tag" })		EXPECT_TRUE(refMap.find(branch) != refMap.end());	refMap.clear();	EXPECT_EQ(0, GitRevRefBrowser::GetGitRevRefMap(refMap, 2, err));	EXPECT_STREQ(L"", err);	EXPECT_EQ(6U, refMap.size());	EXPECT_TRUE(refMap.find(L"refs/heads/master") == refMap.end());	for (const auto& branch : { L"refs/heads/forconflict", L"refs/heads/signed-commit", L"refs/heads/simple-conflict", L"refs/heads/subdir/branch", L"refs/notes/commits", L"refs/stash" })		EXPECT_TRUE(refMap.find(branch) != refMap.end());}
开发者ID:TortoiseGit,项目名称:TortoiseGit,代码行数:66,


示例3: TEST

TEST(TestStringUtils, SplitString){  CStdStringArray varresults;  EXPECT_EQ(9, StringUtils::SplitString("a,b,c,de,,,fg,,", ",", varresults));  EXPECT_STREQ("a", varresults.at(0).c_str());  EXPECT_STREQ("b", varresults.at(1).c_str());  EXPECT_STREQ("c", varresults.at(2).c_str());  EXPECT_STREQ("de", varresults.at(3).c_str());  EXPECT_STREQ("", varresults.at(4).c_str());  EXPECT_STREQ("", varresults.at(5).c_str());  EXPECT_STREQ("fg", varresults.at(6).c_str());  EXPECT_STREQ("", varresults.at(7).c_str());  EXPECT_STREQ("", varresults.at(8).c_str());  varresults.clear();  varresults = StringUtils::SplitString("g,h,ij,k,lm,,n", ",");  EXPECT_STREQ("g", varresults.at(0).c_str());  EXPECT_STREQ("h", varresults.at(1).c_str());  EXPECT_STREQ("ij", varresults.at(2).c_str());  EXPECT_STREQ("k", varresults.at(3).c_str());  EXPECT_STREQ("lm", varresults.at(4).c_str());  EXPECT_STREQ("", varresults.at(5).c_str());  EXPECT_STREQ("n", varresults.at(6).c_str());}
开发者ID:OV3RDOSE,项目名称:xbmc,代码行数:25,


示例4: TEST_F

TEST_F(LinkedListTest, GetTest) {    EXPECT_STREQ("michael", (char *) list->get(0));    EXPECT_STREQ("john", (char *) list->get(1));}
开发者ID:MichaelAquilina,项目名称:various-algorithms,代码行数:4,


示例5: TEST_F

/** * @brief TEST_F SdkTestNodeOperations * * It performs different operations with nodes, assuming the Cloud folder is empty at the beginning. * * - Create a new folder * - Rename a node * - Copy a node * - Get child nodes of given node * - Get child node by name * - Get node by path * - Get node by name * - Move a node * - Get parent node * - Move a node to Rubbish bin * - Remove a node */TEST_F(SdkTest, SdkTestNodeOperations){    // --- Create a new folder ---    MegaNode *rootnode = megaApi->getRootNode();    char name1[64] = "New folder";    responseReceived = false;    megaApi->createFolder(name1, rootnode);    waitForResponse(&responseReceived);    ASSERT_EQ(MegaError::API_OK, lastError) << "Cannot create a folder (error: " << lastError << ")";    // --- Rename a node ---    MegaNode *n1 = megaApi->getNodeByHandle(h);    strcpy(name1, "Folder renamed");    responseReceived = false;    megaApi->renameNode(n1, name1);    waitForResponse(&responseReceived);    ASSERT_EQ(MegaError::API_OK, lastError) << "Cannot rename a node (error: " << lastError << ")";    // --- Copy a node ---    MegaNode *n2;    char name2[64] = "Folder copy";    responseReceived = false;    megaApi->copyNode(n1, rootnode, name2);    waitForResponse(&responseReceived);    ASSERT_EQ(MegaError::API_OK, lastError) << "Cannot create a copy of a node (error: " << lastError << ")";    n2 = megaApi->getNodeByHandle(h);    // --- Get child nodes ---    MegaNodeList *children;    children = megaApi->getChildren(rootnode);    EXPECT_EQ(megaApi->getNumChildren(rootnode), children->size()) << "Wrong number of child nodes";    ASSERT_LE(2, children->size()) << "Wrong number of children nodes found";    EXPECT_STREQ(name2, children->get(0)->getName()) << "Wrong name of child node"; // "Folder copy"    EXPECT_STREQ(name1, children->get(1)->getName()) << "Wrong name of child node"; // "Folder rename"    delete children;    // --- Get child node by name ---    MegaNode *n3;    n3 = megaApi->getChildNode(rootnode, name2);    bool null_pointer = (n3 == NULL);    EXPECT_FALSE(null_pointer) << "Child node by name not found";//    ASSERT_EQ(n2->getHandle(), n3->getHandle());  This test may fail due to multiple nodes with the same name    // --- Get node by path ---    char path[128] = "/Folder copy";    MegaNode *n4;    n4 = megaApi->getNodeByPath(path);    null_pointer = (n4 == NULL);    EXPECT_FALSE(null_pointer) << "Node by path not found";    // --- Search for a node ---    MegaNodeList *nlist;    nlist = megaApi->search(rootnode, "copy");    ASSERT_EQ(1, nlist->size());    EXPECT_EQ(n4->getHandle(), nlist->get(0)->getHandle()) << "Search node by pattern failed";    delete nlist;    // --- Move a node ---//.........这里部分代码省略.........
开发者ID:rezetta,项目名称:sdk,代码行数:101,


示例6: TEST_F

TEST_F(numtoaTest, Address) {	u_int32 input = htonl(3221225472UL+512UL+1UL); // 192.0.2.1	EXPECT_STREQ("192.0.2.1", numtoa(input));}
开发者ID:coyizumi,项目名称:cs111,代码行数:5,


示例7: TEST_F

TEST_F(KeyboardTest, TestCtrlReturn){    EXPECT_STREQ("InsertNewline", interpretCtrlKeyPress(0xD));}
开发者ID:azureplus,项目名称:chromium,代码行数:4,


示例8: TEST_F

TEST_F(InputMethodControllerTest, BackspaceFromEndOfInput){    HTMLInputElement* input = toHTMLInputElement(        insertHTMLElement("<input id='sample'>", "sample"));    input->setValue("fooX");    controller().setEditableSelectionOffsets(PlainTextRange(4, 4));    EXPECT_STREQ("fooX", input->value().utf8().data());    controller().extendSelectionAndDelete(0, 0);    EXPECT_STREQ("fooX", input->value().utf8().data());    input->setValue("fooX");    controller().setEditableSelectionOffsets(PlainTextRange(4, 4));    EXPECT_STREQ("fooX", input->value().utf8().data());    controller().extendSelectionAndDelete(1, 0);    EXPECT_STREQ("foo", input->value().utf8().data());    input->setValue(String::fromUTF8("foo/xE2/x98/x85")); // U+2605 == "black star"    controller().setEditableSelectionOffsets(PlainTextRange(4, 4));    EXPECT_STREQ("foo/xE2/x98/x85", input->value().utf8().data());    controller().extendSelectionAndDelete(1, 0);    EXPECT_STREQ("foo", input->value().utf8().data());    input->setValue(String::fromUTF8("foo/xF0/x9F/x8F/x86")); // U+1F3C6 == "trophy"    controller().setEditableSelectionOffsets(PlainTextRange(4, 4));    EXPECT_STREQ("foo/xF0/x9F/x8F/x86", input->value().utf8().data());    controller().extendSelectionAndDelete(1, 0);    EXPECT_STREQ("foo", input->value().utf8().data());    input->setValue(String::fromUTF8("foo/xE0/xB8/x81/xE0/xB9/x89")); // composed U+0E01 "ka kai" + U+0E49 "mai tho"    controller().setEditableSelectionOffsets(PlainTextRange(4, 4));    EXPECT_STREQ("foo/xE0/xB8/x81/xE0/xB9/x89", input->value().utf8().data());    controller().extendSelectionAndDelete(1, 0);    EXPECT_STREQ("foo", input->value().utf8().data());    input->setValue("fooX");    controller().setEditableSelectionOffsets(PlainTextRange(4, 4));    EXPECT_STREQ("fooX", input->value().utf8().data());    controller().extendSelectionAndDelete(0, 1);    EXPECT_STREQ("fooX", input->value().utf8().data());}
开发者ID:shaoboyan,项目名称:chromium-crosswalk,代码行数:41,


示例9: TEST

/* ****************************************************************************** restErrorReplyGet - */TEST(restReply, restErrorReplyGet){  const char* rcrOutfile01   = "ngsi9.restReply.registerContext01.ok.valid.xml";  const char* rcrOutfile02   = "ngsi9.restReply.registerContext02.ok.valid.xml";  const char* dcarOutfile01  = "ngsi9.restReply.discovery01.ok.valid.xml";  const char* dcarOutfile02  = "ngsi9.restReply.discovery02.ok.valid.xml";  const char* scarOutfile01  = "ngsi9.restReply.subscribeContextAvailability01.ok.valid.xml";  const char* scarOutfile02  = "ngsi9.restReply.subscribeContextAvailability02.ok.valid.xml";  const char* ucasOutfile01  = "ngsi9.restReply.updateContextAvailabilitySubscription01.ok.valid.xml";  const char* ucasOutfile02  = "ngsi9.restReply.updateContextAvailabilitySubscription02.ok.valid.xml";  const char* ucarOutfile01  = "ngsi9.restReply.unsubscribeContextAvailability01.ok.valid.xml";  const char* ucarOutfile02  = "ngsi9.restReply.unsubscribeContextAvailability02.ok.valid.xml";  const char* ncarOutfile01  = "ngsi9.restReply.notifyContextAvailabilityRequest01.ok.valid.xml";  const char* ncarOutfile02  = "ngsi9.restReply.notifyContextAvailabilityRequest02.ok.valid.xml";  const char* qcrOutfile01   = "ngsi10.restReply.queryContextResponse01.ok.valid.xml";  const char* qcrOutfile02   = "ngsi10.restReply.queryContextResponse02.ok.valid.xml";  const char* scrOutfile01   = "ngsi10.restReply.subscribeContextResponse01.ok.valid.xml";  const char* scrOutfile02   = "ngsi10.restReply.subscribeContextResponse02.ok.valid.xml";  const char* ucsOutfile01   = "ngsi10.restReply.updateContextSubscriptionResponse01.ok.valid.xml";  const char* ucsOutfile02   = "ngsi10.restReply.updateContextSubscriptionResponse02.ok.valid.xml";  const char* uscrOutfile01  = "ngsi10.restReply.unsubscribeContextResponse01.ok.valid.xml";  const char* uscrOutfile02  = "ngsi10.restReply.unsubscribeContextResponse02.ok.valid.xml";  const char* ucrOutfile01   = "ngsi10.restReply.updateContextResponse01.ok.valid.xml";  const char* ucrOutfile02   = "ngsi10.restReply.updateContextResponse02.ok.valid.xml";  const char* ncrOutfile01   = "ngsi10.restReply.notifyContextResponse01.ok.valid.xml";  const char* ncrOutfile02   = "ngsi10.restReply.notifyContextResponse02.ok.valid.xml";  std::string rcr1 = "registerContext";  std::string rcr2 = "/ngsi9/registerContext";  std::string rcr3 = "/NGSI9/registerContext";  std::string rcr4 = "registerContextRequest";  std::string dcar1 = "discoverContextAvailability";  std::string dcar2 = "/ngsi9/discoverContextAvailability";  std::string dcar3 = "/NGSI9/discoverContextAvailability";  std::string dcar4 = "discoverContextAvailabilityRequest";  std::string scar1 = "subscribeContextAvailability";  std::string scar2 = "/ngsi9/subscribeContextAvailability";  std::string scar3 = "/NGSI9/subscribeContextAvailability";  std::string scar4 = "subscribeContextAvailabilityRequest";  std::string ucas1 = "updateContextAvailabilitySubscription";  std::string ucas2 = "/ngsi9/updateContextAvailabilitySubscription";  std::string ucas3 = "/NGSI9/updateContextAvailabilitySubscription";  std::string ucas4 = "updateContextAvailabilitySubscriptionRequest";    std::string ucar1 = "unsubscribeContextAvailability";  std::string ucar2 = "/ngsi9/unsubscribeContextAvailability";  std::string ucar3 = "/NGSI9/unsubscribeContextAvailability";  std::string ucar4 = "unsubscribeContextAvailabilityRequest";    std::string ncar1 = "notifyContextAvailability";  std::string ncar2 = "/ngsi9/notifyContextAvailability";  std::string ncar3 = "/NGSI9/notifyContextAvailability";  std::string ncar4 = "notifyContextAvailabilityRequest";    std::string qcr1 = "queryContext";  std::string qcr2 = "/ngsi10/queryContext";  std::string qcr3 = "/NGSI10/queryContext";  std::string qcr4 = "queryContextRequest";    std::string scr1 = "subscribeContext";  std::string scr2 = "/ngsi10/subscribeContext";  std::string scr3 = "/NGSI10/subscribeContext";  std::string scr4 = "subscribeContextRequest";    std::string ucs1 = "updateContextSubscription";  std::string ucs2 = "/ngsi10/updateContextSubscription";  std::string ucs3 = "/NGSI10/updateContextSubscription";  std::string ucs4 = "updateContextSubscriptionRequest";    std::string uscr1 = "unsubscribeContext";  std::string uscr2 = "/ngsi10/unsubscribeContext";  std::string uscr3 = "/NGSI10/unsubscribeContext";  std::string uscr4 = "unsubscribeContextRequest";    std::string ucr1 = "updateContext";  std::string ucr2 = "/ngsi10/updateContext";  std::string ucr3 = "/NGSI10/updateContext";  std::string ucr4 = "updateContextRequest";    std::string ncr1 = "notifyContext";  std::string ncr2 = "/ngsi10/notifyContext";  std::string ncr3 = "/NGSI10/notifyContext";  std::string ncr4 = "notifyContextRequest";    std::string     out;  ConnectionInfo  ci("/ngsi/test", "POST", "1.1");    utInit();  EXPECT_EQ("OK", testDataFromFile(expectedBuf, sizeof(expectedBuf), rcrOutfile01)) << "Error getting test data from '" << rcrOutfile01 << "'";  out = restErrorReplyGet(&ci, XML, "", rcr1, SccOk, "detail");  EXPECT_STREQ(expectedBuf, out.c_str());  out = restErrorReplyGet(&ci, XML, "", rcr2, SccOk, "detail");//.........这里部分代码省略.........
开发者ID:PascaleBorscia,项目名称:fiware-orion,代码行数:101,


示例10: TEST_F

TEST_F(PublicMethodsEmbedderTest, MakeFormatDate) {  v8::Isolate::Scope isolate_scope(isolate());  v8::HandleScope handle_scope(isolate());  v8::Context::Scope context_scope(GetV8Context());  CFX_WideString formatted_date;  // 1968-06-25  formatted_date = CJS_PublicMethods::MakeFormatDate(-47952000000, L"ddmmyy");  EXPECT_STREQ(L"250668", formatted_date.c_str());  formatted_date = CJS_PublicMethods::MakeFormatDate(-47952000000, L"yy/mm/dd");  EXPECT_STREQ(L"68/06/25", formatted_date.c_str());  // 1969-12-31  formatted_date = CJS_PublicMethods::MakeFormatDate(-0.0001, L"ddmmyy");  EXPECT_STREQ(L"311269", formatted_date.c_str());  formatted_date = CJS_PublicMethods::MakeFormatDate(-0.0001, L"yy!mmdd");  EXPECT_STREQ(L"69!1231", formatted_date.c_str());  // 1970-01-01  formatted_date = CJS_PublicMethods::MakeFormatDate(0, L"ddmmyy");  EXPECT_STREQ(L"010170", formatted_date.c_str());  formatted_date = CJS_PublicMethods::MakeFormatDate(0, L"mm-yyyy-dd");  EXPECT_STREQ(L"01-1970-01", formatted_date.c_str());  // 1985-12-31  formatted_date = CJS_PublicMethods::MakeFormatDate(504835200000.0, L"ddmmyy");  EXPECT_STREQ(L"311285", formatted_date.c_str());  formatted_date = CJS_PublicMethods::MakeFormatDate(504835200000.0, L"yymmdd");  EXPECT_STREQ(L"851231", formatted_date.c_str());  // 1995-02-01  formatted_date = CJS_PublicMethods::MakeFormatDate(791596800000.0, L"ddmmyy");  EXPECT_STREQ(L"010295", formatted_date.c_str());  formatted_date =      CJS_PublicMethods::MakeFormatDate(791596800000.0, L"yyyymmdd");  EXPECT_STREQ(L"19950201", formatted_date.c_str());  // 2005-02-01  formatted_date =      CJS_PublicMethods::MakeFormatDate(1107216000000.0, L"ddmmyy");  EXPECT_STREQ(L"010205", formatted_date.c_str());  formatted_date =      CJS_PublicMethods::MakeFormatDate(1107216000000.0, L"yyyyddmm");  EXPECT_STREQ(L"20050102", formatted_date.c_str());  // 2085-12-31  formatted_date =      CJS_PublicMethods::MakeFormatDate(3660595200000.0, L"ddmmyy");  EXPECT_STREQ(L"311285", formatted_date.c_str());  formatted_date =      CJS_PublicMethods::MakeFormatDate(3660595200000.0, L"yyyydd");  EXPECT_STREQ(L"208531", formatted_date.c_str());  // 2095-02-01  formatted_date =      CJS_PublicMethods::MakeFormatDate(3947356800000.0, L"ddmmyy");  EXPECT_STREQ(L"010295", formatted_date.c_str());  formatted_date =      CJS_PublicMethods::MakeFormatDate(3947356800000.0, L"mmddyyyy");  EXPECT_STREQ(L"02012095", formatted_date.c_str());}
开发者ID:MIPS,项目名称:external-pdfium,代码行数:61,


示例11: TEST_F

TEST_F(lagi_mru, add_entry) {	agi::fs::Copy("data/mru_ok.json", "data/mru_tmp");	agi::MRUManager mru("data/mru_tmp", default_mru);	EXPECT_NO_THROW(mru.Add("Valid", "/path/to/file"));	EXPECT_STREQ("/path/to/file", mru.Get("Valid")->front().string().c_str());}
开发者ID:seawaveT,项目名称:Aegisub,代码行数:6,


示例12: TEST

TEST(TestRarFile, NormalRAR){  XFILE::CFile file;  char buf[20];  memset(&buf, 0, sizeof(buf));  CStdString reffile, strrarpath, strpathinrar;  CFileItemList itemlist, itemlistemptydir;  struct __stat64 stat_buffer;  reffile = XBMC_REF_FILE_PATH("xbmc/filesystem/test/refRARnormal.rar");  URIUtils::CreateArchivePath(strrarpath, "rar", reffile, "");  ASSERT_TRUE(XFILE::CDirectory::GetDirectory(strrarpath, itemlist));  itemlist.Sort(SortByPath, SortOrderAscending);  /* /reffile.txt */  strpathinrar = itemlist[1]->GetPath();  ASSERT_TRUE(StringUtils::EndsWith(strpathinrar, "/reffile.txt"));  EXPECT_EQ(0, XFILE::CFile::Stat(strpathinrar, &stat_buffer));  EXPECT_TRUE((stat_buffer.st_mode & S_IFMT) | S_IFREG);  ASSERT_TRUE(file.Open(strpathinrar));  EXPECT_EQ(0, file.GetPosition());  EXPECT_EQ(1616, file.GetLength());  EXPECT_EQ(sizeof(buf), file.Read(buf, sizeof(buf)));  file.Flush();  EXPECT_EQ(20, file.GetPosition());  EXPECT_TRUE(!memcmp("About/n-----/nXBMC is ", buf, sizeof(buf) - 1));  EXPECT_TRUE(file.ReadString(buf, sizeof(buf)));  EXPECT_EQ(39, file.GetPosition());  EXPECT_STREQ("an award-winning fr", buf);  EXPECT_EQ(100, file.Seek(100));  EXPECT_EQ(100, file.GetPosition());  EXPECT_EQ(sizeof(buf), file.Read(buf, sizeof(buf)));  file.Flush();  EXPECT_EQ(120, file.GetPosition());  EXPECT_TRUE(!memcmp("ent hub for digital ", buf, sizeof(buf) - 1));  EXPECT_EQ(220, file.Seek(100, SEEK_CUR));  EXPECT_EQ(220, file.GetPosition());  EXPECT_EQ(sizeof(buf), file.Read(buf, sizeof(buf)));  file.Flush();  EXPECT_EQ(240, file.GetPosition());  EXPECT_TRUE(!memcmp("rs, XBMC is a non-pr", buf, sizeof(buf) - 1));  EXPECT_EQ(1596, file.Seek(-(int64_t)sizeof(buf), SEEK_END));  EXPECT_EQ(1596, file.GetPosition());  EXPECT_EQ(sizeof(buf), file.Read(buf, sizeof(buf)));  file.Flush();  EXPECT_EQ(1616, file.GetPosition());  EXPECT_TRUE(!memcmp("multimedia jukebox./n", buf, sizeof(buf) - 1));  EXPECT_EQ(1716, file.Seek(100, SEEK_CUR));  EXPECT_EQ(1716, file.GetPosition());  EXPECT_EQ(0, file.Seek(0, SEEK_SET));  EXPECT_EQ(sizeof(buf), file.Read(buf, sizeof(buf)));  file.Flush();  EXPECT_EQ(20, file.GetPosition());  EXPECT_TRUE(!memcmp("About/n-----/nXBMC is ", buf, sizeof(buf) - 1));  EXPECT_EQ(0, file.Seek(0, SEEK_SET));  EXPECT_EQ(-1, file.Seek(-100, SEEK_SET));  file.Close();  /* /testsymlink -> testdir/reffile.txt */  strpathinrar = itemlist[2]->GetPath();  ASSERT_TRUE(StringUtils::EndsWith(strpathinrar, "/testsymlink"));  EXPECT_EQ(0, XFILE::CFile::Stat(strpathinrar, &stat_buffer));  EXPECT_TRUE((stat_buffer.st_mode & S_IFMT) | S_IFLNK);  /*   * FIXME: Reading symlinks in RARs is currently broken. It takes a long time   * to read them and they produce erroneous results. The expected result is   * the target paths of the symlinks.   */  ASSERT_TRUE(file.Open(strpathinrar));  EXPECT_EQ(19, file.GetLength());  file.Close();  /* /testsymlinksubdir -> testdir/testsubdir/reffile.txt */  strpathinrar = itemlist[3]->GetPath();  ASSERT_TRUE(StringUtils::EndsWith(strpathinrar, "/testsymlinksubdir"));  EXPECT_EQ(0, XFILE::CFile::Stat(strpathinrar, &stat_buffer));  EXPECT_TRUE((stat_buffer.st_mode & S_IFMT) | S_IFLNK);  ASSERT_TRUE(file.Open(strpathinrar));  EXPECT_EQ(30, file.GetLength());  file.Close();  /* /testdir/ */  strpathinrar = itemlist[0]->GetPath();  ASSERT_TRUE(StringUtils::EndsWith(strpathinrar, "/testdir/"));  EXPECT_EQ(0, XFILE::CFile::Stat(strpathinrar, &stat_buffer));  EXPECT_TRUE((stat_buffer.st_mode & S_IFMT) | S_IFDIR);  itemlist.Clear();  ASSERT_TRUE(XFILE::CDirectory::GetDirectory(strpathinrar, itemlist));  itemlist.Sort(SortByPath, SortOrderAscending);  /* /testdir/reffile.txt */  strpathinrar = itemlist[1]->GetPath();  ASSERT_TRUE(StringUtils::EndsWith(strpathinrar, "/testdir/reffile.txt",                                    true));  EXPECT_EQ(0, XFILE::CFile::Stat(strpathinrar, &stat_buffer));  EXPECT_TRUE((stat_buffer.st_mode & S_IFMT) | S_IFREG);//.........这里部分代码省略.........
开发者ID:Inferno1977,项目名称:xbmc,代码行数:101,



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


C++ EXPECT_THROW函数代码示例
C++ EXPECT_LT函数代码示例
万事OK自学网:51自学网_软件自学网_CAD自学网自学excel、自学PS、自学CAD、自学C语言、自学css3实例,是一个通过网络自主学习工作技能的自学平台,网友喜欢的软件自学网站。