bool TestUtil::TestSharedString() { { SharedString foo = "foo"; SharedString bah("bah"); VERIFY(bah->getString() == "bah"); { SharedString bah2 = bah; VERIFY(bah2->getString() == "bah"); VERIFY(bah.get() == bah2.get()); SharedString bah3 = "bah"; VERIFY(bah.get() == bah3.get()); } VERIFY(bah->getString() == "bah"); VERIFY(foo->getString() == "foo"); } { hphp_shared_string_map<int64_t> map; for (int i = 0; i < 100; i++) { std::string k("key"); k += i; map[k] = i; } for (int i = 0; i < 100; i++) { std::string k("key"); k += i; auto const it = map.find(k); VERIFY(it != map.end()); VERIFY(it->second == i); } } return Count(true); }
int top2 (int q) { do_stuff (200); do_other_stuff (); return bah (16, q); }
int main (int argc, char *argv[]) { int i; for (i = 0; i < 10; i++) bah (); return 0; }
int main(void) { ((int (*)())f)(0, 0); ((int (*)())g)(0.0); int bar(); bar(5.0); int baz(); baz((char)5); int bah(); bah(5); return 0; }
void write(const service_ptr_t<file> & p_file,abort_callback & p_abort,const char * p_string,bool is_utf8) { p_file->seek(0,p_abort); p_file->set_eof(p_abort); if (is_utf8) { p_file->write_object(utf8_header,sizeof(utf8_header),p_abort); p_file->write_object(p_string,strlen(p_string),p_abort); } else { #ifdef _WIN32 pfc::stringcvt::string_ansi_from_utf8 bah(p_string); p_file->write_object(bah,bah.length(),p_abort); #else throw exception_io_data(); #endif } }
int top1 (int q) { do_other_stuff (); return bah (0, q); }