#include #include #include #include #include #include static int ctor_ran = 0; struct Global { Global() { ctor_ran = 42; } }; static Global g; int main() { int score = 0; if (ctor_ran == 42) { puts("global ctor: OK"); score++; } std::string s = "montauk"; s += "-cxx"; if (s == "montauk-cxx" && s.size() == 11) { puts("std::string: OK"); score++; } std::vector v{5, 3, 1, 4, 2}; std::sort(v.begin(), v.end()); if (v.front() == 1 && v.back() == 5) { puts("std::vector+sort: OK"); score++; } auto p = std::make_unique("heap"); if (*p == "heap") { puts("unique_ptr/new: OK"); score++; } try { throw std::runtime_error("caught!"); } catch (const std::exception& e) { if (std::string(e.what()) == "caught!") { puts("exceptions: OK"); score++; } } printf("%d/5 passed\n", score); return (score == 5) ? 0 : 1; }