From: Jean-Paul Pelteret Date: Sun, 22 Jan 2017 07:00:05 +0000 (+0100) Subject: Amend test introduced in #3826 X-Git-Tag: v8.5.0-rc1~215^2 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F3830%2Fhead;p=dealii.git Amend test introduced in #3826 This commit attends to the comments made by @tjhei and @drwells after #3826 was merged. --- diff --git a/tests/trilinos/vector_reference_01.cc b/tests/trilinos/vector_reference_01.cc index 79d7a51f2f..65fb2ea1ab 100644 --- a/tests/trilinos/vector_reference_01.cc +++ b/tests/trilinos/vector_reference_01.cc @@ -16,10 +16,9 @@ // TrilinosWrappers::internal::VectorReference had its non-const copy -// operator return a const reference. that was non-intuitive but, +// operator return a const reference. That was non-intuitive but, // because of the particular semantics of copying vector reference -// objects, made no difference. either way, have a check for these -// semantics +// objects, made no difference. Either way, we now check these semantics. #include "../tests.h" #include @@ -39,57 +38,28 @@ void test () TrilinosWrappers::internal::VectorReference b (v(1)); TrilinosWrappers::internal::VectorReference c (v(2)); - // copy VectorReference objects. note that operator= for these - // objects does not copy the*content* of the reference object, but - // assigns the value of the vector element referenced on the right - // to the vector element referenced on the left + // Copy the VectorReference objects. Note that operator= for these + // objects does not copy the *content* of the reference object, but + // rather assigns the value of the vector element referenced on the + // right to the vector element referenced on the left. + // So the applied operations result in the following actions: + // 1. We first assign c to point to where a points (c points to entry 0) + // 2. We next assign c to point to where b points (c points to entry 1) + // 3. Lastly, we assign b to point to where a points (b points to entry 0) (c = a) = b; b = a; deallog << static_cast(a) << std::endl; // should point to v(0) deallog << static_cast(b) << std::endl; // should point to v(0) - deallog << static_cast(c) << std::endl; // should point to v(0) + deallog << static_cast(c) << std::endl; // should point to v(1) } int main (int argc,char **argv) { - std::ofstream logfile("output"); - deallog.attach(logfile); - deallog.threshold_double(1.e-10); - Utilities::MPI::MPI_InitFinalize mpi_initialization (argc, argv, testing_max_num_threads()); + MPILogInitAll log; - - try - { - { - test (); - } - } - catch (std::exception &exc) - { - std::cerr << std::endl << std::endl - << "----------------------------------------------------" - << std::endl; - std::cerr << "Exception on processing: " << std::endl - << exc.what() << std::endl - << "Aborting!" << std::endl - << "----------------------------------------------------" - << std::endl; - - return 1; - } - catch (...) - { - std::cerr << std::endl << std::endl - << "----------------------------------------------------" - << std::endl; - std::cerr << "Unknown exception!" << std::endl - << "Aborting!" << std::endl - << "----------------------------------------------------" - << std::endl; - return 1; - }; + test (); } diff --git a/tests/trilinos/vector_reference_01.output b/tests/trilinos/vector_reference_01.output index c1bad75d2c..1e1d427bec 100644 --- a/tests/trilinos/vector_reference_01.output +++ b/tests/trilinos/vector_reference_01.output @@ -1,4 +1,4 @@ -DEAL::0 -DEAL::0 -DEAL::1.00000 +DEAL:0::0.00000 +DEAL:0::0.00000 +DEAL:0::1.00000