Lines Matching full:options
9 #include "Options.h"
17 bool operator==(const Options &lhs, const Options &rhs) { in operator ==()
27 std::ostream &operator<<(std::ostream &out, const Options &opt) { in operator <<()
76 constexpr auto autoMode = Options::WriteMode::Auto;
79 #define EXPECT_SUCCESS(...) EXPECT_EQ(Options::Status::Success, __VA_ARGS__)
80 #define EXPECT_FAILURE(...) EXPECT_EQ(Options::Status::Failure, __VA_ARGS__)
81 #define EXPECT_MESSAGE(...) EXPECT_EQ(Options::Status::Message, __VA_ARGS__)
88 TEST(Options, ValidInputs) { in TEST() argument
90 Options options; in TEST() local
92 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
93 Options expected = {5, 23, 3, false, {"y"}, "x", in TEST()
95 EXPECT_EQ(expected, options); in TEST()
98 Options options; in TEST() local
100 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
101 Options expected = {1, 23, 19, false, {"input"}, "", in TEST()
103 EXPECT_EQ(expected, options); in TEST()
106 Options options; in TEST() local
109 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
110 Options expected = {1, 0, 22, true, {"x.zst"}, "x", in TEST()
112 EXPECT_EQ(expected, options); in TEST()
115 Options options; in TEST() local
118 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
119 Options expected = {100, 23, 3, true, {"hello.zst"}, "", true, in TEST()
121 EXPECT_EQ(expected, options); in TEST()
124 Options options; in TEST() local
126 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
127 Options expected = {1, 23, 3, true, {"x"}, "-", in TEST()
129 EXPECT_EQ(expected, options); in TEST()
132 Options options; in TEST() local
134 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
135 Options expected = {1, 23, 3, true, {"x"}, "-", in TEST()
137 EXPECT_EQ(expected, options); in TEST()
140 Options options; in TEST() local
142 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
143 Options expected = {1, 0, 5, true, {"x"}, "-", in TEST()
145 EXPECT_EQ(expected, options); in TEST()
148 Options options; in TEST() local
150 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
151 Options expected = {2, in TEST()
162 EXPECT_EQ(expected, options); in TEST()
165 Options options; in TEST() local
167 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
170 Options options; in TEST() local
172 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
176 TEST(Options, GetOutputFile) { in TEST() argument
178 Options options; in TEST() local
180 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
181 EXPECT_EQ("x.zst", options.getOutputFile(options.inputFiles[0])); in TEST()
184 Options options; in TEST() local
186 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
187 EXPECT_EQ(nullOutput, options.getOutputFile(options.inputFiles[0])); in TEST()
190 Options options; in TEST() local
192 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
193 EXPECT_EQ(nullOutput, options.getOutputFile(options.inputFiles[0])); in TEST()
196 Options options; in TEST() local
198 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
199 EXPECT_EQ("x", options.getOutputFile(options.inputFiles[0])); in TEST()
202 Options options; in TEST() local
204 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
205 EXPECT_EQ("", options.getOutputFile(options.inputFiles[0])); in TEST()
208 Options options; in TEST() local
210 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
211 EXPECT_EQ("xx", options.getOutputFile(options.inputFiles[0])); in TEST()
215 TEST(Options, MultipleFiles) { in TEST() argument
217 Options options; in TEST() local
219 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
220 Options expected; in TEST()
223 EXPECT_EQ(expected, options); in TEST()
226 Options options; in TEST() local
228 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
229 Options expected; in TEST()
233 EXPECT_EQ(expected, options); in TEST()
236 Options options; in TEST() local
238 EXPECT_FAILURE(options.parse(args.size(), args.data())); in TEST()
241 Options options; in TEST() local
243 EXPECT_FAILURE(options.parse(args.size(), args.data())); in TEST()
246 Options options; in TEST() local
248 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
249 Options expected = {4, 23, 12, true, {"x", "--rm", "-c"}, in TEST()
252 EXPECT_EQ(expected, options); in TEST()
256 TEST(Options, NumThreads) { in TEST() argument
258 Options options; in TEST() local
260 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
263 Options options; in TEST() local
265 EXPECT_FAILURE(options.parse(args.size(), args.data())); in TEST()
268 Options options; in TEST() local
270 EXPECT_FAILURE(options.parse(args.size(), args.data())); in TEST()
274 TEST(Options, BadCompressionLevel) { in TEST() argument
276 Options options; in TEST() local
278 EXPECT_FAILURE(options.parse(args.size(), args.data())); in TEST()
281 Options options; in TEST() local
283 EXPECT_FAILURE(options.parse(args.size(), args.data())); in TEST()
286 Options options; in TEST() local
288 EXPECT_FAILURE(options.parse(args.size(), args.data())); in TEST()
292 TEST(Options, InvalidOption) { in TEST() argument
294 Options options; in TEST() local
296 EXPECT_FAILURE(options.parse(args.size(), args.data())); in TEST()
300 TEST(Options, BadOutputFile) { in TEST() argument
302 Options options; in TEST() local
304 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
305 EXPECT_EQ("", options.getOutputFile(options.inputFiles.front())); in TEST()
309 TEST(Options, BadOptionsWithArguments) { in TEST() argument
311 Options options; in TEST() local
313 EXPECT_FAILURE(options.parse(args.size(), args.data())); in TEST()
316 Options options; in TEST() local
318 EXPECT_FAILURE(options.parse(args.size(), args.data())); in TEST()
321 Options options; in TEST() local
323 EXPECT_FAILURE(options.parse(args.size(), args.data())); in TEST()
326 Options options; in TEST() local
328 EXPECT_FAILURE(options.parse(args.size(), args.data())); in TEST()
331 Options options; in TEST() local
333 EXPECT_FAILURE(options.parse(args.size(), args.data())); in TEST()
337 TEST(Options, KeepSource) { in TEST() argument
339 Options options; in TEST() local
341 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
342 EXPECT_EQ(true, options.keepSource); in TEST()
345 Options options; in TEST() local
347 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
348 EXPECT_EQ(true, options.keepSource); in TEST()
351 Options options; in TEST() local
353 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
354 EXPECT_EQ(true, options.keepSource); in TEST()
357 Options options; in TEST() local
359 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
360 EXPECT_EQ(false, options.keepSource); in TEST()
364 TEST(Options, Verbosity) { in TEST() argument
366 Options options; in TEST() local
368 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
369 EXPECT_EQ(2, options.verbosity); in TEST()
372 Options options; in TEST() local
374 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
375 EXPECT_EQ(-1, options.verbosity); in TEST()
378 Options options; in TEST() local
380 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
381 EXPECT_EQ(1, options.verbosity); in TEST()
384 Options options; in TEST() local
386 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
387 EXPECT_EQ(1, options.verbosity); in TEST()
390 Options options; in TEST() local
392 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
393 EXPECT_EQ(1, options.verbosity); in TEST()
396 Options options; in TEST() local
398 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
399 EXPECT_EQ(3, options.verbosity); in TEST()
402 Options options; in TEST() local
404 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
405 EXPECT_EQ(3, options.verbosity); in TEST()
409 TEST(Options, TestMode) { in TEST() argument
411 Options options; in TEST() local
413 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
414 EXPECT_EQ(true, options.keepSource); in TEST()
415 EXPECT_EQ(true, options.decompress); in TEST()
416 EXPECT_EQ(nullOutput, options.outputFile); in TEST()
419 Options options; in TEST() local
421 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
422 EXPECT_EQ(true, options.keepSource); in TEST()
423 EXPECT_EQ(true, options.decompress); in TEST()
424 EXPECT_EQ(nullOutput, options.outputFile); in TEST()
428 TEST(Options, Checksum) { in TEST() argument
430 Options options; in TEST() local
432 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
433 EXPECT_EQ(true, options.checksum); in TEST()
436 Options options; in TEST() local
438 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
439 EXPECT_EQ(true, options.checksum); in TEST()
442 Options options; in TEST() local
444 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
445 EXPECT_EQ(true, options.checksum); in TEST()
448 Options options; in TEST() local
450 EXPECT_SUCCESS(options.parse(args.size(), args.data())); in TEST()
451 EXPECT_EQ(false, options.checksum); in TEST()
455 TEST(Options, InputFiles) { in TEST() argument
457 Options options; in TEST() local
459 options.parse(args.size(), args.data()); in TEST()
460 EXPECT_EQ(1, options.inputFiles.size()); in TEST()
461 EXPECT_EQ("-", options.inputFiles[0]); in TEST()
462 EXPECT_EQ("-", options.outputFile); in TEST()
465 Options options; in TEST() local
467 options.parse(args.size(), args.data()); in TEST()
468 EXPECT_EQ(1, options.inputFiles.size()); in TEST()
469 EXPECT_EQ("-", options.inputFiles[0]); in TEST()
470 EXPECT_EQ("-", options.outputFile); in TEST()
473 Options options; in TEST() local
475 options.parse(args.size(), args.data()); in TEST()
476 EXPECT_EQ(1, options.inputFiles.size()); in TEST()
477 EXPECT_EQ("-", options.inputFiles[0]); in TEST()
478 EXPECT_EQ("-", options.outputFile); in TEST()
481 Options options; in TEST() local
483 EXPECT_FAILURE(options.parse(args.size(), args.data())); in TEST()
487 TEST(Options, InvalidOptions) { in TEST() argument
489 Options options; in TEST() local
491 EXPECT_FAILURE(options.parse(args.size(), args.data())); in TEST()
494 Options options; in TEST() local
496 EXPECT_FAILURE(options.parse(args.size(), args.data())); in TEST()
499 Options options; in TEST() local
501 EXPECT_FAILURE(options.parse(args.size(), args.data())); in TEST()
504 Options options; in TEST() local
506 EXPECT_FAILURE(options.parse(args.size(), args.data())); in TEST()
510 TEST(Options, Extras) { in TEST() argument
512 Options options; in TEST() local
514 EXPECT_MESSAGE(options.parse(args.size(), args.data())); in TEST()
517 Options options; in TEST() local
519 EXPECT_MESSAGE(options.parse(args.size(), args.data())); in TEST()
522 Options options; in TEST() local
524 EXPECT_MESSAGE(options.parse(args.size(), args.data())); in TEST()
527 Options options; in TEST() local
529 EXPECT_MESSAGE(options.parse(args.size(), args.data())); in TEST()
532 Options options; in TEST() local
534 EXPECT_MESSAGE(options.parse(args.size(), args.data())); in TEST()