@@ -248,6 +248,31 @@ TEST_CASE("render_list min/max int generator", "min/max int generator testing")
248248 int status = run_command (test_binary, argv);
249249 REQUIRE (WEXITSTATUS (status) == 0 );
250250 }
251+
252+ SECTION (option + " option is negative" , " should return 1" ) {
253+ std::vector<std::string> argv = {option, " -1" };
254+
255+ int status = run_command (test_binary, argv);
256+ REQUIRE (WEXITSTATUS (status) == 1 );
257+ REQUIRE_THAT (err_log_lines, Catch::Matchers::Contains (" must be >=" ));
258+ REQUIRE_THAT (err_log_lines, Catch::Matchers::Contains (" (-1 was provided)" ));
259+ }
260+
261+ SECTION (option + " option is float" , " should return 1" ) {
262+ std::vector<std::string> argv = {option, " 1.23456789" };
263+
264+ int status = run_command (test_binary, argv);
265+ REQUIRE (WEXITSTATUS (status) == 1 );
266+ REQUIRE_THAT (err_log_lines, Catch::Matchers::Contains (" must be an integer (1.23456789 was provided)" ));
267+ }
268+
269+ SECTION (option + " option is not an integer" , " should return 1" ) {
270+ std::vector<std::string> argv = {option, " invalid" };
271+
272+ int status = run_command (test_binary, argv);
273+ REQUIRE (WEXITSTATUS (status) == 1 );
274+ REQUIRE_THAT (err_log_lines, Catch::Matchers::Contains (" must be an integer (invalid was provided)" ));
275+ }
251276}
252277
253278TEST_CASE (" render_list min/max lat generator" , " min/max double generator testing" )
@@ -269,6 +294,51 @@ TEST_CASE("render_list min/max lat generator", "min/max double generator testing
269294 int status = run_command (test_binary, argv);
270295 REQUIRE (WEXITSTATUS (status) == 0 );
271296 }
297+
298+ SECTION (option + " option is too large" , " should return 1" ) {
299+ std::vector<std::string> argv = {option, std::to_string (max + .1 )};
300+
301+ int status = run_command (test_binary, argv);
302+ REQUIRE (WEXITSTATUS (status) == 1 );
303+ REQUIRE_THAT (err_log_lines, Catch::Matchers::Contains (" must be <= 85.051100 (85.151100 was provided)" ));
304+ }
305+
306+ SECTION (option + " option is too small" , " should return 1" ) {
307+ std::vector<std::string> argv = {option, std::to_string (min - .1 )};
308+
309+ int status = run_command (test_binary, argv);
310+ REQUIRE (WEXITSTATUS (status) == 1 );
311+ REQUIRE_THAT (err_log_lines, Catch::Matchers::Contains (" must be >= -85.051100 (-85.151100 was provided)" ));
312+ }
313+
314+ SECTION (option + " option is not a double" , " should return 1" ) {
315+ std::vector<std::string> argv = {option, " invalid" };
316+
317+ int status = run_command (test_binary, argv);
318+ REQUIRE (WEXITSTATUS (status) == 1 );
319+ REQUIRE_THAT (err_log_lines, Catch::Matchers::Contains (" must be a double (invalid was provided)" ));
320+ }
321+
322+ SECTION (option + " option is positive with --help" , " should return 0" ) {
323+ std::vector<std::string> argv = {option, std::to_string (max), " --help" };
324+
325+ int status = run_command (test_binary, argv);
326+ REQUIRE (WEXITSTATUS (status) == 0 );
327+ }
328+
329+ SECTION (option + " option is negative with --help" , " should return 0" ) {
330+ std::vector<std::string> argv = {option, std::to_string (min), " --help" };
331+
332+ int status = run_command (test_binary, argv);
333+ REQUIRE (WEXITSTATUS (status) == 0 );
334+ }
335+
336+ SECTION (option + " option is double with --help" , " should return 0" ) {
337+ std::vector<std::string> argv = {option, " 1.23456789" , " --help" };
338+
339+ int status = run_command (test_binary, argv);
340+ REQUIRE (WEXITSTATUS (status) == 0 );
341+ }
272342}
273343
274344TEST_CASE (" render_list min/max lon generator" , " min/max double generator testing" )
@@ -290,4 +360,49 @@ TEST_CASE("render_list min/max lon generator", "min/max double generator testing
290360 int status = run_command (test_binary, argv);
291361 REQUIRE (WEXITSTATUS (status) == 0 );
292362 }
363+
364+ SECTION (option + " option is too large" , " should return 1" ) {
365+ std::vector<std::string> argv = {option, std::to_string (max + .1 )};
366+
367+ int status = run_command (test_binary, argv);
368+ REQUIRE (WEXITSTATUS (status) == 1 );
369+ REQUIRE_THAT (err_log_lines, Catch::Matchers::Contains (" must be <= 180.000000 (180.100000 was provided)" ));
370+ }
371+
372+ SECTION (option + " option is too small" , " should return 1" ) {
373+ std::vector<std::string> argv = {option, std::to_string (min - .1 )};
374+
375+ int status = run_command (test_binary, argv);
376+ REQUIRE (WEXITSTATUS (status) == 1 );
377+ REQUIRE_THAT (err_log_lines, Catch::Matchers::Contains (" must be >= -180.000000 (-180.100000 was provided)" ));
378+ }
379+
380+ SECTION (option + " option is not a double" , " should return 1" ) {
381+ std::vector<std::string> argv = {option, " invalid" };
382+
383+ int status = run_command (test_binary, argv);
384+ REQUIRE (WEXITSTATUS (status) == 1 );
385+ REQUIRE_THAT (err_log_lines, Catch::Matchers::Contains (" must be a double (invalid was provided)" ));
386+ }
387+
388+ SECTION (option + " option is positive with --help" , " should return 0" ) {
389+ std::vector<std::string> argv = {option, std::to_string (max), " --help" };
390+
391+ int status = run_command (test_binary, argv);
392+ REQUIRE (WEXITSTATUS (status) == 0 );
393+ }
394+
395+ SECTION (option + " option is negative with --help" , " should return 0" ) {
396+ std::vector<std::string> argv = {option, std::to_string (min), " --help" };
397+
398+ int status = run_command (test_binary, argv);
399+ REQUIRE (WEXITSTATUS (status) == 0 );
400+ }
401+
402+ SECTION (option + " option is double with --help" , " should return 0" ) {
403+ std::vector<std::string> argv = {option, " 1.23456789" , " --help" };
404+
405+ int status = run_command (test_binary, argv);
406+ REQUIRE (WEXITSTATUS (status) == 0 );
407+ }
293408}
0 commit comments