Imported Upstream version 58.1
[platform/upstream/icu.git] / source / test / intltest / rbbimonkeytest.cpp
index 90246aa..65eb16f 100644 (file)
@@ -1,3 +1,5 @@
+// Copyright (C) 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
 /********************************************************************
  * Copyright (c) 2016, International Business Machines Corporation and
  * others. All Rights Reserved.
 #include "uelement.h"
 #include "uhash.h"
 
-#include "iostream"
-#include "string"
+#include <iostream>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string>
 
 using namespace icu;
 
@@ -904,22 +908,27 @@ void RBBIMonkeyTest::testMonkey() {
     for (i=0; tests[i] != NULL; ++i) {
         logln("beginning testing of %s", tests[i]);
         RBBIMonkeyImpl *test = new RBBIMonkeyImpl(status);
+        if (U_FAILURE(status)) {
+            errln("%s:%d: error %s while starting test %s.", __FILE__, __LINE__, u_errorName(status), tests[i]);
+            break;
+        }
         test->fDumpExpansions = dumpExpansions;
         test->fVerbose = verbose;
         test->fRandomGenerator.seed((uint32_t)seed);
         test->fLoopCount = loopCount;
         test->setup(tests[i], status);
+        if (U_FAILURE(status)) {
+            errln("%s:%d: error %s while starting test %s.", __FILE__, __LINE__, u_errorName(status), tests[i]);
+            break;
+        }
         test->startTest();
         startedTests.addElement(test, status);
         if (U_FAILURE(status)) {
+            errln("%s:%d: error %s while starting test %s.", __FILE__, __LINE__, u_errorName(status), tests[i]);
             break;
         }
     }
 
-    if (U_FAILURE(status)) {
-        dataerrln("%s:%d: error %s while starting test %s.", __FILE__, __LINE__, u_errorName(status), tests[i]);
-    }
-
     for (i=0; i<startedTests.size(); ++i) {
         RBBIMonkeyImpl *test = static_cast<RBBIMonkeyImpl *>(startedTests.elementAt(i));
         test->join();