1 /**
2   @file Test for Errata
3 
4   @section license License
5 
6   Licensed to the Apache Software Foundation (ASF) under one
7   or more contributor license agreements.  See the NOTICE file
8   distributed with this work for additional information
9   regarding copyright ownership.  The ASF licenses this file
10   to you under the Apache License, Version 2.0 (the
11   "License"); you may not use this file except in compliance
12   with the License.  You may obtain a copy of the License at
13 
14       http://www.apache.org/licenses/LICENSE-2.0
15 
16   Unless required by applicable law or agreed to in writing, software
17   distributed under the License is distributed on an "AS IS" BASIS,
18   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19   See the License for the specific language governing permissions and
20   limitations under the License.
21 */
22 
23 #include "catch.hpp"
24 
25 #include "tscore/Errata.h"
26 
27 TEST_CASE("Basic Errata with text only", "[errata]")
28 {
29   ts::Errata err;
30   std::string text{"Some error text"};
31   err.push(text);
32   REQUIRE(err.isOK()); // as code is 0 by default.
33   REQUIRE(err.top().text() == text);
34 }
35 
36 TEST_CASE("Basic Errata test with id and text", "[errata]")
37 {
38   ts::Errata err;
39   int id{1};
40   std::string text{"Some error text"};
41 
42   err.push(id, text);
43 
44   REQUIRE(err.isOK()); // as code is 0 by default.
45   REQUIRE(err.top().text() == text);
46 }
47 
48 TEST_CASE("Basic Errata test with id,code and text", "[errata]")
49 {
50   ts::Errata err;
51   int id{1};
52   unsigned int code{2};
53   std::string text{"Some error text"};
54 
55   err.push(id, code, text);
56 
57   REQUIRE(!err.isOK()); // This should not be ok as code now is 2
58   REQUIRE(err.top().getCode() == code);
59   REQUIRE(err.top().text() == text);
60 }
61