int main (int argc, char *argv[]) { my_stack = iks_stack_new (1024, 1024); test_id ("jabber:[email protected]/cabbar", "*****@*****.**", "madcat", "jabber.org", "cabbar"); test_id ("*****@*****.**", "*****@*****.**", "bob", "silent.org", NULL); test_cmp ("[email protected]/hell", "[email protected]/heaven", IKS_ID_PARTIAL, 0); test_cmp ("[email protected]/cabbar", "[email protected]/jabberx", IKS_ID_FULL, IKS_ID_RESOURCE); test_cmp ("[email protected]/pda", "[email protected]/jabberx", IKS_ID_FULL, IKS_ID_USER | IKS_ID_RESOURCE); test_cmp ("[email protected]/gabber", "[email protected]/gsm", IKS_ID_FULL, IKS_ID_FULL); test_cmp ("*****@*****.**", "[email protected]/clam", IKS_ID_PARTIAL, 0); iks_stack_delete (my_stack); return 0; }
int main() { test_add_univ(); test_id(); test_path(); test_import(); test_inductive(); return 0; }
void mm_run_tests() { test_id(); test_object_id(); test_init(); test_spatial(); test_object_add_remove_properties(); test_name(); test_social_meet(); test_som(); test_communicate_social_categorisation(); test_episodic(); test_tale(); test_narratives(); test_confabulation_with_narratives(); test_confabulation_with_episodic(); printf("All tests passed\n"); }
int main() { Node node; // initialize it with some values node.id = 0; node.name = "root"; srand(static_cast<unsigned>(time(NULL))); for(int i= 0; i < 100; ++i) { std::unique_ptr<Node> ch (new Node ); ch->id = i; ch->name = "children"; node.children.push_back( std::move(ch) ); } //............ std::vector<int> existing_ids; // initialize it with some values. for(int i = 0; i < 100; ++i) if ( i % 3 == 1) existing_ids.push_back(i); //sort it std::sort(existing_ids.begin(), existing_ids.end() ); // Now, I want remove elements from the children, where id is in existing_ids vector. node.children.erase( std::remove_if( node.children.begin(), node.children.end(), std::bind(test_id(existing_ids), std::bind(&Node::id, std::placeholders::_1) )//--> compile error ), node.children.end() ); for(auto& n : node.children) { std::cout << n->id << ' '; } std::cout << '\n'; }
int main() { { PendingTeleport * pt = new PendingTeleport("", ""); delete pt; } { std::string test_id("de214cec-f8c4-11df-baf7-00269e5444b3"); PendingTeleport * pt = new PendingTeleport(test_id, ""); const std::string & entity_id = pt->getEntityID(); assert(entity_id == test_id); delete pt; } { std::string test_key("3bf18e18-f8c5-11df-b0bf-00269e5444b3"); PendingTeleport * pt = new PendingTeleport("", test_key); const std::string & key = pt->getPossessKey(); assert(key == test_key); delete pt; } { std::string test_id("de214cec-f8c4-11df-baf7-00269e5444b3"); std::string test_key("3bf18e18-f8c5-11df-b0bf-00269e5444b3"); PendingTeleport * pt = new PendingTeleport(test_id, test_key); bool ret = pt->validate(test_id, test_key); assert(ret); delete pt; } { std::string test_id("de214cec-f8c4-11df-baf7-00269e5444b3"); std::string test_key("3bf18e18-f8c5-11df-b0bf-00269e5444b3"); PendingTeleport * pt = new PendingTeleport(test_id, test_key); bool ret = pt->validate(test_id, "c0e3b16e-f8c5-11df-9070-00269e5444b3"); assert(!ret); delete pt; } { std::string test_id("de214cec-f8c4-11df-baf7-00269e5444b3"); std::string test_key("3bf18e18-f8c5-11df-b0bf-00269e5444b3"); PendingTeleport * pt = new PendingTeleport(test_id, test_key); bool ret = pt->validate("c7e27496-f8c5-11df-9103-00269e5444b3", test_key); assert(!ret); delete pt; } { std::string test_id("de214cec-f8c4-11df-baf7-00269e5444b3"); std::string test_key("3bf18e18-f8c5-11df-b0bf-00269e5444b3"); PendingTeleport * pt = new PendingTeleport(test_id, test_key); bool ret = pt->validate("d6dd2626-f8c5-11df-853f-00269e5444b3", "e13c51be-f8c5-11df-a97f-00269e5444b3"); assert(!ret); delete pt; } { PendingTeleport * pt = new PendingTeleport("", ""); assert(!pt->isValidated()); delete pt; } { PendingTeleport * pt = new PendingTeleport("", ""); assert(!pt->isValidated()); pt->setValidated(); assert(pt->isValidated()); delete pt; } return 0; }