MOAB: Mesh Oriented datABase  (version 5.4.1)
UnitUtil.hpp File Reference

Utility functions for use in unit tests. More...

#include "Mesquite.hpp"
#include "Vector3D.hpp"
#include "Matrix3D.hpp"
#include "MsqMatrix.hpp"
#include "MsqError.hpp"
#include <string>
#include <cstdio>
#include "cppunit/extensions/HelperMacros.h"
+ Include dependency graph for UnitUtil.hpp:

Go to the source code of this file.

Defines

#define ASSERT_MESSAGE(MSG, COND)   CPPUNIT_NS::Asserter::failIf( !( COND ), ( MSG ), CPPUNIT_SOURCELINE() )
#define ASSERT_NO_ERROR(A)   ASSERT_MESSAGE( ( A ).error_message(), !MSQ_CHKERR( ( A ) ) )
#define CPPUNIT_ASSERT_VECTORS_EQUAL(v1, v2, eps)   ASSERT_MESSAGE( utest_vect_message( ( v1 ), ( v2 ) ), utest_vect_equal( ( v1 ), ( v2 ), ( eps ) ) )
 compare two vectors (Vector3D)
#define CPPUNIT_ASSERT_MATRICES_EQUAL(m1, m2, eps)   ASSERT_MESSAGE( utest_mat_message( ( m1 ), ( m2 ) ), utest_mat_equal( ( m1 ), ( m2 ), ( eps ) ) )
 compare two matrices (Matrix3D)
#define ASSERT_IDENTITY_MATRIX(M)   ASSERT_MESSAGE( ident_check_msg( M ), ident_check( M ) )
#define ASSERT_MATRICES_EQUAL(A, B, E)   ASSERT_MESSAGE( mat_equal_check_msg( A, B ), mat_equal_check( A, B, E ) )
#define ASSERT_MATRICES_DIFFERENT(A, B, E)   ASSERT_MESSAGE( mat_not_equal_check_msg( A, B ), !mat_equal_check( A, B, E ) )
#define ASSERT_ARRAYS_EQUAL(A, B, LEN)
#define ASSERT_STD_VECTORS_EQUAL(A, B)

Functions

std::string utest_vect_str (const MBMesquite::Vector3D &v)
std::string utest_mat_str (const MBMesquite::Matrix3D &m)
std::string utest_mat_str (const MBMesquite::SymMatrix3D &m)
CppUnit::Message utest_vect_message (const MBMesquite::Vector3D &v1, const MBMesquite::Vector3D &v2)
CppUnit::Message utest_mat_message (const MBMesquite::Matrix3D &m1, const MBMesquite::Matrix3D &m2)
CppUnit::Message utest_mat_message (const MBMesquite::SymMatrix3D &m1, const MBMesquite::SymMatrix3D &m2)
bool utest_vect_equal (const MBMesquite::Vector3D &v1, const MBMesquite::Vector3D &v2, double eps)
bool utest_mat_equal (const MBMesquite::Matrix3D &m1, const MBMesquite::Matrix3D &m2, double eps)
bool utest_mat_equal (const MBMesquite::SymMatrix3D &m1, const MBMesquite::SymMatrix3D &m2, double eps)
template<unsigned R, unsigned C>
std::string msq_mat_str (const MBMesquite::MsqMatrix< R, C > &m)
template<unsigned R, unsigned C>
CppUnit::Message ident_check_msg (const MBMesquite::MsqMatrix< R, C > &m)
template<unsigned R, unsigned C>
bool ident_check (const MBMesquite::MsqMatrix< R, C > &m)
template<unsigned R, unsigned C>
CppUnit::Message mat_equal_check_msg (const MBMesquite::MsqMatrix< R, C > &A, const MBMesquite::MsqMatrix< R, C > &B)
template<unsigned R, unsigned C>
CppUnit::Message mat_not_equal_check_msg (const MBMesquite::MsqMatrix< R, C > &A, const MBMesquite::MsqMatrix< R, C > &B)
template<unsigned R, unsigned C>
bool mat_equal_check (const MBMesquite::MsqMatrix< R, C > &A, const MBMesquite::MsqMatrix< R, C > &B, double eps)
template<typename T1 , typename T2 >
bool arrays_equal (const T1 *A, const T2 *B, size_t len)
template<typename T1 , typename T2 >
CppUnit::Message arrays_not_equal_msg (const T1 *A, size_t A_len, const T2 *B, size_t B_len)

Detailed Description

Utility functions for use in unit tests.

Author:
Jason Kraftcheck

Definition in file UnitUtil.hpp.


Define Documentation

#define ASSERT_ARRAYS_EQUAL (   A,
  B,
  LEN 
)
Value:
CPPUNIT_NS::Asserter::failIf( !( arrays_equal( ( A ), ( B ), ( LEN ) ) ), \
                                  arrays_not_equal_msg( ( A ), ( LEN ), ( B ), ( LEN ) ), CPPUNIT_SOURCELINE() )

compare two arrays of values

Definition at line 78 of file UnitUtil.hpp.

Referenced by PatchDataTest::test_quad8_patch().

#define ASSERT_MATRICES_DIFFERENT (   A,
  B,
 
)    ASSERT_MESSAGE( mat_not_equal_check_msg( A, B ), !mat_equal_check( A, B, E ) )

compare two matrices (MsqMatrix)

Definition at line 74 of file UnitUtil.hpp.

#define ASSERT_MATRICES_EQUAL (   A,
  B,
 
)    ASSERT_MESSAGE( mat_equal_check_msg( A, B ), mat_equal_check( A, B, E ) )

compare two matrices (MsqMatrix)

Definition at line 71 of file UnitUtil.hpp.

Referenced by TargetCalculatorTest::check_valid_V(), LinearMappingFunctionTest::do_ideal_test(), IdealTargetTest::do_test(), TargetReadWriteTest::read_write_2D_targets(), TargetReadWriteTest::read_write_3D_targets(), TargetReadWriteTest::read_write_surface_targets(), CachingTargetTest::test_2d_target_subpatch(), CachingTargetTest::test_2d_target_values(), CachingTargetTest::test_3d_target_subpatch(), CachingTargetTest::test_3d_target_values(), TargetCalculatorTest::test_aspect_2D(), TargetCalculatorTest::test_aspect_3D(), TargetCalculatorTest::test_aspect_surface(), TargetCalculatorTest::test_factor_2D(), TargetCalculatorTest::test_factor_3D(), TargetCalculatorTest::test_factor_surface(), TargetCalculatorTest::test_get_refmesh_Jacobian_2D(), TargetCalculatorTest::test_get_refmesh_Jacobian_3D(), MappingFunctionTest::test_ideal_2d(), MappingFunctionTest::test_ideal_3d(), TriLagrangeShapeTest::test_ideal_jacobian(), QuadLagrangeShapeTest::test_ideal_jacobian(), TetLagrangeShapeTest::test_ideal_jacobian(), HexLagrangeShapeTest::test_ideal_jacobian(), TargetCalculatorTest::test_ideal_shape_prism(), TargetCalculatorTest::test_ideal_shape_pyramid(), TargetCalculatorTest::test_ideal_shape_tet(), TargetCalculatorTest::test_ideal_shape_tri(), TargetCalculatorTest::test_ideal_skew_prism(), TargetCalculatorTest::test_ideal_skew_pyramid(), TargetCalculatorTest::test_ideal_skew_tet(), TargetCalculatorTest::test_ideal_skew_tri(), MappingFunctionTest::test_jacobian_2d(), TargetCalculatorTest::test_jacobian_2D(), MappingFunctionTest::test_jacobian_3d(), TargetCalculatorTest::test_jacobian_3D(), LVQDTargetTest::test_LVQD_default_is_I_2D(), LVQDTargetTest::test_LVQD_default_is_I_3D(), LVQDTargetTest::test_LVQD_default_is_I_surface(), LVQDTargetTest::test_LVQD_product_2D(), LVQDTargetTest::test_LVQD_product_3D(), LVQDTargetTest::test_LVQD_product_surface(), TargetCalculatorTest::test_new_orientatin_2D(), TargetCalculatorTest::test_new_orientatin_3D(), TMetricTest< Metric, DIM >::test_numerical_gradient_2D(), AWMetricTest::test_numerical_gradient_2D(), TMetricTest< Metric, DIM >::test_numerical_gradient_3D(), AWMetricTest::test_numerical_gradient_3D(), TMetricTest< Metric, DIM >::test_numerical_hessian_2D(), AWMetricTest::test_numerical_hessian_2D(), TMetricTest< Metric, DIM >::test_numerical_hessian_3D(), AWMetricTest::test_numerical_hessian_3D(), TMPDerivsTest::test_pluseq_scaled_I(), TMPDerivsTest::test_pluseq_scaled_outer_product(), TMPDerivsTest::test_pluseq_scaled_outer_product_I_I_2D(), TMPDerivsTest::test_pluseq_scaled_outer_product_I_I_3D(), TMPDerivsTest::test_pluseq_scaled_sum_outer_product_2D(), TMPDerivsTest::test_pluseq_scaled_sum_outer_product_3D(), TMPDerivsTest::test_pluseq_scaled_sum_outer_product_I_2D(), TMPDerivsTest::test_pluseq_scaled_sum_outer_product_I_3D(), MsqMatrixTest::test_qr(), TMPDerivsTest::test_set_scaled_I(), TMPDerivsTest::test_set_scaled_outer_product(), TMPDerivsTest::test_set_scaled_sum_outer_product_2D(), TMPDerivsTest::test_set_scaled_sum_outer_product_3D(), TargetCalculatorTest::test_shape_2D(), TargetCalculatorTest::test_shape_3D(), TargetCalculatorTest::test_shape_surface(), TargetCalculatorTest::test_skew_2D(), TargetCalculatorTest::test_skew_3D(), TargetCalculatorTest::test_skew_surface(), CachingTargetTest::test_surface_target_subpatch(), CachingTargetTest::test_surface_target_values(), and MsqMatrixTest::test_vec_outer_product().

#define ASSERT_MESSAGE (   MSG,
  COND 
)    CPPUNIT_NS::Asserter::failIf( !( COND ), ( MSG ), CPPUNIT_SOURCELINE() )
#define ASSERT_NO_ERROR (   A)    ASSERT_MESSAGE( ( A ).error_message(), !MSQ_CHKERR( ( A ) ) )

Assert that MBMesquite API has not flagged an error

Definition at line 49 of file UnitUtil.hpp.

Referenced by HigherOrderTest::basic_quad_test(), VtkTest::check_4quad_structured(), VtkTest::check_8hex_structured(), AveragingQMTest::check_average_and_weights(), AveragingQMTest::check_average_gradients(), VtkTest::check_field_attrib(), PatchDataTest::check_higher_order_vertices_slaved(), AveragingQMTest::check_pmean_hessian(), AveragingQMTest::check_pmean_hessian_diagonals(), PMeanPTemplateTest::check_result(), BCDTest::compare_bcd(), ObjectiveFunctionTests::compare_diagonal_gradient(), QualityMetricTest::compare_gradient(), ObjectiveFunctionTests::compare_hessian_diagonal(), ObjectiveFunctionTests::compare_hessian_gradient(), QualityMetricTest::compare_indices(), ObjectiveFunctionTests::compare_numerical_gradient(), ObjectiveFunctionTests::compare_numerical_hessian(), ObjectiveFunctionTests::compare_numerical_hessian_diagonal(), LinearMappingFunctionTest::do_ideal_test(), ObjectiveFunctionTests::evaluate_internal(), CompositeOFTest::get_hessians(), PatchDataTest::get_higher_order_vertices(), PatchDataTest::get_quad8_mesh_and_domain(), SlaveBoundaryVerticesTest::make_mesh(), TCTFauxOptimizer::optimize_vertex_positions(), TargetReadWriteTest::read_write_2D_targets(), TargetReadWriteTest::read_write_3D_targets(), TargetReadWriteTest::read_write_surface_targets(), TargetReadWriteTest::read_write_weights(), TQualityMetricTest::regression_inverse_mean_ratio_grad(), TQualityMetricTest::regression_inverse_mean_ratio_hess(), CachingTargetTest::request_all_targets_2d(), CachingTargetTest::request_all_targets_3d(), CachingTargetTest::request_all_targets_surf(), NumericalOFTest::setUp(), TagVertexMeshTest::setUp(), XYRectangleTest::setUp(), LVQDTargetTest::setUp(), QualityAssessorTest::setUp(), iMeshTest::setUp(), LVQDTargetTest::target(), CachingTargetTest::test_2d_target_subpatch(), CachingTargetTest::test_2d_target_values(), CachingTargetTest::test_3d_target_subpatch(), CachingTargetTest::test_3d_target_values(), TerminationCriterionTest::test_abs_vtx_movement_culling(), TerminationCriterionTest::test_absolute_vertex_movement_edge_length(), InstructionQueueTest::test_add_remove_vertex_slaver(), MsqMeshEntityTest::test_all_nodes(), TagVertexMeshTest::test_alternate_name(), MBMesquite::CircleDomainTest::test_arc_length(), MBMesquite::LineDomainTest::test_arc_length(), TargetCalculatorTest::test_aspect_2D(), TargetCalculatorTest::test_aspect_3D(), TargetCalculatorTest::test_aspect_surface(), AveragingQMTest::test_average_metrics_geometric(), AveragingQMTest::test_average_metrics_harmonic(), AveragingQMTest::test_average_metrics_hms(), AveragingQMTest::test_average_metrics_liner(), AveragingQMTest::test_average_metrics_max_minus_min(), AveragingQMTest::test_average_metrics_max_over_min(), AveragingQMTest::test_average_metrics_maximum(), AveragingQMTest::test_average_metrics_minimum(), AveragingQMTest::test_average_metrics_rms(), AveragingQMTest::test_average_metrics_standard_deviation(), AveragingQMTest::test_average_metrics_sum(), AveragingQMTest::test_average_metrics_sum_of_ratios_squared(), AveragingQMTest::test_average_metrics_sum_squared(), QualityAssessorTest::test_basic_stats_element(), QualityAssessorTest::test_basic_stats_sample(), QualityAssessorTest::test_basic_stats_vertex(), NumericalOFTest::test_changed(), MsqMeshEntityTest::test_check_element_orientation(), TagVertexMeshTest::test_cleanup(), ConicDomainTest::test_closest_point(), SphericalDomainTest::test_closest_point(), XYRectangleTest::test_closest_point(), CompositeOFTest::test_composite_clone(), ObjectiveFunctionTest::test_compute_ana_hessian_tet(), ObjectiveFunctionTest::test_compute_ana_hessian_tet_scaled(), TerminationCriterionTest::test_cpu_time_common(), UntangleBetaTest::test_degenerate_elements(), ArrayMeshTest::test_delete_tag(), QualityMetricTester::test_diagonal_with_fixed_vertex(), ConicDomainTest::test_domain_DoF(), SphericalDomainTest::test_domain_DoF(), XYRectangleTest::test_domain_DoF(), MeshUtilTest::test_edge_length_distribution_types(), MeshUtilTest::test_edge_length_distribution_unique(), VtkTest::test_elements(), CompositeMetricTestBase::test_evaluate(), CompositeOFTest::test_evaluate(), TargetCalculatorTest::test_factor_2D_zero(), TargetCalculatorTest::test_factor_3D_zero(), TargetCalculatorTest::test_factor_surface_zero(), PlanarGeometryTest::test_fit_plane(), SphericalDomainTest::test_fit_vertices(), PatchDataTest::test_fixed_by_geom_dim(), QualityMetricTest::test_fixed_vertex_list(), QualityAssessorTest::test_free_only(), QualityMetricTester::test_get_edge_evaluations(), QualityMetricTester::test_get_edge_indices(), TargetCalculatorTest::test_get_refmesh_Jacobian_2D(), TargetCalculatorTest::test_get_refmesh_Jacobian_3D(), TMPQualityMetricTest< QMType >::test_gradient_3D(), TerminationCriterionTest::test_gradient_common(), TMPQualityMetricTest< QMType >::test_gradient_common(), NumericalOFTest::test_gradient_values(), QualityMetricTester::test_gradient_with_fixed_vertex(), NumericalOFTest::test_handles_eval_false(), ObjectiveFunctionTests::test_handles_invalid_qm(), ObjectiveFunctionTests::test_handles_qm_error(), PMeanPMetricTest::test_hessian_diagonal(), QualityMetricTester::test_hessian_with_fixed_vertex(), HigherOrderTest::test_hex_basic(), QualityAssessorTest::test_histogram_known_range(), QualityAssessorTest::test_histogram_unknown_range(), MappingFunctionTest::test_ideal_2d(), MappingFunctionTest::test_ideal_3d(), TriLagrangeShapeTest::test_ideal_jacobian(), QuadLagrangeShapeTest::test_ideal_jacobian(), TetLagrangeShapeTest::test_ideal_jacobian(), HexLagrangeShapeTest::test_ideal_jacobian(), TargetCalculatorTest::test_ideal_shape_hex(), TargetCalculatorTest::test_ideal_shape_prism(), TargetCalculatorTest::test_ideal_shape_pyramid(), TargetCalculatorTest::test_ideal_shape_quad(), TargetCalculatorTest::test_ideal_shape_tet(), TargetCalculatorTest::test_ideal_shape_tri(), TargetCalculatorTest::test_ideal_skew_hex(), TargetCalculatorTest::test_ideal_skew_prism(), TargetCalculatorTest::test_ideal_skew_pyramid(), TargetCalculatorTest::test_ideal_skew_quad(), TargetCalculatorTest::test_ideal_skew_tet(), TargetCalculatorTest::test_ideal_skew_tri(), QualityAssessorTest::test_invalid_count(), CompositeOFTest::test_invalid_eval(), QualityAssessorTest::test_inverted_count(), UntangleBetaTest::test_inverted_elements(), MappingFunctionTest::test_jacobian_2d(), TargetCalculatorTest::test_jacobian_2D(), MappingFunctionTest::test_jacobian_3d(), TargetCalculatorTest::test_jacobian_3D(), MeshUtilTest::test_lambda_distribution(), MeshUtilTest::test_lambda_distribution_mixed(), ObjectiveFunctionTest::test_max_negate_flag(), CompositeOFTest::test_multiply_hess_diagonal(), CompositeOFTest::test_multiply_hessian(), ObjectiveFunctionTests::test_negate_flag(), XYRectangleTest::test_normal_at(), TerminationCriterionTest::test_number_of_iterates_inner(), TerminationCriterionTest::test_number_of_iterates_outer(), TMetricTest< Metric, DIM >::test_numerical_gradient_2D(), AWMetricTest::test_numerical_gradient_2D(), TMetricTest< Metric, DIM >::test_numerical_gradient_3D(), AWMetricTest::test_numerical_gradient_3D(), TMetricTest< Metric, DIM >::test_numerical_hessian_2D(), AWMetricTest::test_numerical_hessian_2D(), TMetricTest< Metric, DIM >::test_numerical_hessian_3D(), AWMetricTest::test_numerical_hessian_3D(), PatchDataTest::test_patch_data_mesh_calcualted_ho_nodes(), MBMesquite::LineDomainTest::test_position_from_length(), MBMesquite::CircleDomainTest::test_position_from_length(), QualityAssessorTest::test_power_mean(), QualityAssessorTest::test_print_inverted(), QualityAssessorTest::test_print_name(), QualityAssessorTest::test_print_stats(), PatchDataTest::test_quad8_patch(), HigherOrderTest::test_quad_basic_ideal(), HigherOrderTest::test_quad_basic_left_down(), HigherOrderTest::test_quad_basic_left_over(), HigherOrderTest::test_quad_basic_mid_convex(), HigherOrderTest::test_quad_basic_mid_spin(), HigherOrderTest::test_quad_basic_right_up(), HigherOrderTest::test_quad_basic_top_down(), TerminationCriterionTest::test_quality_common(), VtkTest::test_read_fixed_attrib(), VtkTest::test_read_quadratic(), VtkTest::test_read_rectilinear_grid(), VtkTest::test_read_simple_scalar_attrib(), VtkTest::test_read_structured_2d_points(), VtkTest::test_read_structured_3d_points(), VtkTest::test_read_structured_grid(), VtkTest::test_read_unstructured(), VtkTest::test_read_vector_attrib(), TagVertexMeshTest::test_reference_mesh(), TagVertexMeshTest::test_save_coordinates(), TargetCalculatorTest::test_shape_2D(), TargetCalculatorTest::test_shape_3D(), TargetCalculatorTest::test_shape_surface(), TargetCalculatorTest::test_size_2D(), TargetCalculatorTest::test_size_3D(), TargetCalculatorTest::test_size_surface(), TargetCalculatorTest::test_skew_2D(), TargetCalculatorTest::test_skew_3D(), TargetCalculatorTest::test_skew_surface(), SlaveBoundaryVerticesTest::test_slaved_common(), XYRectangleTest::test_snap_to(), CachingTargetTest::test_surface_target_subpatch(), CachingTargetTest::test_surface_target_values(), ArrayMeshTest::test_tag_data(), QualityAssessorTest::test_tag_element(), QualityAssessorTest::test_tag_inverted(), QualityAssessorTest::test_tag_vertex(), HigherOrderTest::test_tet_basic_apex_down(), HigherOrderTest::test_tet_basic_apex_over(), HigherOrderTest::test_tet_basic_apex_up(), HigherOrderTest::test_tet_basic_ideal(), HigherOrderTest::test_tet_basic_mid_convex(), HigherOrderTest::test_tet_basic_mid_spin(), HigherOrderTest::test_tri_basic_ideal(), HigherOrderTest::test_tri_basic_mid_convex(), HigherOrderTest::test_tri_basic_mid_spin(), HigherOrderTest::test_tri_basic_peak_down(), HigherOrderTest::test_tri_basic_peak_over(), HigherOrderTest::test_tri_basic_peak_up(), HigherOrderTest::test_tri_open_domain(), HigherOrderTest::test_tri_slac(), NumericalOFTest::test_unchanged(), MsqMeshEntityTest::test_unsigned_area_common(), MsqMeshEntityTest::test_unsigned_area_poly(), TerminationCriterionTest::test_untangled_mesh(), PatchDataTest::test_update_slave_node_coords(), TerminationCriterionTest::test_vertex_bound(), TagVertexMeshTest::test_vertex_coordinates(), TerminationCriterionTest::test_vertex_movement_common(), PatchSetTest::test_vertex_patches(), VtkTest::test_write(), VtkTest::test_write_field_attrib(), VtkTest::test_write_quadratic(), MeshImplTest::test_zero_length_data(), iMeshTest::testVertexFlag(), and iMeshTest::testVertexFlagNone().

#define ASSERT_STD_VECTORS_EQUAL (   A,
 
)
Value:
CPPUNIT_NS::Asserter::failIf( ( ( A ) != ( B ) ),                                                       \
                                  arrays_not_equal_msg( &( A )[0], ( A ).size(), &( B )[0], ( B ).size() ), \
                                  CPPUNIT_SOURCELINE() )

Definition at line 82 of file UnitUtil.hpp.

Referenced by QualityMetricTest::compare_indices(), and ArrayMeshTest::test_tag_data().

#define CPPUNIT_ASSERT_MATRICES_EQUAL (   m1,
  m2,
  eps 
)    ASSERT_MESSAGE( utest_mat_message( ( m1 ), ( m2 ) ), utest_mat_equal( ( m1 ), ( m2 ), ( eps ) ) )

compare two matrices (Matrix3D)

Ensure that the test result Matrix3D m2 is within eps of the expected matrix m1

Definition at line 64 of file UnitUtil.hpp.

Referenced by AveragingQMTest::check_pmean_hessian(), AveragingQMTest::check_pmean_hessian_diagonals(), PMeanPTemplateTest::check_result(), QualityMetricTester::compare_analytical_and_numerical_diagonals(), TMPQualityMetricTest< QMType >::compare_analytical_and_numerical_diagonals(), QualityMetricTester::compare_analytical_and_numerical_hessians(), TMPQualityMetricTest< QMType >::compare_analytical_and_numerical_hessians(), QualityMetricTester::compare_eval_with_diag_and_eval_with_hessian(), ObjectiveFunctionTests::compare_hessian_diagonal(), TQualityMetricTest::regression_inverse_mean_ratio_hess(), CompositeOFTest::test_add_hessian(), ObjectiveFunctionTest::test_compute_ana_hessian_tet(), ObjectiveFunctionTest::test_compute_ana_hessian_tet_scaled(), QualityMetricTest::test_diagonal_constant(), QualityMetricTest::test_diagonal_linear(), QualityMetricTest::test_diagonal_parabolic(), QualityMetricTest::test_diagonal_tau(), QualityMetricTester::test_diagonal_with_fixed_vertex(), PMeanPTemplateTest::test_Hessian(), PMeanPMetricTest::test_hessian(), QualityMetricTest::test_Hessian_constant(), PMeanPMetricTest::test_hessian_diagonal(), QualityMetricTest::test_Hessian_linear(), QualityMetricTest::test_Hessian_parabolic(), QualityMetricTest::test_Hessian_tau(), QualityMetricTester::test_hessian_transform_invariant(), QualityMetricTester::test_hessian_with_fixed_vertex(), SymMatrix3DTest::test_inverse(), SymMatrix3DTest::test_minus_nonsym(), SymMatrix3DTest::test_multiply(), CompositeOFTest::test_multiply_hess_diagonal(), ObjectiveFunctionTests::test_negate_flag(), SymMatrix3DTest::test_nonsym_multiply(), SymMatrix3DTest::test_plus_nonsym(), QualityMetricTest::test_remove_fixed_hessians(), CompositeOFTest::test_scalar_add_hessian(), and CompositeOFTest::test_scalar_multiply_hessian().

#define CPPUNIT_ASSERT_VECTORS_EQUAL (   v1,
  v2,
  eps 
)    ASSERT_MESSAGE( utest_vect_message( ( v1 ), ( v2 ) ), utest_vect_equal( ( v1 ), ( v2 ), ( eps ) ) )

compare two vectors (Vector3D)

Ensure that the test result Vector3D v2 is within eps of the expected vector v1 .

Definition at line 56 of file UnitUtil.hpp.

Referenced by AveragingQMTest::check_average_gradients(), SphericalDomainTest::check_closest_pt(), SphericalDomainTest::check_normal(), AveragingQMTest::check_pmean_hessian(), AveragingQMTest::check_pmean_hessian_diagonals(), PMeanPTemplateTest::check_result(), PatchDataTest::check_sub_patch(), QualityMetricTester::compare_analytical_and_numerical_gradients(), TMPQualityMetricTest< QMType >::compare_analytical_and_numerical_gradients(), BCDTest::compare_bcd(), ObjectiveFunctionTests::compare_diagonal_gradient(), QualityMetricTester::compare_eval_with_diag_and_eval_with_hessian(), QualityMetricTester::compare_eval_with_grad_and_eval_with_diagonal(), QualityMetricTester::compare_eval_with_grad_and_eval_with_hessian(), QualityMetricTest::compare_gradient(), ObjectiveFunctionTests::compare_hessian_diagonal(), ObjectiveFunctionTests::compare_hessian_gradient(), ObjectiveFunctionTests::compare_numerical_gradient(), TQualityMetricTest::regression_inverse_mean_ratio_grad(), TQualityMetricTest::regression_inverse_mean_ratio_hess(), DomainClassifierTest::setUp(), MeshImplTest::skin_mesh_higher_order(), MeshImplTest::skin_mesh_mixed(), TagVertexMeshTest::test_alternate_name(), GeomPrimTest::test_circle_basic(), GeomPrimTest::test_circle_closest_to_point(), GeomPrimTest::test_circle_closest_with_tangent(), GeomPrimTest::test_circle_from_two_points(), TagVertexMeshTest::test_cleanup(), ConicDomainTest::test_closest_point(), XYRectangleTest::test_closest_point(), ConicDomainTest::test_construct(), SphericalDomainTest::test_construct(), QualityMetricTester::test_diagonal_with_fixed_vertex(), PlanarGeometryTest::test_fit_plane(), SphericalDomainTest::test_fit_vertices(), QualityMetricTester::test_grad_transform_invariant(), PMeanPMetricTest::test_gradient(), TMPQualityMetricTest< QMType >::test_gradient_3D(), TMPQualityMetricTest< QMType >::test_gradient_common(), QualityMetricTest::test_gradient_constant(), QualityMetricTest::test_gradient_linear(), QualityMetricTest::test_gradient_parabolic(), QualityMetricTest::test_gradient_tau(), NumericalOFTest::test_gradient_values(), QualityMetricTester::test_gradient_with_fixed_vertex(), PMeanPMetricTest::test_hessian(), PMeanPMetricTest::test_hessian_diagonal(), QualityMetricTester::test_hessian_with_fixed_vertex(), HigherOrderTest::test_hex_basic(), QualityMetricTester::test_ideal_element_zero_gradient(), QualityMetricTester::test_ideal_element_zero_vertex_gradient(), GeomPrimTest::test_line_basic(), GeomPrimTest::test_line_intersect(), CompositeOFTest::test_multiply_hess_diagonal(), ObjectiveFunctionTests::test_negate_flag(), ConicDomainTest::test_normal_at(), XYRectangleTest::test_normal_at(), GeomPrimTest::test_plane_basic(), GeomPrimTest::test_plane_closest_to_point(), GeomPrimTest::test_plane_intersect_line(), MBMesquite::LineDomainTest::test_position_from_length(), MBMesquite::CircleDomainTest::test_position_from_length(), PatchDataTest::test_quad8_patch(), HigherOrderTest::test_quad_basic_ideal(), HigherOrderTest::test_quad_basic_left_down(), HigherOrderTest::test_quad_basic_left_over(), HigherOrderTest::test_quad_basic_mid_convex(), HigherOrderTest::test_quad_basic_mid_spin(), HigherOrderTest::test_quad_basic_right_up(), HigherOrderTest::test_quad_basic_top_down(), TagVertexMeshTest::test_reference_mesh(), QualityMetricTest::test_remove_fixed_gradients(), TagVertexMeshTest::test_save_coordinates(), MBMesquite::CircleDomainTest::test_snap_to(), ConicDomainTest::test_snap_to(), XYRectangleTest::test_snap_to(), GeomPrimTest::test_sphere_basic(), GeomPrimTest::test_sphere_closest_to_point(), GeomPrimTest::test_sphere_intersect_plane(), HigherOrderTest::test_tet_basic_apex_down(), HigherOrderTest::test_tet_basic_apex_over(), HigherOrderTest::test_tet_basic_apex_up(), HigherOrderTest::test_tet_basic_ideal(), HigherOrderTest::test_tet_basic_mid_convex(), HigherOrderTest::test_tet_basic_mid_spin(), PatchDataTest::test_update_slave_node_coords(), SymMatrix3DTest::test_vector_multiply(), TagVertexMeshTest::test_vertex_coordinates(), ArrayMeshTest::test_vertex_set_coordinates(), ArrayMeshTest::test_vertex_set_coordinates_one_based(), ArrayMeshTest::test_vertex_set_coordinates_two_d(), ArrayMeshTest::test_vertices_get_coordinates(), ArrayMeshTest::test_vertices_get_coordinates_one_based(), and ArrayMeshTest::test_vertices_get_coordinates_two_d().


Function Documentation

template<typename T1 , typename T2 >
bool arrays_equal ( const T1 *  A,
const T2 *  B,
size_t  len 
) [inline]

Definition at line 230 of file UnitUtil.hpp.

{
    for( size_t i = 0; i < len; ++i )
        if( A[i] != B[i] ) return false;
    return true;
}
template<typename T1 , typename T2 >
CppUnit::Message arrays_not_equal_msg ( const T1 *  A,
size_t  A_len,
const T2 *  B,
size_t  B_len 
) [inline]

Definition at line 238 of file UnitUtil.hpp.

{
    CppUnit::Message mes( "Equality Assertion Failed for Arrays" );

    std::ostringstream strA;
    if( A_len == 0 )
        strA << "(empty)";
    else
    {
        strA << '[' << A[0];
        for( size_t i = 1; i < A_len; ++i )
            strA << ',' << A[i];
        strA << ']';
    }
    mes.addDetail( std::string( "Expected: " ) + strA.str() );

    std::ostringstream strB;
    if( B_len == 0 )
        strB << "(empty)";
    else
    {
        strB << '[' << B[0];
        for( size_t i = 1; i < B_len; ++i )
            strB << ',' << B[i];
        strB << ']';
    }
    mes.addDetail( std::string( "Actual: " ) + strB.str() );

    return mes;
}
template<unsigned R, unsigned C>
bool ident_check ( const MBMesquite::MsqMatrix< R, C > &  m) [inline]

Definition at line 187 of file UnitUtil.hpp.

References C, and moab::R.

{
    for( unsigned i = 0; i < R; ++i )
        for( unsigned j = 0; j < C; ++j )
            if( i == j && fabs( m( i, j ) - 1.0 ) > 1e-6 )
                return false;
            else if( i != j && fabs( m( i, j ) ) > 1e-6 )
                return false;
    return true;
}
template<unsigned R, unsigned C>
CppUnit::Message ident_check_msg ( const MBMesquite::MsqMatrix< R, C > &  m) [inline]

Definition at line 179 of file UnitUtil.hpp.

References msq_mat_str().

{
    CppUnit::Message mes( "Identity Assertion Failed" );
    mes.addDetail( std::string( "Actual: " ) + msq_mat_str( m ) );
    return mes;
}
template<unsigned R, unsigned C>
bool mat_equal_check ( const MBMesquite::MsqMatrix< R, C > &  A,
const MBMesquite::MsqMatrix< R, C > &  B,
double  eps 
) [inline]

Definition at line 219 of file UnitUtil.hpp.

References C, and moab::R.

{
    for( unsigned i = 0; i < R; ++i )
        for( unsigned j = 0; j < C; ++j )
            if( fabs( A( i, j ) - B( i, j ) ) > eps ) return false;
    return true;
}
template<unsigned R, unsigned C>
CppUnit::Message mat_equal_check_msg ( const MBMesquite::MsqMatrix< R, C > &  A,
const MBMesquite::MsqMatrix< R, C > &  B 
) [inline]

Definition at line 199 of file UnitUtil.hpp.

References msq_mat_str().

{
    CppUnit::Message mes( "Matrix Equality Assertion Failed" );
    mes.addDetail( std::string( "Expected: " ) + msq_mat_str( A ) );
    mes.addDetail( std::string( "Actual:   " ) + msq_mat_str( B ) );
    return mes;
}
template<unsigned R, unsigned C>
CppUnit::Message mat_not_equal_check_msg ( const MBMesquite::MsqMatrix< R, C > &  A,
const MBMesquite::MsqMatrix< R, C > &  B 
) [inline]

Definition at line 209 of file UnitUtil.hpp.

References msq_mat_str().

{
    CppUnit::Message mes( "Matrix Inequality Assertion Failed" );
    mes.addDetail( std::string( "Expected: " ) + msq_mat_str( A ) );
    mes.addDetail( std::string( "Actual:   " ) + msq_mat_str( B ) );
    return mes;
}
template<unsigned R, unsigned C>
std::string msq_mat_str ( const MBMesquite::MsqMatrix< R, C > &  m) [inline]

Definition at line 165 of file UnitUtil.hpp.

References C, and moab::R.

Referenced by ident_check_msg(), mat_equal_check_msg(), and mat_not_equal_check_msg().

{
    std::ostringstream os;
    for( unsigned i = 0; i < R; ++i )
    {
        os << "[" << m( i, 0 );
        for( unsigned j = 1; j < C; ++j )
            os << ", " << m( i, j );
        os << "]";
    }
    return os.str();
}
bool utest_mat_equal ( const MBMesquite::Matrix3D m1,
const MBMesquite::Matrix3D m2,
double  eps 
) [inline]

compare matrices

Definition at line 147 of file UnitUtil.hpp.

References eps.

{
    return ( fabs( m1[0][0] - m2[0][0] ) < eps ) && ( fabs( m1[0][1] - m2[0][1] ) < eps ) &&
           ( fabs( m1[0][2] - m2[0][2] ) < eps ) && ( fabs( m1[1][0] - m2[1][0] ) < eps ) &&
           ( fabs( m1[1][1] - m2[1][1] ) < eps ) && ( fabs( m1[1][2] - m2[1][2] ) < eps ) &&
           ( fabs( m1[2][0] - m2[2][0] ) < eps ) && ( fabs( m1[2][1] - m2[2][1] ) < eps ) &&
           ( fabs( m1[2][2] - m2[2][2] ) < eps );
}
bool utest_mat_equal ( const MBMesquite::SymMatrix3D m1,
const MBMesquite::SymMatrix3D m2,
double  eps 
) [inline]

compare matrices

Definition at line 157 of file UnitUtil.hpp.

References eps.

{
    return ( fabs( m1( 0, 0 ) - m2( 0, 0 ) ) < eps ) && ( fabs( m1( 0, 1 ) - m2( 0, 1 ) ) < eps ) &&
           ( fabs( m1( 0, 2 ) - m2( 0, 2 ) ) < eps ) && ( fabs( m1( 1, 1 ) - m2( 1, 1 ) ) < eps ) &&
           ( fabs( m1( 1, 2 ) - m2( 1, 2 ) ) < eps ) && ( fabs( m1( 2, 2 ) - m2( 2, 2 ) ) < eps );
}
CppUnit::Message utest_mat_message ( const MBMesquite::Matrix3D m1,
const MBMesquite::Matrix3D m2 
) [inline]

make error message for failed matrix copmarison

Definition at line 123 of file UnitUtil.hpp.

References utest_mat_str().

{
    CppUnit::Message m( "equality assertion failed" );
    m.addDetail( std::string( "Expected: " ) + utest_mat_str( m1 ) );
    m.addDetail( std::string( "Actual  : " ) + utest_mat_str( m2 ) );
    return m;
}
CppUnit::Message utest_mat_message ( const MBMesquite::SymMatrix3D m1,
const MBMesquite::SymMatrix3D m2 
) [inline]

make error message for failed symmetric matrix copmarison

Definition at line 132 of file UnitUtil.hpp.

References utest_mat_str().

{
    CppUnit::Message m( "equality assertion failed" );
    m.addDetail( std::string( "Expected: " ) + utest_mat_str( m1 ) );
    m.addDetail( std::string( "Actual  : " ) + utest_mat_str( m2 ) );
    return m;
}
std::string utest_mat_str ( const MBMesquite::Matrix3D m) [inline]

make string representation of 3x3 matrix

Definition at line 96 of file UnitUtil.hpp.

References buffer.

Referenced by utest_mat_message().

{
    char buffer[256];
    sprintf( buffer, "[%f, %f, %f] [%f, %f, %f] [%f, %f, %f]", m[0][0], m[0][1], m[0][2], m[1][0], m[1][1], m[1][2],
             m[2][0], m[2][1], m[2][2] );
    return buffer;
}
std::string utest_mat_str ( const MBMesquite::SymMatrix3D m) [inline]

make string representation of 3x3 symetric matrix

Definition at line 105 of file UnitUtil.hpp.

References buffer.

{
    char buffer[256];
    sprintf( buffer, "[%f, %f, %f] [%f, %f, %f] [%f, %f, %f]", m( 0, 0 ), m( 0, 1 ), m( 0, 2 ), m( 1, 0 ), m( 1, 1 ),
             m( 1, 2 ), m( 2, 0 ), m( 2, 1 ), m( 2, 2 ) );
    return buffer;
}
bool utest_vect_equal ( const MBMesquite::Vector3D v1,
const MBMesquite::Vector3D v2,
double  eps 
) [inline]

compare vectors

Definition at line 141 of file UnitUtil.hpp.

References eps.

{
    return ( fabs( v1[0] - v2[0] ) < eps ) && ( fabs( v1[1] - v2[1] ) < eps ) && ( fabs( v1[2] - v2[2] ) < eps );
}
CppUnit::Message utest_vect_message ( const MBMesquite::Vector3D v1,
const MBMesquite::Vector3D v2 
) [inline]

make error message for failed vector copmarison

Definition at line 114 of file UnitUtil.hpp.

References utest_vect_str().

{
    CppUnit::Message m( "equality assertion failed" );
    m.addDetail( std::string( "Expected: " ) + utest_vect_str( v1 ) );
    m.addDetail( std::string( "Actual  : " ) + utest_vect_str( v2 ) );
    return m;
}
std::string utest_vect_str ( const MBMesquite::Vector3D v) [inline]

make string representation of cartesian vector

Definition at line 88 of file UnitUtil.hpp.

References buffer.

Referenced by utest_vect_message().

{
    char buffer[128];
    sprintf( buffer, "[%f, %f, %f]", v[0], v[1], v[2] );
    return buffer;
}
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines