Add unit tests for Error class
This commit is contained in:
parent
7119b7676f
commit
65568b056e
@ -6,6 +6,7 @@ add_executable(unit_tests
|
||||
test_bmpimage.cpp
|
||||
test_cr2header_int.cpp
|
||||
test_datasets.cpp
|
||||
test_Error.cpp
|
||||
test_DateValue.cpp
|
||||
test_enforce.cpp
|
||||
test_FileIo.cpp
|
||||
|
||||
22
unitTests/test_Error.cpp
Normal file
22
unitTests/test_Error.cpp
Normal file
@ -0,0 +1,22 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
|
||||
#include <exiv2/error.hpp>
|
||||
|
||||
#include <gtest/gtest.h>
|
||||
|
||||
using namespace Exiv2;
|
||||
|
||||
TEST(Error, parameterInsertion)
|
||||
{
|
||||
const Error err_with_3_params(ErrorCode::kerGeneralError, "foo", "bar", "baz");
|
||||
ASSERT_STREQ(err_with_3_params.what(), "Error 1: arg2=bar, arg3=baz, arg1=foo.");
|
||||
|
||||
const Error err_with_no_params(ErrorCode::kerSuccess);
|
||||
ASSERT_STREQ(err_with_no_params.what(), "Success");
|
||||
}
|
||||
|
||||
TEST(Error, tooManyParameters)
|
||||
{
|
||||
const Error err_with_no_params(ErrorCode::kerSuccess, "a param", "another param");
|
||||
ASSERT_STREQ(err_with_no_params.what(), "Success");
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user