Commit bb0dce3659327b5e7513fe499f6fa9a17f3d70d5
1 parent
48cb48d7
correct range checking code
Showing
3 changed files
with
45 additions
and
40 deletions
test/test_GMatrix.cpp
| ... | ... | @@ -565,19 +565,19 @@ int main(void) |
| 565 | 565 | cout << e.what() << endl; |
| 566 | 566 | throw; |
| 567 | 567 | } |
| 568 | - #if defined(G_RANGE_CHECK) | |
| 569 | - try { | |
| 570 | - GMatrix test3(3,3); | |
| 571 | - test3(3,3) = 1.0; | |
| 572 | - } | |
| 573 | - catch (GMatrix::out_of_range &e) { | |
| 574 | - } | |
| 575 | - catch (exception &e) { | |
| 576 | - cout << e.what() << endl; | |
| 577 | - throw; | |
| 578 | - } | |
| 579 | - #endif | |
| 580 | - cout << "ok." << endl; | |
| 568 | + #if defined(G_RANGE_CHECK) | |
| 569 | + try { | |
| 570 | + GMatrix test3(3,3); | |
| 571 | + test3(3,3) = 1.0; | |
| 572 | + } | |
| 573 | + catch (GException::out_of_range &e) { | |
| 574 | + } | |
| 575 | + catch (exception &e) { | |
| 576 | + std::cout << e.what() << std::endl; | |
| 577 | + throw; | |
| 578 | + } | |
| 579 | + #endif | |
| 580 | + cout << "ok." << endl; | |
| 581 | 581 | |
| 582 | 582 | // Test 4: Matrix copy constructor |
| 583 | 583 | try { | ... | ... |
test/test_GSparseMatrix.cpp
| ... | ... | @@ -369,19 +369,19 @@ void test_assign_values(const GSparseMatrix& m_test) |
| 369 | 369 | cout << e.what() << endl; |
| 370 | 370 | throw; |
| 371 | 371 | } |
| 372 | - #if defined(G_RANGE_CHECK) | |
| 373 | - try { | |
| 374 | - GSparseMatrix test(3,3); | |
| 375 | - test(3,3) = 1.0; | |
| 376 | - } | |
| 377 | - catch (GMatrix::out_of_range &e) { | |
| 378 | - } | |
| 379 | - catch (exception &e) { | |
| 380 | - cout << e.what() << endl; | |
| 381 | - throw; | |
| 382 | - } | |
| 383 | - cout << "."; | |
| 384 | - #endif | |
| 372 | + #if defined(G_RANGE_CHECK) | |
| 373 | + try { | |
| 374 | + GSparseMatrix test(3,3); | |
| 375 | + test(3,3) = 1.0; | |
| 376 | + } | |
| 377 | + catch (GException::out_of_range &e) { | |
| 378 | + } | |
| 379 | + catch (exception &e) { | |
| 380 | + cout << e.what() << endl; | |
| 381 | + throw; | |
| 382 | + } | |
| 383 | + cout << "."; | |
| 384 | + #endif | |
| 385 | 385 | // |
| 386 | 386 | // Insert column into 10 x 10 matrix using matrix stack and the |
| 387 | 387 | // compressed vector format | ... | ... |
test/test_GSymMatrix.cpp
| 1 | 1 | /*************************************************************************** |
| 2 | 2 | * test_GSymMatrix.cpp - test GSymMatrix class * |
| 3 | 3 | * ----------------------------------------------------------------------- * |
| 4 | - * copyright (C) 2006-2009 by Jurgen Knodlseder * | |
| 4 | + * copyright (C) 2006-2010 by Jurgen Knodlseder * | |
| 5 | 5 | * ----------------------------------------------------------------------- * |
| 6 | 6 | * * |
| 7 | 7 | * This program is free software; you can redistribute it and/or modify * |
| ... | ... | @@ -10,6 +10,11 @@ |
| 10 | 10 | * (at your option) any later version. * |
| 11 | 11 | * * |
| 12 | 12 | ***************************************************************************/ |
| 13 | +/** | |
| 14 | + * @file test_GSymMatrix.cpp | |
| 15 | + * @brief Testing of GSymMatrix class | |
| 16 | + * @author J. Knodlseder | |
| 17 | + */ | |
| 13 | 18 | |
| 14 | 19 | /* __ Includes ___________________________________________________________ */ |
| 15 | 20 | #include "test_GSymMatrix.hpp" |
| ... | ... | @@ -376,19 +381,19 @@ int main(void) |
| 376 | 381 | cout << e.what() << endl; |
| 377 | 382 | throw; |
| 378 | 383 | } |
| 379 | - #if defined(G_RANGE_CHECK) | |
| 380 | - try { | |
| 381 | - GSymMatrix test3(3,3); | |
| 382 | - test3(3,3) = 1.0; | |
| 383 | - } | |
| 384 | - catch (GMatrix::out_of_range &e) { | |
| 385 | - } | |
| 386 | - catch (exception &e) { | |
| 387 | - cout << e.what() << endl; | |
| 388 | - throw; | |
| 389 | - } | |
| 390 | - #endif | |
| 391 | - cout << "ok." << endl; | |
| 384 | + #if defined(G_RANGE_CHECK) | |
| 385 | + try { | |
| 386 | + GSymMatrix test3(3,3); | |
| 387 | + test3(3,3) = 1.0; | |
| 388 | + } | |
| 389 | + catch (GException::out_of_range &e) { | |
| 390 | + } | |
| 391 | + catch (exception &e) { | |
| 392 | + cout << e.what() << endl; | |
| 393 | + throw; | |
| 394 | + } | |
| 395 | + #endif | |
| 396 | + cout << "ok." << endl; | |
| 392 | 397 | |
| 393 | 398 | // Test 4: Matrix copy constructor |
| 394 | 399 | try { | ... | ... |