OSDN Git Service

Merge remote-tracking branch 'gnu/gcc-4_7-branch' into rework
[pf3gnuchains/gcc-fork.git] / libstdc++-v3 / testsuite / util / regression / rand / assoc / rand_regression_test.hpp
index 5f23049..936fbf5 100644 (file)
@@ -1,6 +1,7 @@
 // -*- C++ -*-
 
-// Copyright (C) 2005, 2006, 2009, 2010 Free Software Foundation, Inc.
+// Copyright (C) 2005, 2006, 2009, 2010, 2011
+// Free Software Foundation, Inc.
 //
 // This file is part of the GNU ISO C++ Library.  This library is free
 // software; you can redistribute it and/or modify it under the terms
@@ -62,7 +63,10 @@ namespace detail
                  double ep, double cp, double mp, bool d) 
     : m_sd(seed), m_n(n), m_m(m), m_tp(tp), m_ip(ip), m_ep(ep), m_cp(cp), 
       m_mp(mp), m_disp(d)
-    { }
+    { 
+      if (m_disp)
+       xml_test_rand_regression_formatter(seed, n, m, tp, ip, ep, cp, mp);
+    }
 
     template<typename Cntnr>
     void
@@ -107,27 +111,22 @@ namespace detail
     double ep = 0.2; 
     double cp = 0.001;
     double mp = 0.25;
-    bool disp = false; // show progress
+    bool disp = true; // show progress
 
     try
       {
        detail::verify_params(sd, n, m, tp, ip, ep, cp, mp, disp);
       }
-    catch (__gnu_pbds::test::illegal_input_error&)
+    catch(__gnu_pbds::test::illegal_input_error&)
       {
        detail::usage(name);
        return -1;
       }
-    catch (...)
+    catch(...)
       {
        return -2;
       };
 
-    // XXX RAII, constructor takes bool for display
-    xml_test_rand_regression_formatter* p_fmt = 0;
-    if (disp)
-      p_fmt = new xml_test_rand_regression_formatter(sd, n, m, tp, ip, ep, cp, mp);
-
     try
       {
        detail::rand_reg_test tst(sd, n, m, tp, ip, ep, cp, mp, disp);
@@ -136,13 +135,9 @@ namespace detail
     catch (...)
       {
        std::cerr << "Test failed with seed " << sd << std::endl;
-       if (disp)
-         delete p_fmt;
        throw;
       }
 
-    if (disp)
-      delete p_fmt;
     return 0;
   }
 
@@ -152,8 +147,9 @@ namespace detail
   usage(const std::string& name)
   {
     using namespace std;
-    cerr << "usage: " << name << " <sd> <n> <m> <tp> <ip> <ep> <cp> <mp> ['t' | 'f']" <<
-      endl << endl;
+    cerr << "usage: " << name 
+        << " <sd> <n> <m> <tp> <ip> <ep> <cp> <mp> ['t' | 'f']" 
+        << endl << endl;
 
     cerr << "This test performs basic regression tests on various associative containers."
       "For each container, it performs a sequence of operations. At each iteration, it does "