Author: schubi2 Date: Thu Jan 31 16:45:13 2008 New Revision: 8425 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8425&view=rev Log: add additional testcase for vendors Added: branches/tmp/ma/jump_sat/libzypp/tests/zypp/Vendor2.cc branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/vendors.d/ati branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/vendors.d/nvidia branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/zypp2.conf Modified: branches/tmp/ma/jump_sat/libzypp/tests/zypp/CMakeLists.txt Modified: branches/tmp/ma/jump_sat/libzypp/tests/zypp/CMakeLists.txt URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/tests/... ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/tests/zypp/CMakeLists.txt (original) +++ branches/tmp/ma/jump_sat/libzypp/tests/zypp/CMakeLists.txt Thu Jan 31 16:45:13 2008 @@ -68,6 +68,9 @@ ADD_EXECUTABLE(Vendor1 Vendor1.cc) TARGET_LINK_LIBRARIES(Vendor1 zypp boost_unit_test_framework ) +ADD_EXECUTABLE(Vendor2 Vendor2.cc) +TARGET_LINK_LIBRARIES(Vendor2 zypp boost_unit_test_framework ) + ADD_TEST(ArchTest ${CMAKE_CURRENT_BINARY_DIR}/Arch) ADD_TEST(UrlTest ${CMAKE_CURRENT_BINARY_DIR}/Url) ADD_TEST(Edition ${CMAKE_CURRENT_BINARY_DIR}/Edition) @@ -87,3 +90,4 @@ ADD_TEST(FetcherTest ${CMAKE_CURRENT_BINARY_DIR}/Fetcher) ADD_TEST(ProgressData_test ${CMAKE_CURRENT_BINARY_DIR}/ProgressData) ADD_TEST(Vendor1Test ${CMAKE_CURRENT_BINARY_DIR}/Vendor1) +ADD_TEST(Vendor2Test ${CMAKE_CURRENT_BINARY_DIR}/Vendor2) Added: branches/tmp/ma/jump_sat/libzypp/tests/zypp/Vendor2.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/tests/... ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/tests/zypp/Vendor2.cc (added) +++ branches/tmp/ma/jump_sat/libzypp/tests/zypp/Vendor2.cc Thu Jan 31 16:45:13 2008 @@ -0,0 +1,55 @@ + +#include <iostream> +#include <list> +#include <string> + +// Boost.Test +#include <boost/test/floating_point_comparison.hpp> +#include <boost/test/unit_test.hpp> + +using boost::unit_test::test_suite; +using boost::unit_test::test_case; +using boost::test_tools::close_at_tolerance; + +// parameterized test +// http://www.boost.org/libs/test/example/unit_test_example4.cpp + +#include "zypp/base/LogControl.h" +#include "zypp/base/Logger.h" +#include "zypp/base/Exception.h" +#include "zypp/ZYpp.h" +#include "zypp/VendorAttr.h" + +using namespace std; +using namespace zypp; + + +// most frequently you implement test cases as a free functions +void vendor_test() +{ + // 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") ); +} + +test_suite* +init_unit_test_suite( int, char* [] ) +{ + setenv("ZYPP_CONF", "./../../tests/zypp/data/Vendor/zypp2.conf", 1 ); + zypp::base::LogControl::instance().logfile( "-" ); + test_suite* test= BOOST_TEST_SUITE( "VendorTest" ); + test->add( BOOST_TEST_CASE( &vendor_test ), 5 /* expected zero error */ , 0); + return test; +} + Added: branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/vendors.d/ati URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/tests/... ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/vendors.d/ati (added) +++ branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/vendors.d/ati Thu Jan 31 16:45:13 2008 @@ -0,0 +1,3 @@ +[main] + +vendors = ati,ati_new,ati_old \ No newline at end of file Added: branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/vendors.d/nvidia URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/tests/... ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/vendors.d/nvidia (added) +++ branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/vendors.d/nvidia Thu Jan 31 16:45:13 2008 @@ -0,0 +1,3 @@ +[main] + +vendors = nvidia,suse,old_suse \ No newline at end of file Added: branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/zypp2.conf URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/tests/... ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/zypp2.conf (added) +++ branches/tmp/ma/jump_sat/libzypp/tests/zypp/data/Vendor/zypp2.conf Thu Jan 31 16:45:13 2008 @@ -0,0 +1,126 @@ +## Configuration file for software management +## /etc/zypp/zypp.conf +## +## Boolean values are 0 1 yes no on off true false + + +[main] + + +## +## Override the detected architecture +## +## Valid values: i586, i686, x86_64, ppc, ppc64, ia64, s390, s390x, .. +## Default value: Autodetected +## +## ** CAUTION: Only set if you know what you're doing ! +## ** Changing this needs a full refresh (incl. download) +## ** of all repository data. +## +# arch = s390 + + +## +## Path where the repo metadata is downloaded and kept. +## +## Valid values: A directory +## Default value: /var/cache/zypp/raw +## +## Changing this needs a full refresh (incl. download) of all repository data +## +# metadatadir = /var/cache/zypp/raw + + +## +## Path where the known repositories .repo files are kept +## +## Valid values: A directory +## Default value: /etc/zypp/repos.d +## +## Changing this invalidates all known repositories +## +# reposdir = /etc/zypp/repos.d + + +## +## Path where the processed cache is kept (this is where zypp.db is located) +## +## Valid values: A directory +## Default value: /var/cache/zypp +## +## Changing this needs a full refresh (except download) of all repository data +## +# cachedir = /var/cache/zypp + + +## +## Whether repository urls should be probed when added +## +## Valid values: boolean +## Default value: false +## +## If true, accessability of repositories is checked immediately (when added) +## (e.g. 'zypper ar' will check immediately) +## If false, accessability of repositories is checked when refreshed +## (e.g. 'zypper ar' will delay the check until the next refresh) +## +# repo.add.probe = false + + +## +## Amount of time in minutes that must pass before another refresh. +## +## Valid values: Integer +## Default value: 10 +## +## If you have autorefresh enabled for a repository, it is checked for +## up-to-date metadata not more often than every <repo.refresh.delay> +## minutes. If an automatic request for refresh comes before <repo.refresh.delay> +## minutes passed since the last check, the request is ignored. +## +## A value of 0 means the repository will always be checked. To get the oposite +## effect, disable autorefresh for your repositories. +## +## This option has no effect for repositories with autorefresh disabled, nor for +## user-requested refresh. +## +# repo.refresh.delay = 10 + + +## +## Whether to consider using a .patch.rpm when downloading a package +## +## Valid values: boolean +## Default value: true +## +## Using a patch rpm will decrease the download size for package updates +## since it does not contain all files of the package but only the changed +## ones. The .patch.rpm is ready to be installed immediately after download. +## There is no further processing needed, as it is for a .delta.rpm. +## +# download.use_patchrpm = true + + +## +## Whether to consider using a .delta.rpm when downloading a package +## +## Valid values: boolean +## Default value: true +## +## Using a delta rpm will decrease the download size for package updates +## since it does not contain all files of the package but only the binary +## diff of changed ones. Recreating the rpm package on the local machine +## is an expensive operation (memory,CPU). If your network connection is +## not too slow, you benefit from disabling .delta.rpm. +## +# download.use_deltarpm = true + + +## +## Defining directory for equivalent vendors +## +## Valid values: A directory +## Default value: /etc/zypp/vondors.d +## +vendordir = ./../../tests/zypp/data/Vendor/vendors.d + -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org