SpecificityTest.C 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #include <boost/test/unit_test.hpp>
  2. #include <Wt/Render/Specificity.h>
  3. using namespace Wt::Render;
  4. bool operator<(const Specificity& a, const Specificity& b)
  5. {
  6. return a.isSmallerThen(b);
  7. }
  8. bool operator>=(const Specificity& a, const Specificity& b)
  9. {
  10. return a.isGreaterOrEqualThen(b);
  11. }
  12. bool operator>(const Specificity& a, const Specificity& b)
  13. {
  14. return a.isGreaterThen(b);
  15. }
  16. bool operator<=(const Specificity& a, const Specificity& b)
  17. {
  18. return a.isSmallerOrEqualThen(b);
  19. }
  20. BOOST_AUTO_TEST_CASE( Specificity_test )
  21. {
  22. BOOST_REQUIRE(Specificity(0,0,0,2) < Specificity(0,0,0,3));
  23. BOOST_REQUIRE(Specificity(false) < Specificity(0,0,0,0));
  24. BOOST_REQUIRE(Specificity(0,0,0,0) < Specificity(0,0,0,2));
  25. BOOST_REQUIRE(Specificity(0,0,0,10) < Specificity(0,0,1,0));
  26. BOOST_REQUIRE(Specificity(0,0,10,0) < Specificity(0,1,0,0));
  27. BOOST_REQUIRE(Specificity(0,10,0,0) < Specificity(1,0,0,0));
  28. BOOST_REQUIRE(Specificity(0,0,0,3) > Specificity(0,0,0,2));
  29. BOOST_REQUIRE(Specificity(0,0,0,0) > Specificity(false));
  30. BOOST_REQUIRE(Specificity(0,0,0,3) >=Specificity(0,0,0,2));
  31. BOOST_REQUIRE(Specificity(0,0,0,2) <=Specificity(0,0,0,3));
  32. }