| 6 | |
| 7 | Y_UNIT_TEST_SUITE(TPosixGetoptTest) { |
| 8 | Y_UNIT_TEST(TestSimple) { |
| 9 | int argc = 6; |
| 10 | const char* argv0[] = {"program", "-b", "-f1", "-f", "2", "zzzz"}; |
| 11 | char** const argv = (char**)argv0; |
| 12 | |
| 13 | NLastGetopt::optreset = 1; |
| 14 | UNIT_ASSERT_VALUES_EQUAL('b', NLastGetopt::getopt(argc, argv, "bf:")); |
| 15 | UNIT_ASSERT_VALUES_EQUAL('f', NLastGetopt::getopt(argc, argv, "bf:")); |
| 16 | UNIT_ASSERT_VALUES_EQUAL(NLastGetopt::optarg, TString("1")); |
| 17 | UNIT_ASSERT_VALUES_EQUAL('f', NLastGetopt::getopt(argc, argv, "bf:")); |
| 18 | UNIT_ASSERT_VALUES_EQUAL(NLastGetopt::optarg, TString("2")); |
| 19 | UNIT_ASSERT_VALUES_EQUAL(-1, NLastGetopt::getopt(argc, argv, "bf:")); |
| 20 | |
| 21 | UNIT_ASSERT_VALUES_EQUAL(5, NLastGetopt::optind); |
| 22 | } |
| 23 | |
| 24 | Y_UNIT_TEST(TestLong) { |
| 25 | int daggerset = 0; |
nothing calls this directly
no test coverage detected