[CrystalSpace] #991: jam check_all fails
"CrystalSpace" <[email protected]> Sat, 27 Jul 2013 06:56:42 -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: |
---------------------------+------------------------------------------------
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);
}
}}}
--
Ticket URL: <http://www.crystalspace3d.org/trac/CS/ticket/991>
CrystalSpace <http://www.crystalspace3d.org/>
Free open-source 3D SDK.
------------------------------------------------------------------------------
See everything from the browser to the database with AppDynamics
Get end-to-end visibility with application monitoring from AppDynamics
Isolate bottlenecks and diagnose root cause in seconds.
Start your free trial of AppDynamics Pro today!
http://pubads.g.doubleclick.net/gampad/clk?id=48808831&iu=/4140/ostg.clktrk