-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCommandLineParser_test.cpp
More file actions
54 lines (45 loc) · 1.99 KB
/
Copy pathCommandLineParser_test.cpp
File metadata and controls
54 lines (45 loc) · 1.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/**
* @file
* Copyright (c) 2023 - Tidaly
* Authors:
* - Philippe CHEYPE <philippe.cheype@epitech.eu>
* NOTICE: All information contained herein is, and remains
* the property of Tidaly. Dissemination of this information
* or reproduction of this material is strictly forbidden
* unless prior written permission is obtained from Tidaly.
*/
#include "Core/Error/Error.hpp"
#include "Core/CommandLineParser/CommandLineParser.hpp"
#include <catch2/catch_test_macros.hpp>
TEST_CASE("Check parameters", "[core][clp]") {
CommandLineParser parser;
SECTION("Check wrong parameter") {
char *av[] = {(char *)"./tidaly-ocr", (char *)"--wrong-option"};
REQUIRE_THROWS_AS(parser.parse(2, av), ParametersError);
}
SECTION("Check bad output type") {
CommandLineParser parser;
char *av[] = {(char *)"./tidaly-ocr", (char *)"--output", (char *)"BAD", (char *)"./output.bad"};
REQUIRE_THROWS_AS(parser.parse(4, av), std::exception);
}
SECTION("Check help parameter") {
char *av[] = {(char *)"./tidaly-ocr", (char *)"--help"};
REQUIRE_NOTHROW(parser.parse(2, av));
}
SECTION("Check output CSV and debug") {
char *av[] = {(char *)"./tidaly-ocr", (char *)"--debug", (char *)"--output", (char *)"CSV", (char *)"./output.csv"};
REQUIRE_NOTHROW(parser.parse(5, av));
}
SECTION("Check output FIFO") {
char *av[] = {(char *)"./tidaly-ocr", (char *)"--output", (char *)"FIFO", (char *)"./output.fifo"};
REQUIRE_NOTHROW(parser.parse(4, av));
}
SECTION("Check output malformed FIFO") {
char *av[] = {(char *)"./tidaly-ocr", (char *)"--output", (char *)"BadOptionAndMissingFile"};
REQUIRE_THROWS_AS(parser.parse(3, av), std::exception);
}
SECTION("Check input Image") {
char *av[] = {(char *)"./tidaly-ocr", (char *)"--input", (char *)"./Assets/input/input_test.jpg"};
REQUIRE_NOTHROW(parser.parse(3, av));
}
}