From 683bc0b5517bbc8ca3a3c5ea82d330e3caa24328 Mon Sep 17 00:00:00 2001 From: Stefan Schubert Date: Wed, 5 Mar 2008 09:43:01 +0000 Subject: [PATCH] splitted in two testcases --- tests/zypp/CMakeLists.txt | 2 +- tests/zypp/Vendor2_test.cc | 44 ++++++++++++++++++++++++++++++++++++++ tests/zypp/Vendor_test.cc | 19 ---------------- 3 files changed, 45 insertions(+), 20 deletions(-) create mode 100644 tests/zypp/Vendor2_test.cc diff --git a/tests/zypp/CMakeLists.txt b/tests/zypp/CMakeLists.txt index b726d03dd..7b5fcbb4e 100644 --- a/tests/zypp/CMakeLists.txt +++ b/tests/zypp/CMakeLists.txt @@ -1,5 +1,5 @@ ADD_SUBDIRECTORY(base) -ADD_TESTS(RWPtr Vendor TranslatedText PoolQuery KeyRing MediaSetAccess ResKind Arch Url Edition Capabilities CheckSum PublicKey PathInfo Digest Fetcher FileChecker RepoManager RepoInfo RepoStatus ProgressData ) +ADD_TESTS(RWPtr Vendor Vendor2 TranslatedText PoolQuery KeyRing MediaSetAccess ResKind Arch Url Edition Capabilities CheckSum PublicKey PathInfo Digest Fetcher FileChecker RepoManager RepoInfo RepoStatus ProgressData ) EXEC_PROGRAM( ln ARGS -sf "${CMAKE_CURRENT_SOURCE_DIR}/data" "${CMAKE_CURRENT_BINARY_DIR}/data" ) diff --git a/tests/zypp/Vendor2_test.cc b/tests/zypp/Vendor2_test.cc new file mode 100644 index 000000000..98e979b69 --- /dev/null +++ b/tests/zypp/Vendor2_test.cc @@ -0,0 +1,44 @@ + +#include +#include +#include + +// Boost.Test +#include + +#include "zypp/base/LogControl.h" +#include "zypp/base/Logger.h" +#include "zypp/base/Exception.h" +#include "zypp/ZYpp.h" +#include "zypp/VendorAttr.h" + +using boost::unit_test::test_case; +using namespace std; +using namespace zypp; + +namespace zypp +{ + void reconfigureZConfig( const Pathname & ); +} + +#define DATADIR (Pathname(TESTS_SRC_DIR) + "/zypp/data/Vendor") + + +BOOST_AUTO_TEST_CASE(vendor2_test) +{ + reconfigureZConfig( DATADIR / "zypp2.conf" ); + + BOOST_REQUIRE( VendorAttr::instance().equivalent("suse", "suse") ); + BOOST_REQUIRE( VendorAttr::instance().equivalent("equal", "equal") ); + BOOST_REQUIRE( VendorAttr::instance().equivalent("suse", "SuSE") ); + BOOST_REQUIRE( VendorAttr::instance().equivalent("opensuse", "SuSE") ); + BOOST_REQUIRE( !VendorAttr::instance().equivalent("open", "SuSE") ); + BOOST_REQUIRE( !VendorAttr::instance().equivalent("nothing", "SuSE") ); + BOOST_REQUIRE( VendorAttr::instance().equivalent("nvidia", "SuSE") ); + BOOST_REQUIRE( VendorAttr::instance().equivalent("nvidia_new_new", "SuSE") ); + BOOST_REQUIRE( VendorAttr::instance().equivalent("nvidia", "opensuse") ); + BOOST_REQUIRE( !VendorAttr::instance().equivalent("ati", "SuSE") ); + BOOST_REQUIRE( !VendorAttr::instance().equivalent("ati", "nvidia") ); + BOOST_REQUIRE( VendorAttr::instance().equivalent("ati_new", "ati") ); +} + diff --git a/tests/zypp/Vendor_test.cc b/tests/zypp/Vendor_test.cc index 1f328daf7..34337d846 100644 --- a/tests/zypp/Vendor_test.cc +++ b/tests/zypp/Vendor_test.cc @@ -36,22 +36,3 @@ BOOST_AUTO_TEST_CASE(vendor_test1) BOOST_REQUIRE( !VendorAttr::instance().equivalent("nothing", "SuSE") ); } -BOOST_AUTO_TEST_CASE(vendor_test2) -{ - reconfigureZConfig( DATADIR / "zypp2.conf" ); - // No vendor definition files has been readed. So only suse,opensuse vendors are - // equivalent - BOOST_REQUIRE( VendorAttr::instance().equivalent("suse", "suse") ); - BOOST_REQUIRE( VendorAttr::instance().equivalent("equal", "equal") ); - BOOST_REQUIRE( VendorAttr::instance().equivalent("suse", "SuSE") ); - BOOST_REQUIRE( !VendorAttr::instance().equivalent("opensuse", "SuSE") ); - BOOST_REQUIRE( !VendorAttr::instance().equivalent("open", "SuSE") ); - BOOST_REQUIRE( !VendorAttr::instance().equivalent("nothing", "SuSE") ); - BOOST_REQUIRE( VendorAttr::instance().equivalent("nvidia", "SuSE") ); - BOOST_REQUIRE( VendorAttr::instance().equivalent("nvidia_new_new", "SuSE") ); - BOOST_REQUIRE( !VendorAttr::instance().equivalent("nvidia", "opensuse") ); - BOOST_REQUIRE( !VendorAttr::instance().equivalent("ati", "SuSE") ); - BOOST_REQUIRE( !VendorAttr::instance().equivalent("ati", "nvidia") ); - BOOST_REQUIRE( VendorAttr::instance().equivalent("ati_new", "ati") ); -} - -- 2.34.1