Re: [CrystalSpace] #991: jam check_all fails

"CrystalSpace" <[email protected]> Mon, 29 Jul 2013 17:59:49 -0000
Newsgroups gmane.comp.graphics.crystalspace.tracker
Message-ID <[email protected]>
#991: jam check_all fails
---------------------------+------------------------------------------------
 Reporter:  ralphcampbell  |       Owner:  admin
     Type:  defect         |      Status:  new  
 Priority:  minor          |   Milestone:       
Component:  libs           |     Version:  V2.1 
 Keywords:                 |  
---------------------------+------------------------------------------------
Description changed by sunshine:

Old description:

> If you run "jam check_all" you will get:
>
> {{{
> !!!FAILURES!!!
> Test Results:
> Run:  117   Failures: 1   Errors: 0
>

> 1) test: csVector2Test::testCond (F) line: 92
> /home/ralphc/src/CS_LATEST/libs/csgeom/t/vector2.t
> assertion failed
> - Expression: 3.0 > v1
> }}}
>
> Looking at include/csgeom/vector2.h, it seems that the definition for
> operator> does not match common sense for reversing the arguments and the
> direction of the comparison.
> Also, you might as well define a vector greater than epsilon operator
> too.
>
> {{{
> Index: include/csgeom/vector2.h
> ===================================================================
> --- include/csgeom/vector2.h    (revision 39526)
> +++ include/csgeom/vector2.h    (working copy)
> @@ -217,10 +217,18 @@
>    inline friend bool operator< (const csVector2& v, float f)
>    { return ABS (v.x) < f && ABS (v.y) < f; }
>
> +  /// Test if each component of a vector is less than a small epsilon
> value.
> +  inline friend bool operator> (float f, const csVector2& v)
> +  { return ABS (v.x) < f && ABS (v.y) < f; }
> +
>    /// Test if each component of a vector is greater than a small epsilon
> value.
> -  inline friend bool operator> (float f, const csVector2& v)
> +  inline friend bool operator> (const csVector2& v, float f)
>    { return ABS (v.x) > f && ABS (v.y) > f; }
>
> +  /// Test if each component of a vector is greater than a small epsilon
> value.
> +  inline friend bool operator< (float f, const csVector2& v)
> +  { return ABS (v.x) > f && ABS (v.y) > f; }
> +
>    /// Returns n-th component of the vector.
>    inline float operator[] (int n) const
>    { return !n?x:y; }
> Index: libs/csgeom/t/vector2.t
> ===================================================================
> --- libs/csgeom/t/vector2.t     (revision 39526)
> +++ libs/csgeom/t/vector2.t     (working copy)
> @@ -90,4 +90,6 @@
>    CPPUNIT_ASSERT(temp != v2);
>    CPPUNIT_ASSERT(v1 < 3.0);
>    CPPUNIT_ASSERT(3.0 > v1);
> +  CPPUNIT_ASSERT(v2 > 2.0);
> +  CPPUNIT_ASSERT(2.0 < v2);
>  }
> }}}

New description:

 If you run "`jam check_all`" you will get:

 {{{
 !!!FAILURES!!!
 Test Results:
 Run:  117   Failures: 1   Errors: 0


 1) test: csVector2Test::testCond (F) line: 92
 /home/ralphc/src/CS_LATEST/libs/csgeom/t/vector2.t
 assertion failed
 - Expression: 3.0 > v1
 }}}

 Looking at `include/csgeom/vector2.h`, it seems that the definition for
 `operator>` does not match common sense for reversing the arguments and
 the direction of the comparison.
 Also, you might as well define a vector greater than epsilon operator too.

 {{{
 #!diff
 Index: include/csgeom/vector2.h
 ===================================================================
 --- include/csgeom/vector2.h    (revision 39526)
 +++ include/csgeom/vector2.h    (working copy)
 @@ -217,10 +217,18 @@
    inline friend bool operator< (const csVector2& v, float f)
    { return ABS (v.x) < f && ABS (v.y) < f; }

 +  /// Test if each component of a vector is less than a small epsilon
 value.
 +  inline friend bool operator> (float f, const csVector2& v)
 +  { return ABS (v.x) < f && ABS (v.y) < f; }
 +
    /// Test if each component of a vector is greater than a small epsilon
 value.
 -  inline friend bool operator> (float f, const csVector2& v)
 +  inline friend bool operator> (const csVector2& v, float f)
    { return ABS (v.x) > f && ABS (v.y) > f; }

 +  /// Test if each component of a vector is greater than a small epsilon
 value.
 +  inline friend bool operator< (float f, const csVector2& v)
 +  { return ABS (v.x) > f && ABS (v.y) > f; }
 +
    /// Returns n-th component of the vector.
    inline float operator[] (int n) const
    { return !n?x:y; }
 Index: libs/csgeom/t/vector2.t
 ===================================================================
 --- libs/csgeom/t/vector2.t     (revision 39526)
 +++ libs/csgeom/t/vector2.t     (working copy)
 @@ -90,4 +90,6 @@
    CPPUNIT_ASSERT(temp != v2);
    CPPUNIT_ASSERT(v1 < 3.0);
    CPPUNIT_ASSERT(3.0 > v1);
 +  CPPUNIT_ASSERT(v2 > 2.0);
 +  CPPUNIT_ASSERT(2.0 < v2);
  }
 }}}

--

-- 
Ticket URL: <http://www.crystalspace3d.org/trac/CS/ticket/991#comment:1>
CrystalSpace <http://www.crystalspace3d.org/>
Free open-source 3D SDK.
------------------------------------------------------------------------------
Get your SQL database under version control now!
Version control is standard for application code, but databases havent 
caught up. So what steps can you take to put your SQL databases under 
version control? Why should you start doing it? Read more to find out.
http://pubads.g.doubleclick.net/gampad/clk?id=49501711&iu=/4140/ostg.clktrk