Author: mlandres Date: Mon Jan 28 17:40:35 2008 New Revision: 8379 URL: http://svn.opensuse.org/viewcvs/zypp?rev=8379&view=rev Log: activate capability testcases Modified: branches/tmp/ma/jump_sat/libzypp/tests/zypp/CMakeLists.txt branches/tmp/ma/jump_sat/libzypp/tests/zypp/Capabilities.cc 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 Mon Jan 28 17:40:35 2008 @@ -1,3 +1,6 @@ +# source: ${loop_var}_test.cc +# executable: ${loop_var}_test +# test: ${loop_var}_test FOREACH( loop_var ResKind) ADD_EXECUTABLE( ${loop_var}_test ${loop_var}_test.cc ) TARGET_LINK_LIBRARIES( ${loop_var}_test zypp boost_unit_test_framework ) @@ -17,8 +20,8 @@ ADD_EXECUTABLE(Edition Edition.cc) TARGET_LINK_LIBRARIES(Edition zypp boost_unit_test_framework ) -#ADD_EXECUTABLE(Capabilities Capabilities.cc) -#TARGET_LINK_LIBRARIES(Capabilities zypp boost_unit_test_framework ) +ADD_EXECUTABLE(Capabilities Capabilities.cc) +TARGET_LINK_LIBRARIES(Capabilities zypp boost_unit_test_framework ) ADD_EXECUTABLE(PtrTypes PtrTypes.cc) TARGET_LINK_LIBRARIES(PtrTypes zypp ) Modified: branches/tmp/ma/jump_sat/libzypp/tests/zypp/Capabilities.cc URL: http://svn.opensuse.org/viewcvs/zypp/branches/tmp/ma/jump_sat/libzypp/tests/... ============================================================================== --- branches/tmp/ma/jump_sat/libzypp/tests/zypp/Capabilities.cc (original) +++ branches/tmp/ma/jump_sat/libzypp/tests/zypp/Capabilities.cc Mon Jan 28 17:40:35 2008 @@ -1,6 +1,6 @@ // Capabilities.cc // -// tests for Capabilities +// tests for Capabilities // #include <string> @@ -8,8 +8,7 @@ #include <boost/test/floating_point_comparison.hpp> #include <boost/test/unit_test.hpp> -#include "zypp/base/Logger.h" -#include "zypp/CapFactory.h" +#include "zypp/Capability.h" using boost::unit_test::test_suite; using boost::unit_test::test_case; @@ -22,41 +21,63 @@ { // Resolvable::Kind kind = ResTraitszypp::Package::kind; // CapFactory factory; -// +// // Edition edition ("1.0", "42"); // Capability cap = factory.parse ( kind, "foo", "=", "1.0-42"); // BOOST_CHECK_EQUAL( cap.asString(), "foo == 1.0-42" ); // BOOST_CHECK_EQUAL( cap.index(), "foo"); // BOOST_CHECK_EQUAL( cap.op(), Rel::EQ); // BOOST_CHECK_EQUAL( cap.edition(), edition); -// +// // Capability cap2 = factory.parse ( kind, "foo", Rel::EQ, edition); // BOOST_CHECK_EQUAL( cap2.index(), cap.index()); // BOOST_CHECK_EQUAL( cap2.op(), cap.op()); // BOOST_CHECK_EQUAL( cap2.edition(), cap.edition()); -// +// // Capability cap3 = factory.parse ( kind, "foo = 1.0-42"); // BOOST_CHECK_EQUAL( cap3.index(), cap.index()); // BOOST_CHECK_EQUAL( cap3.op(), cap.op()); // BOOST_CHECK_EQUAL( cap3.edition(), cap.edition()); -// +// // Capability cap6 = factory.parse ( kind, "kdelibs* > 1.5"); // BOOST_CHECK_EQUAL( cap6.index(), "kdelibs*"); // BOOST_CHECK_EQUAL( cap6.op(), Rel::GT); // BOOST_CHECK_EQUAL( cap6.edition(), Edition("1.5")); -// -// +// +// // string bash = "/bin/bash"; // Capability cap4 = factory.parse ( kind, bash); // BOOST_CHECK_EQUAL(cap4.index(), bash); // BOOST_CHECK_EQUAL(cap4.op(), Rel::NONE); // BOOST_CHECK_EQUAL(cap4.edition(), Edition::noedition); -// +// // string hal = "hal(smp)"; // Capability cap5 = factory.parse ( kind, hal); // BOOST_CHECK_EQUAL(cap5.index(), "hal()"); // BOOST_CHECK_EQUAL(cap5.op(), Rel::NONE); // BOOST_CHECK_EQUAL(cap5.edition(), Edition::noedition); + + Capability c0( 0 ); // id 0 + Capability c1( 1 ); // id 1 + Capability cD; // default constructed empty + Capability cE( "" );// empty + + BOOST_CHECK_EQUAL( c0.id(), 0 ); + BOOST_CHECK_EQUAL( c1.id(), 1 ); + BOOST_CHECK_EQUAL( Capability().id(), 1 ); // default constructed empty + BOOST_CHECK_EQUAL( Capability("").id(), 1 ); // empty + + BOOST_CHECK_EQUAL( c0.asString(), "" ); + BOOST_CHECK_EQUAL( c1.asString(), "" ); + + BOOST_CHECK_EQUAL( c0.empty(), true ); + BOOST_CHECK_EQUAL( c1.empty(), true ); + + BOOST_CHECK_EQUAL( c0.detail().kind(), CapDetail::NOCAP ); + BOOST_CHECK_EQUAL( c1.detail().kind(), CapDetail::NOCAP ); + + BOOST_CHECK_EQUAL( ( c0 == c1 ), false ); + BOOST_CHECK_EQUAL( Capability::matches( c0, c1 ), CapMatch::yes ); } test_suite* -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org