Changeset 3519 for trunk/test_more


Ignore:
Timestamp:
Dec 28, 2014 11:22:57 AM (5 years ago)
Author:
bradbell
Message:
  1. Fix some clang 3.5 warnings about local functions that were not used.
  2. Change ndebug -> adfun_copy and test error on ADFun copy constructor usage.

CMakeLists.txt: remove duplicate compliation of eigen_soruces.
makefile.am: :

Location:
trunk/test_more
Files:
7 edited
1 moved

Legend:

Unmodified
Added
Removed
  • trunk/test_more/CMakeLists.txt

    r3301 r3519  
    6565        ${colpack_sources}
    6666        ${ipopt_sources}
    67         ${eigen_sources}
    6867        abs.cpp
    6968        acos.cpp
     69        adfun_copy.cpp
    7070        asin.cpp
    7171        assign.cpp
     
    107107        mul_level.cpp
    108108        mul_zero_one.cpp
    109         ndebug.cpp
    110109        near_equal_ext.cpp
    111110        neg.cpp
  • trunk/test_more/adfun_copy.cpp

    r3518 r3519  
    1212
    1313/*
    14 Tests that that expect NDEBUG to be defined.
     14Test that ADFun copy constructor generates an error message.
    1515*/
    1616
    1717# include <cppad/cppad.hpp>
     18# include <string>
    1819
    1920namespace {
    20         // make sure that this function can be compiled
    21         bool ad_fun_copy(void)
    22         {       bool                ok = true;
    23                 CppAD::ADFun<double> f;
    2421
    25                 // This operation uses the ADFun copy constructor which is defined,
    26                 // but should not be used
    27                 CppAD::ADFun<double> g(f);
     22        // error handler to catch the error
     23        void myhandler(
     24                bool known       ,
     25                int  line        ,
     26                const char *file ,
     27                const char *exp  ,
     28                const char *msg  )
     29        {       // error handler must not return, so throw an exception
     30                throw std::string("myhandler");
     31        }
    2832
    29                 ok &= (g.size_var() == 0);
    30 
    31                 return ok;
    32         }
    3333}
    3434
    35 
    36 bool ndebug(void)
    37 {       bool ok = true;
    38 
    39 
     35bool adfun_copy(void)
     36{
     37        // error handler for this routine
     38        CppAD::ErrorHandler info(myhandler);
     39        // an ADFun object
     40        CppAD::ADFun<double> f;
     41        // value of ok if no error occurs
     42        bool ok = false;
     43        try {
     44                // This operation uses the ADFun copy constructor which is defined,
     45                // but should not be used and should generate an error
     46                CppAD::ADFun<double> g(f);
     47        }
     48        catch ( std::string msg )
     49        {       // check for expected return
     50                ok = (msg == "myhandler");
     51        }
    4052        return ok;
    4153}
  • trunk/test_more/div.cpp

    r2506 r3519  
    204204        ok &= DivTestOne();
    205205        ok &= DivTestTwo();
    206         return ok;
    207 }
     206        ok &= DivTestThree();
     207        return ok;
     208}
  • trunk/test_more/makefile.am

    r3301 r3519  
    9292        abs.cpp \
    9393        acos.cpp \
     94        adfun_copy.cpp \
    9495        asin.cpp \
    9596        assign.cpp \
     
    132133        mul_level.cpp \
    133134        mul_zero_one.cpp \
    134         ndebug.cpp \
    135135        near_equal_ext.cpp \
    136136        neg.cpp \
     
    169169        vec_unary.cpp
    170170
    171 ndebug.$(OBJEXT): ndebug.cpp
    172         $(CXXCOMPILE) \
    173         -DNDEBUG -c $(top_srcdir)/test_more/ndebug.cpp -o ndebug.$(OBJEXT)
    174 
    175171test: check
    176172        ./test_more
  • trunk/test_more/makefile.in

    r3497 r3519  
    103103libeigen_a_OBJECTS = $(am_libeigen_a_OBJECTS)
    104104am__test_more_SOURCES_DIST = base_adolc.cpp ipopt_solve.cpp \
    105         alloc_openmp.cpp test_more.cpp abs.cpp acos.cpp asin.cpp \
    106         assign.cpp add.cpp add_eq.cpp add_zero.cpp atan.cpp atan2.cpp \
    107         base_alloc.cpp check_simple_vector.cpp checkpoint.cpp \
    108         compare.cpp compare_change.cpp cond_exp.cpp cond_exp_ad.cpp \
    109         copy.cpp cos.cpp cosh.cpp dbl_epsilon.cpp div.cpp div_eq.cpp \
    110         div_zero_one.cpp erf.cpp exp.cpp extern_value.cpp \
    111         extern_value.hpp for_hess.cpp for_sparse_jac.cpp forward.cpp \
    112         forward_dir.cpp forward_order.cpp from_base.cpp fun_check.cpp \
    113         jacobian.cpp limits.cpp log.cpp log10.cpp mul.cpp mul_eq.cpp \
    114         mul_level.cpp mul_zero_one.cpp ndebug.cpp near_equal_ext.cpp \
    115         neg.cpp ode_err_control.cpp optimize.cpp parameter.cpp \
    116         poly.cpp pow.cpp pow_int.cpp print_for.cpp romberg_one.cpp \
    117         rosen_34.cpp runge_45.cpp reverse.cpp rev_sparse_hes.cpp \
    118         rev_sparse_jac.cpp rev_two.cpp simple_vector.cpp sin.cpp \
    119         sin_cos.cpp sinh.cpp sparse_hessian.cpp sparse_jacobian.cpp \
    120         sparse_vec_ad.cpp sqrt.cpp std_math.cpp sub.cpp sub_eq.cpp \
    121         sub_zero.cpp tan.cpp test_vector.cpp track_new_del.cpp \
    122         value.cpp vec_ad.cpp vec_ad_par.cpp vec_unary.cpp
     105        alloc_openmp.cpp test_more.cpp abs.cpp acos.cpp adfun_copy.cpp \
     106        asin.cpp assign.cpp add.cpp add_eq.cpp add_zero.cpp atan.cpp \
     107        atan2.cpp base_alloc.cpp check_simple_vector.cpp \
     108        checkpoint.cpp compare.cpp compare_change.cpp cond_exp.cpp \
     109        cond_exp_ad.cpp copy.cpp cos.cpp cosh.cpp dbl_epsilon.cpp \
     110        div.cpp div_eq.cpp div_zero_one.cpp erf.cpp exp.cpp \
     111        extern_value.cpp extern_value.hpp for_hess.cpp \
     112        for_sparse_jac.cpp forward.cpp forward_dir.cpp \
     113        forward_order.cpp from_base.cpp fun_check.cpp jacobian.cpp \
     114        limits.cpp log.cpp log10.cpp mul.cpp mul_eq.cpp mul_level.cpp \
     115        mul_zero_one.cpp near_equal_ext.cpp neg.cpp \
     116        ode_err_control.cpp optimize.cpp parameter.cpp poly.cpp \
     117        pow.cpp pow_int.cpp print_for.cpp romberg_one.cpp rosen_34.cpp \
     118        runge_45.cpp reverse.cpp rev_sparse_hes.cpp rev_sparse_jac.cpp \
     119        rev_two.cpp simple_vector.cpp sin.cpp sin_cos.cpp sinh.cpp \
     120        sparse_hessian.cpp sparse_jacobian.cpp sparse_vec_ad.cpp \
     121        sqrt.cpp std_math.cpp sub.cpp sub_eq.cpp sub_zero.cpp tan.cpp \
     122        test_vector.cpp track_new_del.cpp value.cpp vec_ad.cpp \
     123        vec_ad_par.cpp vec_unary.cpp
    123124@CppAD_ADOLC_TRUE@am__objects_1 = base_adolc.$(OBJEXT)
    124125@CppAD_IPOPT_TRUE@am__objects_2 = ipopt_solve.$(OBJEXT)
     
    126127am_test_more_OBJECTS = $(am__objects_1) $(am__objects_2) \
    127128        $(am__objects_3) test_more.$(OBJEXT) abs.$(OBJEXT) \
    128         acos.$(OBJEXT) asin.$(OBJEXT) assign.$(OBJEXT) add.$(OBJEXT) \
    129         add_eq.$(OBJEXT) add_zero.$(OBJEXT) atan.$(OBJEXT) \
    130         atan2.$(OBJEXT) base_alloc.$(OBJEXT) \
    131         check_simple_vector.$(OBJEXT) checkpoint.$(OBJEXT) \
    132         compare.$(OBJEXT) compare_change.$(OBJEXT) cond_exp.$(OBJEXT) \
     129        acos.$(OBJEXT) adfun_copy.$(OBJEXT) asin.$(OBJEXT) \
     130        assign.$(OBJEXT) add.$(OBJEXT) add_eq.$(OBJEXT) \
     131        add_zero.$(OBJEXT) atan.$(OBJEXT) atan2.$(OBJEXT) \
     132        base_alloc.$(OBJEXT) check_simple_vector.$(OBJEXT) \
     133        checkpoint.$(OBJEXT) compare.$(OBJEXT) \
     134        compare_change.$(OBJEXT) cond_exp.$(OBJEXT) \
    133135        cond_exp_ad.$(OBJEXT) copy.$(OBJEXT) cos.$(OBJEXT) \
    134136        cosh.$(OBJEXT) dbl_epsilon.$(OBJEXT) div.$(OBJEXT) \
     
    140142        limits.$(OBJEXT) log.$(OBJEXT) log10.$(OBJEXT) mul.$(OBJEXT) \
    141143        mul_eq.$(OBJEXT) mul_level.$(OBJEXT) mul_zero_one.$(OBJEXT) \
    142         ndebug.$(OBJEXT) near_equal_ext.$(OBJEXT) neg.$(OBJEXT) \
     144        near_equal_ext.$(OBJEXT) neg.$(OBJEXT) \
    143145        ode_err_control.$(OBJEXT) optimize.$(OBJEXT) \
    144146        parameter.$(OBJEXT) poly.$(OBJEXT) pow.$(OBJEXT) \
     
    474476        abs.cpp \
    475477        acos.cpp \
     478        adfun_copy.cpp \
    476479        asin.cpp \
    477480        assign.cpp \
     
    514517        mul_level.cpp \
    515518        mul_zero_one.cpp \
    516         ndebug.cpp \
    517519        near_equal_ext.cpp \
    518520        neg.cpp \
     
    614616@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add_eq.Po@am__quote@
    615617@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/add_zero.Po@am__quote@
     618@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/adfun_copy.Po@am__quote@
    616619@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/alloc_openmp.Po@am__quote@
    617620@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/asin.Po@am__quote@
     
    654657@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_level.Po@am__quote@
    655658@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/mul_zero_one.Po@am__quote@
    656 @AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/ndebug.Po@am__quote@
    657659@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/near_equal_ext.Po@am__quote@
    658660@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/neg.Po@am__quote@
     
    926928
    927929
    928 ndebug.$(OBJEXT): ndebug.cpp
    929         $(CXXCOMPILE) \
    930         -DNDEBUG -c $(top_srcdir)/test_more/ndebug.cpp -o ndebug.$(OBJEXT)
    931 
    932930test: check
    933931        ./test_more
  • trunk/test_more/rev_sparse_jac.cpp

    r2859 r3519  
    534534        ok &= case_three();
    535535        ok &= case_four();
     536        ok &= case_five();
    536537
    537538        return ok;
  • trunk/test_more/test_more.cpp

    r3301 r3519  
    2020extern bool abs(void);
    2121extern bool Acos(void);
     22extern bool adfun_copy(void);
    2223extern bool Add(void);
    2324extern bool AddEq(void);
     
    6263extern bool MulEq(void);
    6364extern bool MulZeroOne(void);
    64 extern bool ndebug(void);
    6565extern bool NearEqualExt(void);
    6666extern bool Neg(void);
     
    134134        ok &= Run( abs,             "abs"            );
    135135        ok &= Run( Acos,            "Acos"           );
     136        ok &= Run( adfun_copy,      "adfun_copy"     );
    136137        ok &= Run( Add,             "Add"            );
    137138        ok &= Run( AddEq,           "AddEq"          );
  • trunk/test_more/test_one.sh.in

    r3116 r3519  
    8585        fi
    8686done
    87 if [ "$1" == 'ndebug.cpp' ]
    88 then
    89         cmd="$cmd -DNDEBUG"
    90 fi
    9187echo $cmd
    9288$cmd
Note: See TracChangeset for help on using the changeset viewer.