| 1818 | } |
| 1819 | |
| 1820 | static void test_command_line() |
| 1821 | { |
| 1822 | { |
| 1823 | const char *argv[] = { "prog", "-s", "--switch" }; |
| 1824 | CommandLine cl(countof(argv), argv); |
| 1825 | |
| 1826 | ENSURE(cl.has_option("switch", 's')); |
| 1827 | } |
| 1828 | { |
| 1829 | const char *argv[] = { "prog", "--args", "orange", "apple" }; |
| 1830 | CommandLine cl(countof(argv), argv); |
| 1831 | |
| 1832 | const char *orange = cl.get_parameter(0, "args"); |
| 1833 | ENSURE(orange != NULL && strcmp(orange, "orange") == 0); |
| 1834 | const char *apple = cl.get_parameter(1, "args"); |
| 1835 | ENSURE(apple != NULL && strcmp(apple, "apple") == 0); |
| 1836 | const char *banana = cl.get_parameter(2, "banana"); |
| 1837 | ENSURE(banana == NULL); |
| 1838 | } |
| 1839 | { |
| 1840 | const char *argv[] = { "prog", "--bar", "--", "--baz" }; |
| 1841 | CommandLine cl(countof(argv), argv); |
| 1842 | |
| 1843 | ENSURE(cl.has_option("bar")); |
| 1844 | ENSURE(!cl.has_option("baz")); |
| 1845 | ENSURE(!cl.has_option("--")); |
| 1846 | ENSURE(cl.get_parameter(0, "bar") == NULL); |
| 1847 | } |
| 1848 | } |
| 1849 | |
| 1850 | static void test_thread() |
| 1851 | { |
nothing calls this directly
no test coverage detected