Commit 51ea7ebeb0beccbdcd070c2af0963d19f85bc30d

Authored by Henry Schreiner
Committed by GitHub
1 parent 3eb5e1ee

drop: set (#565)

* refactor!: drop sets

* ci: fix clang 10 build
azure-pipelines.yml
@@ -121,7 +121,7 @@ jobs: @@ -121,7 +121,7 @@ jobs:
121 cli11.std: 17 121 cli11.std: 17
122 cli11.options: -DCLI11_FORCE_LIBCXX=ON 122 cli11.options: -DCLI11_FORCE_LIBCXX=ON
123 clang10_20: 123 clang10_20:
124 - containerImage: helics/buildenv:clang10-builder 124 + containerImage: silkeh/clang:10
125 cli11.std: 20 125 cli11.std: 20
126 cli11.options: -DCLI11_FORCE_LIBCXX=ON -DCMAKE_CXX_FLAGS=-std=c++20 126 cli11.options: -DCLI11_FORCE_LIBCXX=ON -DCMAKE_CXX_FLAGS=-std=c++20
127 container: $[ variables['containerImage'] ] 127 container: $[ variables['containerImage'] ]
include/CLI/App.hpp
@@ -897,56 +897,6 @@ class App { @@ -897,56 +897,6 @@ class App {
897 } 897 }
898 #endif 898 #endif
899 899
900 - /// Add set of options (No default, temp reference, such as an inline set) DEPRECATED  
901 - template <typename T>  
902 - Option *add_set(std::string option_name,  
903 - T &member, ///< The selected member of the set  
904 - std::set<T> options, ///< The set of possibilities  
905 - std::string option_description = "") {  
906 -  
907 - Option *opt = add_option(option_name, member, std::move(option_description));  
908 - opt->check(IsMember{options});  
909 - return opt;  
910 - }  
911 -  
912 - /// Add set of options (No default, set can be changed afterwards - do not destroy the set) DEPRECATED  
913 - template <typename T>  
914 - Option *add_mutable_set(std::string option_name,  
915 - T &member, ///< The selected member of the set  
916 - const std::set<T> &options, ///< The set of possibilities  
917 - std::string option_description = "") {  
918 -  
919 - Option *opt = add_option(option_name, member, std::move(option_description));  
920 - opt->check(IsMember{&options});  
921 - return opt;  
922 - }  
923 -  
924 - /// Add set of options (with default, static set, such as an inline set) DEPRECATED  
925 - template <typename T>  
926 - Option *add_set(std::string option_name,  
927 - T &member, ///< The selected member of the set  
928 - std::set<T> options, ///< The set of possibilities  
929 - std::string option_description,  
930 - bool defaulted) {  
931 -  
932 - Option *opt = add_option(option_name, member, std::move(option_description), defaulted);  
933 - opt->check(IsMember{options});  
934 - return opt;  
935 - }  
936 -  
937 - /// Add set of options (with default, set can be changed afterwards - do not destroy the set) DEPRECATED  
938 - template <typename T>  
939 - Option *add_mutable_set(std::string option_name,  
940 - T &member, ///< The selected member of the set  
941 - const std::set<T> &options, ///< The set of possibilities  
942 - std::string option_description,  
943 - bool defaulted) {  
944 -  
945 - Option *opt = add_option(option_name, member, std::move(option_description), defaulted);  
946 - opt->check(IsMember{&options});  
947 - return opt;  
948 - }  
949 -  
950 /// Add a complex number DEPRECATED --use add_option instead 900 /// Add a complex number DEPRECATED --use add_option instead
951 template <typename T, typename XC = double> 901 template <typename T, typename XC = double>
952 Option *add_complex(std::string option_name, 902 Option *add_complex(std::string option_name,
tests/DeprecatedTest.cpp
@@ -15,144 +15,6 @@ TEST_CASE(&quot;Deprecated: Empty&quot;, &quot;[deprecated]&quot;) { @@ -15,144 +15,6 @@ TEST_CASE(&quot;Deprecated: Empty&quot;, &quot;[deprecated]&quot;) {
15 15
16 // Classic sets 16 // Classic sets
17 17
18 -TEST_CASE_METHOD(TApp, "SetWithDefaults", "[deprecated]") {  
19 - int someint = 2;  
20 - app.add_set("-a", someint, {1, 2, 3, 4}, "", true);  
21 -  
22 - args = {"-a1", "-a2"};  
23 -  
24 - CHECK_THROWS_AS(run(), CLI::ArgumentMismatch);  
25 -}  
26 -  
27 -TEST_CASE_METHOD(TApp, "SetWithDefaultsConversion", "[deprecated]") {  
28 - int someint = 2;  
29 - app.add_set("-a", someint, {1, 2, 3, 4}, "", true);  
30 -  
31 - args = {"-a", "hi"};  
32 -  
33 - CHECK_THROWS_AS(run(), CLI::ValidationError);  
34 -}  
35 -  
36 -TEST_CASE_METHOD(TApp, "InSet", "[deprecated]") {  
37 -  
38 - std::string choice;  
39 - app.add_set("-q,--quick", choice, {"one", "two", "three"});  
40 -  
41 - args = {"--quick", "two"};  
42 -  
43 - run();  
44 - CHECK(choice == "two");  
45 -  
46 - args = {"--quick", "four"};  
47 - CHECK_THROWS_AS(run(), CLI::ValidationError);  
48 -}  
49 -  
50 -TEST_CASE_METHOD(TApp, "InSetWithDefault", "[deprecated]") {  
51 -  
52 - std::string choice = "one";  
53 - app.add_set("-q,--quick", choice, {"one", "two", "three"}, "", true);  
54 -  
55 - run();  
56 - CHECK(choice == "one");  
57 -  
58 - args = {"--quick", "two"};  
59 -  
60 - run();  
61 - CHECK(choice == "two");  
62 -  
63 - args = {"--quick", "four"};  
64 - CHECK_THROWS_AS(run(), CLI::ValidationError);  
65 -}  
66 -  
67 -TEST_CASE_METHOD(TApp, "InIntSet", "[deprecated]") {  
68 -  
69 - int choice;  
70 - app.add_set("-q,--quick", choice, {1, 2, 3});  
71 -  
72 - args = {"--quick", "2"};  
73 -  
74 - run();  
75 - CHECK(choice == 2);  
76 -  
77 - args = {"--quick", "4"};  
78 - CHECK_THROWS_AS(run(), CLI::ValidationError);  
79 -}  
80 -  
81 -TEST_CASE_METHOD(TApp, "InIntSetWindows", "[deprecated]") {  
82 -  
83 - int choice;  
84 - app.add_set("-q,--quick", choice, {1, 2, 3});  
85 - app.allow_windows_style_options();  
86 - args = {"/q", "2"};  
87 -  
88 - run();  
89 - CHECK(choice == 2);  
90 -  
91 - args = {"/q", "4"};  
92 - CHECK_THROWS_AS(run(), CLI::ValidationError);  
93 -  
94 - args = {"/q4"};  
95 - CHECK_THROWS_AS(run(), CLI::ExtrasError);  
96 -}  
97 -  
98 -TEST_CASE_METHOD(TApp, "FailSet", "[deprecated]") {  
99 -  
100 - int choice;  
101 - app.add_set("-q,--quick", choice, {1, 2, 3});  
102 -  
103 - args = {"--quick", "3", "--quick=2"};  
104 - CHECK_THROWS_AS(run(), CLI::ArgumentMismatch);  
105 -  
106 - args = {"--quick=hello"};  
107 - CHECK_THROWS_AS(run(), CLI::ValidationError);  
108 -}  
109 -  
110 -TEST_CASE_METHOD(TApp, "FailMutableSet", "[deprecated]") {  
111 -  
112 - int choice;  
113 - std::set<int> vals{1, 2, 3};  
114 - app.add_mutable_set("-q,--quick", choice, vals);  
115 - app.add_mutable_set("-s,--slow", choice, vals, "", true);  
116 -  
117 - args = {"--quick=hello"};  
118 - CHECK_THROWS_AS(run(), CLI::ValidationError);  
119 -  
120 - args = {"--slow=hello"};  
121 - CHECK_THROWS_AS(run(), CLI::ValidationError);  
122 -}  
123 -  
124 -// #113  
125 -TEST_CASE_METHOD(TApp, "AddRemoveSetItems", "[deprecated]") {  
126 - std::set<std::string> items{"TYPE1", "TYPE2", "TYPE3", "TYPE4", "TYPE5"};  
127 -  
128 - std::string type1, type2;  
129 - app.add_mutable_set("--type1", type1, items);  
130 - app.add_mutable_set("--type2", type2, items, "", true);  
131 -  
132 - args = {"--type1", "TYPE1", "--type2", "TYPE2"};  
133 -  
134 - run();  
135 - CHECK("TYPE1" == type1);  
136 - CHECK("TYPE2" == type2);  
137 -  
138 - items.insert("TYPE6");  
139 - items.insert("TYPE7");  
140 -  
141 - items.erase("TYPE1");  
142 - items.erase("TYPE2");  
143 -  
144 - args = {"--type1", "TYPE6", "--type2", "TYPE7"};  
145 - run();  
146 - CHECK("TYPE6" == type1);  
147 - CHECK("TYPE7" == type2);  
148 -  
149 - args = {"--type1", "TYPE1"};  
150 - CHECK_THROWS_AS(run(), CLI::ValidationError);  
151 -  
152 - args = {"--type2", "TYPE2"};  
153 - CHECK_THROWS_AS(run(), CLI::ValidationError);  
154 -}  
155 -  
156 TEST_CASE("THelp: Defaults", "[deprecated]") { 18 TEST_CASE("THelp: Defaults", "[deprecated]") {
157 CLI::App app{"My prog"}; 19 CLI::App app{"My prog"};
158 20