[units] failures in tests and untested non-SI code

I realize that the Units libary is still a work-in-progress, but I thought you might like to know about these failures. Using 1.35.0 with the latest Units code (SVN rev. 45355) and using GCC 4.1.2, I get these failures in test/: test_limits, test_cmath The exact compilation errors are in the file attached. Also, I cannot compile this simple test code. I may very well be doing something wrong: #include <boost/units/systems/si.hpp> #include <boost/units/systems/other/foot.hpp> #include <boost/units/systems/detail/non_si_unit.hpp> BOOST_UNITS_NON_SI_UNIT(survey, yard_per_sec, yard_per_sec, 0.3048006 * 3.0, boost::units::SI::velocity, 53); typedef boost::units::quantity<boost::units::survey::yard_per_sec_base_unit, double> YardsPerSec; int main() { YardsPerSec yps1; YardsPerSec yps2; yps1 -= yps2; } The errors are: g++ test_non_si_units.cpp -o test -g -I /usr/local/include/boost-1_35 /usr/local/include/boost-1_35/boost/units/quantity.hpp: In member function 'boost::units::quantity<Unit, Y>& boost::units::quantity<Unit, Y>::operator-=(const boost::units::quantity<Unit2, YY>&) [with Unit2 = boost::units::survey::yard_per_sec_base_unit, YY = double, Unit = boost::units::survey::yard_per_sec_base_unit, Y = double]': test_non_si_units.cpp:14: instantiated from here /usr/local/include/boost-1_35/boost/units/quantity.hpp:233: error: invalid application of 'sizeof' to incomplete type 'boost::STATIC_ASSERTION_FAILURE<false>' There appear to be no tests defined for the non-SI parts of Units, which is probably why this has gone unnoticed (if indeed it has). HTH, Zach

AMDG Zach Laine wrote:
I realize that the Units libary is still a work-in-progress, but I thought you might like to know about these failures. Using 1.35.0 with the latest Units code (SVN rev. 45355) and using GCC 4.1.2, I get these failures in test/:
test_limits, test_cmath
Whoops, I'm testing against the trunk...
The exact compilation errors are in the file attached.
Also, I cannot compile this simple test code. I may very well be doing something wrong:
#include <boost/units/systems/si.hpp> #include <boost/units/systems/other/foot.hpp> #include <boost/units/systems/detail/non_si_unit.hpp>
BOOST_UNITS_NON_SI_UNIT(survey, yard_per_sec, yard_per_sec, 0.3048006 * 3.0, boost::units::SI::velocity, 53);
typedef boost::units::quantity<boost::units::survey::yard_per_sec_base_unit, double> YardsPerSec;
Grrr. A base unit is not the same as a unit. try boost::units::survey::yard_per_sec_base_unit::unit_type. In Christ, Steven Watanabe

I realize that the Units libary is still a work-in-progress, but I thought you might like to know about these failures. Using 1.35.0 with the latest Units code (SVN rev. 45355) and using GCC 4.1.2, I get these failures in test/:
test_limits, test_cmath
You will need get boost/math/special_functions from the trunk - Steven just checked in some revisions that replaced our ad hoc implementations of some of these math functions with those defined in Boost.Math.
Also, I cannot compile this simple test code. I may very well be doing something wrong:
#include <boost/units/systems/si.hpp> #include <boost/units/systems/other/foot.hpp> #include <boost/units/systems/detail/non_si_unit.hpp>
BOOST_UNITS_NON_SI_UNIT(survey, yard_per_sec, yard_per_sec, 0.3048006 * 3.0, boost::units::SI::velocity, 53);
typedef boost::units::quantity<boost::units::survey::yard_per_sec_base_unit, double> YardsPerSec;
int main() { YardsPerSec yps1; YardsPerSec yps2; yps1 -= yps2; }
This is probably because you need to convert the base unit into a unit by qualifying with unit_type : typedef boost ::units ::quantity <boost::units::survey::yard_per_sec_base_unit::unit_type,double> YardsPerSec; We should see if there is a way to at least warn in these cases... Matthias

I'm relieved that it was so simple. I added ::unit_type, which fixed things for me. I agree, that static_assert could use a comment. :) So, am I going to experience much pain if I continue using 1.35.0 and the sandbox units/ directory? Or should I use trunk to evaluate Units? Zach On Wed, May 14, 2008 at 11:09 AM, Steven Watanabe <watanabesj@gmail.com> wrote:
AMDG
Matthias Schabel wrote:
We should see if there is a way to at least warn in these cases...
Indeed. It fails because of a static assertion which I put in to guard against such errors. The message could be more helpful, though.
In Christ, Steven Watanabe
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

AMDG Zach Laine wrote:
I'm relieved that it was so simple. I added ::unit_type, which fixed things for me. I agree, that static_assert could use a comment. :)
So, am I going to experience much pain if I continue using 1.35.0 and the sandbox units/ directory? Or should I use trunk to evaluate Units?
It's probably safest to use the trunk. At the moment only cmath.hpp depends on boost/math, though and I'll hold back on pow, since these are implementation details. In Christ, Steven Watanabe
participants (3)
-
Matthias Schabel
-
Steven Watanabe
-
Zach Laine