void test_parse_resolution_gets_negative_halts(CuTest *tc) { int res_x; int res_y; char param[] = "-16x12"; int expected = 1; int actual = parse_resolution( param, &res_x, &res_y ); CuAssertIntEquals(tc, expected, actual); }
void test_parse_resolution_gets_16x12_returns_16x12(CuTest *tc) { int expected_x = 16; int expected_y = 12; int actual_x; int actual_y; char param[] = "16x12"; int actual = parse_resolution( param, &actual_x, &actual_y ); CuAssertIntEquals(tc, expected_x, actual_x); CuAssertIntEquals(tc, expected_y, actual_y); }
/// Main function. /// /// \param argc Argument count. /// \param argv Arguments. /// \return Program return code. int MAINPROG(int argc, char **argv) { unsigned screen_w = 1280; unsigned screen_h = 720; bool developer = false; bool fullscreen = true; bool record = false; if(argc > 0) { po::options_description desc("Options"); desc.add_options() ("developer,d", "Developer mode.") ("help,h", "Print help text.") ("record,R", "Do not play intro normally, instead save audio as .wav and frames as .png -files.") ("resolution,r", po::value<std::string>(), "Resolution to use, specify as 'WIDTHxHEIGHT'.") ("window,w", "Start in window instead of full-screen."); po::variables_map vmap; po::store(po::command_line_parser(argc, argv).options(desc).run(), vmap); po::notify(vmap); if(vmap.count("developer")) { developer = true; } if(vmap.count("help")) { std::cout << usage << desc << std::endl; return 0; } if(vmap.count("record")) { record = true; } if(vmap.count("resolution")) { boost::tie(screen_w, screen_h) = parse_resolution(vmap["resolution"].as<std::string>()); } if(vmap.count("window")) { fullscreen = false; } } return intro(screen_w, screen_h, developer, fullscreen, record); }