static void test_construction() { map<int, int> m1; test_emptiness(m1); test_copying(m1); map<int, int> m2(il.begin(), il.end()); test_equality(m2, benchmark); test_copying(m2); map<int, int> m3(il); test_equality(m3, benchmark); test_copying(m3); }
int main (int argc, char *argv[]) { g_type_init (); test_enum_transformation (); test_gtype_value (); test_collection (); test_copying (); return 0; }
int main (int argc, char *argv[]) { #ifdef __SYMBIAN32__ g_log_set_handler (NULL, G_LOG_FLAG_FATAL| G_LOG_FLAG_RECURSION | G_LOG_LEVEL_CRITICAL | G_LOG_LEVEL_WARNING | G_LOG_LEVEL_MESSAGE | G_LOG_LEVEL_INFO | G_LOG_LEVEL_DEBUG, &mrtLogHandler, NULL); g_set_print_handler(mrtPrintHandler); #endif /*__SYMBIAN32__*/ g_type_init (); test_enum_transformation (); test_gtype_value (); test_collection (); test_copying (); #if __SYMBIAN32__ testResultXml("gvalue-test"); #endif /* EMULATOR */ return 0; }
static void test_insertion_erasure_and_searching() { map<int, int> m; const auto& cb = m; std::map<int, int> sm; const auto& csm = sm; int i = 0; for (const auto& x : il) { if (i++ & 2) m.insert(x); else m[x.first] = x.second; sm.insert(x); test_equality(m, sm); test_copying(m); test_searching(m .lower_bound(1), m .end(), sm .lower_bound(1), sm .end()); test_searching(m .lower_bound(2), m .end(), sm .lower_bound(2), sm .end()); test_searching(cb.lower_bound(1), cb.end(), csm.lower_bound(1), csm.end()); test_searching(cb.lower_bound(2), cb.end(), csm.lower_bound(2), csm.end()); test_searching(m .upper_bound(1), m .end(), sm .upper_bound(1), sm .end()); test_searching(m .upper_bound(2), m .end(), sm .upper_bound(2), sm .end()); test_searching(cb.upper_bound(1), cb.end(), csm.upper_bound(1), csm.end()); test_searching(cb.upper_bound(2), cb.end(), csm.upper_bound(2), csm.end()); test_searching(m .find(1), m .end(), sm .find(1), sm .end()); test_searching(m .find(2), m .end(), sm .find(2), sm .end()); test_searching(cb.find(1), cb.end(), csm.find(1), csm.end()); test_searching(cb.find(2), cb.end(), csm.find(2), csm.end()); } for (const auto& x : il) { auto im = m.find(x.first); auto ism = sm.find(x.first); assert((im == m.end()) == (ism == sm.end())); if (im != m.end()) { im = m.erase(im); ism = sm.erase(ism); } assert((im == m.end()) == (ism == sm.end())); assert(im == m.end() || *im == *ism); } m.insert(il.begin(), il.end()); sm = il; test_equality(m, sm); assert(m.erase(m.begin(), m.end()) == m.end()); test_emptiness(m); m = il; auto it = --m.end(); assert(m.erase(++m.begin(), it) == it); sm = il; sm.erase(++sm.begin(), --sm.end()); test_equality(m, sm); }