// test the matching of tree rooted with the given pointers. bool testMatch(BTreeNode *tr1, BTreeNode *tr2) { bool match = false; if(NULL == tr2) return true; if(NULL == tr1) return false; if(tr1->val == tr2->val) match = true; else return false; return testMatch(tr1->left, tr2->left) && testMatch(tr1->right, tr2->right); }
int main() { if (TYPE == 0) readTemplates(); else { trainModels(); readModels(); } testMatch(); recordAndMatch(); return 0; }
int test_x500name(int argc, char *argv[]) { PKIX_PL_X500Name *goodObject = NULL; PKIX_PL_X500Name *equalObject = NULL; PKIX_PL_X500Name *diffObject = NULL; PKIX_PL_X500Name *diffObjectMatch = NULL; PKIX_UInt32 actualMinorVersion; PKIX_UInt32 j = 0; /* goodInput is encoded in PKIX_ESCASCII */ char *goodInput = "cn=Strauß,ou=labs,o=sun,c=us"; char *diffInput = "cn=steve,ou=labs,o=sun,c=us"; char *diffInputMatch = "Cn=SteVe,Ou=lABs,o=SUn,c=uS"; char *expectedAscii = "CN=Strauß,OU=labs,O=sun,C=us"; PKIX_TEST_STD_VARS(); startTests("X500Name"); PKIX_TEST_EXPECT_NO_ERROR( PKIX_PL_NssContext_Create(0, PKIX_FALSE, NULL, &plContext)); createX500Names (goodInput, diffInput, diffInputMatch, &goodObject, &equalObject, &diffObject, &diffObjectMatch); PKIX_TEST_EQ_HASH_TOSTR_DUP (goodObject, equalObject, diffObject, expectedAscii, X500Name, PKIX_TRUE); testMatch(goodObject, diffObject, diffObjectMatch); testDestroy(goodObject, equalObject, diffObject, diffObjectMatch); cleanup: PKIX_Shutdown(plContext); PKIX_TEST_RETURN(); endTests("X500Name"); return (0); }
bool isSubTree(BTreeNode *tree1, BTreeNode *tree2) { // find a node in tree1 with the same value as the root of tree2 ; bool isASubTree = false; if(NULL != tree1 && NULL != tree2) { if(rootVal == node->val) { isASubTree = testMatch(node, tree2); } if(!isASubTree) { isASubTree = isSubTree(node->left, tree2); } if(!isASubTree) { isASubTree = isSubTree(node->right, tree2); } } return isASubTree; }
int main() { // Template matching cv::Mat original, templ; // Get image original = cv::imread("black-circles.jpg",0); // Get template image templ = cv::imread("circle.bmp",0); // Show them cv::namedWindow("original", CV_WINDOW_FREERATIO); imshow("original", original); cv::namedWindow("template", CV_WINDOW_FREERATIO); imshow("template", templ); // Compare testMatch(original, templ); cv::destroyAllWindows(); cv::waitKey(0); return 0; }
TEST_F(IpAddressTest, TestLoopBackAddressMatch) { ASSERT_TRUE(testMatch()); }