3
0
mirror of https://github.com/triqs/dft_tools synced 2024-12-25 22:03:43 +01:00

arrays: fix some test to avoid valgrind error

This commit is contained in:
Olivier Parcollet 2013-09-07 20:56:19 +02:00
parent 11081a68b7
commit 27be5cbd5b
2 changed files with 7 additions and 0 deletions

View File

@ -19,6 +19,7 @@
* TRIQS. If not, see <http://www.gnu.org/licenses/>. * TRIQS. If not, see <http://www.gnu.org/licenses/>.
* *
******************************************************************************/ ******************************************************************************/
#define TRIQS_ARRAYS_ENFORCE_BOUNDCHECK
#include "./common.hpp" #include "./common.hpp"
#include "./src/array.hpp" #include "./src/array.hpp"
@ -69,7 +70,9 @@ int main(int argc, char **argv) {
ia >> A>> SL; ia >> A>> SL;
// archive and stream closed when destructors are called // archive and stream closed when destructors are called
} }
std::cout<<"A is "<<A<<std::endl; std::cout<<"A is "<<A<<std::endl;
std::cout<<"SLICE : A(0,range(0,3)) "<<SL<<std::endl; std::cout<<"SLICE : A(0,range(0,3)) "<<SL<<std::endl;
std::cout<<"Setting A(0,0) =56 "<<std::endl; std::cout<<"Setting A(0,0) =56 "<<std::endl;

View File

@ -61,6 +61,9 @@ int main(int argc, char **argv) {
std::cerr << " good "<< r << r.storage().is_weak << std::endl ; std::cerr << " good "<< r << r.storage().is_weak << std::endl ;
} }
// rm or valgrind will find the error
//#define VALGRIND
#ifndef VALGRIND
{ {
auto & r = bad2 ( { 1,2,3,4} ); auto & r = bad2 ( { 1,2,3,4} );
std::cerr << " bad2 " << r << std::endl ; std::cerr << " bad2 " << r << std::endl ;
@ -70,6 +73,7 @@ int main(int argc, char **argv) {
auto r = bad ( { 1,2,3,4} ); auto r = bad ( { 1,2,3,4} );
std::cerr << " bad " << r << r.storage().is_weak << std::endl ; std::cerr << " bad " << r << r.storage().is_weak << std::endl ;
} }
#endif
} }
catch (std::exception & e) { std::cout << e.what()<<std::endl;} catch (std::exception & e) { std::cout << e.what()<<std::endl;}