From 00dcfaaddb37fb6d2b417030187a4548a8e9dc14 Mon Sep 17 00:00:00 2001 From: Philipp Storz Date: Fri, 4 Sep 2020 21:40:20 +0200 Subject: [PATCH] gtests: introduced test for edit.cc --- core/src/tests/CMakeLists.txt | 5 +++++ core/src/tests/test_edit.cc | 31 +++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 core/src/tests/test_edit.cc diff --git a/core/src/tests/CMakeLists.txt b/core/src/tests/CMakeLists.txt index d8714629c31..57ee87bb33a 100644 --- a/core/src/tests/CMakeLists.txt +++ b/core/src/tests/CMakeLists.txt @@ -417,3 +417,8 @@ if(NOT client-only) SKIP_GTEST ) endif() # NOT client-only + +bareos_add_test( + test_edit LINK_LIBRARIES bareos ${GTEST_LIBRARIES} + ${GTEST_MAIN_LIBRARIES} +) diff --git a/core/src/tests/test_edit.cc b/core/src/tests/test_edit.cc new file mode 100644 index 00000000000..ace06494b86 --- /dev/null +++ b/core/src/tests/test_edit.cc @@ -0,0 +1,31 @@ +/* + BAREOSĀ® - Backup Archiving REcovery Open Sourced + + Copyright (C) 2018-2020 Bareos GmbH & Co. KG + + This program is Free Software; you can redistribute it and/or + modify it under the terms of version three of the GNU Affero General Public + License as published by the Free Software Foundation and included + in the file LICENSE. + + This program is distributed in the hope that it will be useful, but + WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + 02110-1301, USA. +*/ +#if defined(HAVE_MINGW) +#include "include/bareos.h" +#include "gtest/gtest.h" +#else +#include "gtest/gtest.h" +#include "include/bareos.h" +#endif + +#include "lib/edit.h" + +TEST(edit, edit) { ASSERT_EQ(str_to_uint64("1 kb"), 1024); }