Skip to content
Snippets Groups Projects
Commit dd507064 authored by Andreas Salzburger's avatar Andreas Salzburger
Browse files

fix wrong consistency checks

parent 56357648
No related branches found
No related tags found
1 merge request!804Consistent storage and access schema for bounds - part 2
......@@ -159,7 +159,8 @@ inline std::vector<double> CuboidVolumeBounds::values() const {
}
inline void CuboidVolumeBounds::checkConsistency() noexcept(false) {
if (get(eHalfLengthX) * get(eHalfLengthY) * get(eHalfLengthZ) <= 0.) {
if (get(eHalfLengthX) <= 0 or get(eHalfLengthY) <= 0 or
get(eHalfLengthZ) <= 0.) {
throw std::invalid_argument(
"CuboidVolumeBounds: invalid input, zero or negative.");
}
......
......@@ -47,12 +47,18 @@ BOOST_AUTO_TEST_CASE(CuboidVolumeRecreation) {
BOOST_AUTO_TEST_CASE(CuboidVolumeException) {
// Test exception negative x
BOOST_CHECK_THROW(CuboidVolumeBounds(-hx, hy, hz), std::logic_error);
// Test exception negative y
BOOST_CHECK_THROW(CuboidVolumeBounds(hx, -hy, hz), std::logic_error);
// Test exception negative z
BOOST_CHECK_THROW(CuboidVolumeBounds(hx, hy, -hz), std::logic_error);
// Other iterations 0
BOOST_CHECK_THROW(CuboidVolumeBounds(-hx, hy, -hz), std::logic_error);
// Other iterations 1
BOOST_CHECK_THROW(CuboidVolumeBounds(-hx, -hy, hz), std::logic_error);
// Other iterations 2
BOOST_CHECK_THROW(CuboidVolumeBounds(hx, -hy, -hz), std::logic_error);
// Other iterations : all
BOOST_CHECK_THROW(CuboidVolumeBounds(-hx, -hy, -hz), std::logic_error);
}
BOOST_AUTO_TEST_CASE(CuboidVolumeProperties) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment