]> git.donarmstrong.com Git - flightcrew.git/blob - src/FlightCrew/tests/opf_tests/OneManifest_test.cpp
Imported Upstream version 0.7.2+dfsg
[flightcrew.git] / src / FlightCrew / tests / opf_tests / OneManifest_test.cpp
1 /************************************************************************
2 **
3 **  Copyright (C) 2010  Strahinja Markovic
4 **
5 **  This file is part of FlightCrew.
6 **
7 **  FlightCrew is free software: you can redistribute it and/or modify
8 **  it under the terms of the GNU Lesser General Public License as published
9 **  by the Free Software Foundation, either version 3 of the License, or
10 **  (at your option) any later version.
11 **
12 **  FlightCrew is distributed in the hope that it will be useful,
13 **  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 **  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 **  GNU Lesser General Public License for more details.
16 **
17 **  You should have received a copy of the GNU Lesser General Public License
18 **  along with FlightCrew.  If not, see <http://www.gnu.org/licenses/>.
19 **
20 *************************************************************************/
21
22 #include <stdafx_tests.h>
23 #include "Validators/Opf/OneManifest.h"
24 #include "Result.h"
25
26 using namespace FlightCrew;
27
28 TEST( OneManifestTest, NoManifest_Error )
29 {
30     OneManifest validator;
31     std::vector<Result> results = validator.ValidateFile(
32             "test_data/opf_tests/OneManifest_NoManifest.xml" );
33
34     ASSERT_EQ( results.size(), 1U );
35     EXPECT_EQ( results[ 0 ].GetResultId(), ERROR_XML_WRONG_ELEMENT_COUNT );
36     EXPECT_EQ( results[ 0 ].GetErrorLine(), 2 );
37     EXPECT_EQ( results[ 0 ].GetErrorColumn(), 88 );
38
39     std::vector< std::string > message_arguments = results[ 0 ].GetMessageArguments();
40     EXPECT_EQ( message_arguments[ 0 ], "manifest" );
41 }
42
43 TEST( OneManifestTest, TwoManifests_Error )
44 {
45     OneManifest validator;
46     std::vector<Result> results = validator.ValidateFile(
47             "test_data/opf_tests/OneManifest_TwoManifests.xml" );
48
49     ASSERT_EQ( results.size(), 1U );
50     EXPECT_EQ( results[ 0 ].GetResultId(), ERROR_XML_WRONG_ELEMENT_COUNT );
51     EXPECT_EQ( results[ 0 ].GetErrorLine(), 5 );
52     EXPECT_EQ( results[ 0 ].GetErrorColumn(), 11 );
53
54     std::vector< std::string > message_arguments = results[ 0 ].GetMessageArguments();
55     EXPECT_EQ( message_arguments[ 0 ], "manifest" );
56 }
57
58 TEST( OneManifestTest, OneManifest_OK )
59 {
60     OneManifest validator;
61     std::vector<Result> results = validator.ValidateFile(
62             "test_data/opf_tests/OneManifest_OneManifest.xml" );
63
64     ASSERT_EQ( results.size(), 0U );
65 }
66