annotate UnitTestsSources/TestExceptions.cpp @ 627:b7fd0471281c am-dev

fix CodeGeneration unit tests
author Alain Mazy <alain@mazy.be>
date Wed, 08 May 2019 10:51:41 +0200
parents b70e9be013e4
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
297
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
1 /**
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
2 * Stone of Orthanc
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
3 * Copyright (C) 2012-2016 Sebastien Jodogne, Medical Physics
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
4 * Department, University Hospital of Liege, Belgium
439
b70e9be013e4 preparing for 2019
Sebastien Jodogne <s.jodogne@gmail.com>
parents: 297
diff changeset
5 * Copyright (C) 2017-2019 Osimis S.A., Belgium
297
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
6 *
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
7 * This program is free software: you can redistribute it and/or
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
8 * modify it under the terms of the GNU Affero General Public License
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
9 * as published by the Free Software Foundation, either version 3 of
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
10 * the License, or (at your option) any later version.
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
11 *
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
12 * This program is distributed in the hope that it will be useful, but
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
15 * Affero General Public License for more details.
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
16 *
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
17 * You should have received a copy of the GNU Affero General Public License
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
18 * along with this program. If not, see <http://www.gnu.org/licenses/>.
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
19 **/
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
20
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
21
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
22 #include "gtest/gtest.h"
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
23
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
24 #include "../Framework/StoneException.h"
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
25
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
26
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
27
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
28 TEST(StoneExceptions, OrthancToStoneConversion)
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
29 {
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
30 bool hasBeenCatched = false;
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
31 try {
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
32 throw Orthanc::OrthancException(Orthanc::ErrorCode_InternalError);
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
33 }
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
34 catch (Orthanc::OrthancException& orthancException)
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
35 {
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
36 hasBeenCatched = true;
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
37 OrthancStone::StoneOrthancException stoneException(orthancException);
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
38 ASSERT_EQ(OrthancStone::ErrorCode_OrthancError, stoneException.GetErrorCode());
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
39 ASSERT_EQ(Orthanc::ErrorCode_InternalError, stoneException.GetOrthancErrorCode());
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
40 }
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
41
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
42 ASSERT_TRUE(hasBeenCatched);
1992f7b8563e introduced StoneException
am@osimis.io
parents:
diff changeset
43 }