You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.3 KiB

  1. #include <argparse/argparse.hpp>
  2. #include <doctest.hpp>
  3. using doctest::test_suite;
  4. TEST_CASE("Issues with implicit values #37" * test_suite("implicit_values")) {
  5. argparse::ArgumentParser m_bfm("test");
  6. m_bfm.add_argument("-l", "--load").help("load a VMM into the kernel");
  7. m_bfm.add_argument("-u", "--unload")
  8. .default_value(false)
  9. .implicit_value(true)
  10. .help("unload a previously loaded VMM");
  11. m_bfm.add_argument("-x", "--start")
  12. .default_value(false)
  13. .implicit_value(true)
  14. .help("start a previously loaded VMM");
  15. m_bfm.add_argument("-s", "--stop")
  16. .default_value(false)
  17. .implicit_value(true)
  18. .help("stop a previously started VMM");
  19. m_bfm.add_argument("-d", "--dump")
  20. .default_value(false)
  21. .implicit_value(true)
  22. .help("output the contents of the VMM's debug buffer");
  23. m_bfm.add_argument("-m", "--mem")
  24. .default_value(100)
  25. .required()
  26. .scan<'u', unsigned long long>()
  27. .help("memory in MB to give the VMM when loading");
  28. m_bfm.parse_args({"test", "-l", "blah", "-d", "-u"});
  29. REQUIRE(m_bfm.get("--load") == "blah");
  30. REQUIRE(m_bfm.get("-l") == "blah");
  31. REQUIRE(m_bfm.get<bool>("-u") == true);
  32. REQUIRE(m_bfm.get<bool>("-d") == true);
  33. REQUIRE(m_bfm.get<bool>("-s") == false);
  34. REQUIRE(m_bfm.get<bool>("--unload") == true);
  35. }