quick = caller->quick;
threadCount = caller->threadCount;
testoutfp = caller->testoutfp;
+ write_golden_data = caller->write_golden_data;
LL_indentlevel = caller->LL_indentlevel + indentLevel_offset;
numProps = caller->numProps;
for (int32_t i = 0; i < numProps; i++) {
return rval;
}
+UBool IntlTest::setWriteGoldenData( UBool write_golden_data )
+{
+ UBool rval = this->write_golden_data;
+ this->write_golden_data = write_golden_data;
+ return rval;
+}
+
UBool IntlTest::setNoErrMsg( UBool no_err_msgVal )
{
UBool rval = this->no_err_msg;
// All error messages generated by tests funnel through here.
// Multithreaded tests can concurrently generate errors, requiring synchronization
// to keep each message together.
- static UMutex *messageMutex = STATIC_NEW(UMutex);
- Mutex lock(messageMutex);
+ static UMutex messageMutex;
+ Mutex lock(&messageMutex);
// string that starts with a LineFeed character and continues
// with spaces according to the current indentation
UBool utf8 = FALSE;
const char *summary_file = NULL;
UBool warnOnMissingData = FALSE;
+ UBool writeGoldenData = FALSE;
UBool defaultDataFound = FALSE;
int32_t threadCount = 12;
UErrorCode errorCode = U_ZERO_ERROR;
else if (strcmp("notime", str) == 0 ||
strcmp("T", str) == 0)
no_time = TRUE;
+ else if (strcmp("goldens", str) == 0 ||
+ strcmp("G", str) == 0)
+ writeGoldenData = TRUE;
else if (strncmp("E", str, 1) == 0)
summary_file = str+1;
else if (strcmp("x", str)==0) {
major.setLeaks( leaks );
major.setThreadCount( threadCount );
major.setWarnOnMissingData( warnOnMissingData );
+ major.setWriteGoldenData( writeGoldenData );
major.setNotime (no_time);
for (int32_t i = 0; i < nProps; i++) {
major.setProperty(props[i]);
fprintf(stdout, " Exhaustive (e) : %s\n", (!quick? "On" : "Off"));
fprintf(stdout, " Leaks (l) : %s\n", (leaks? "On" : "Off"));
fprintf(stdout, " utf-8 (u) : %s\n", (utf8? "On" : "Off"));
- fprintf(stdout, " notime (T) : %s\n", (no_time? "On" : "Off"));
- fprintf(stdout, " noknownissues (K) : %s\n", (noKnownIssues? "On" : "Off"));
+ fprintf(stdout, " notime (T) : %s\n", (no_time? "On" : "Off"));
+ fprintf(stdout, " noknownissues (K) : %s\n", (noKnownIssues? "On" : "Off"));
fprintf(stdout, " Warn on missing data (w) : %s\n", (warnOnMissingData? "On" : "Off"));
+ fprintf(stdout, " Write golden data (G) : %s\n", (writeGoldenData? "On" : "Off"));
fprintf(stdout, " Threads : %d\n", threadCount);
for (int32_t i = 0; i < nProps; i++) {
fprintf(stdout, " Custom property (prop:) : %s\n", props[i]);
}
#endif
+std::string vectorToString(const std::vector<std::string>& strings) {
+ std::string result = "{";
+ bool first = true;
+ for (auto element : strings) {
+ if (first) {
+ first = false;
+ } else {
+ result += ", ";
+ }
+ result += "\"";
+ result += element;
+ result += "\"";
+ }
+ result += "}";
+ return result;
+}
+
+UBool IntlTest::assertEquals(const char* message,
+ const std::vector<std::string>& expected,
+ const std::vector<std::string>& actual) {
+ if (expected != actual) {
+ std::string expectedAsString = vectorToString(expected);
+ std::string actualAsString = vectorToString(actual);
+ errln((UnicodeString)"FAIL: " + message +
+ "; got " + actualAsString.c_str() +
+ "; expected " + expectedAsString.c_str());
+ return FALSE;
+ }
+#ifdef VERBOSE_ASSERTIONS
+ else {
+ logln((UnicodeString)"Ok: " + message + "; got " + vectorToString(actual).c_str());
+ }
+#endif
+ return TRUE;
+}
+
static char ASSERT_BUF[256];
static const char* extractToAssertBuf(const UnicodeString& message) {
const UnicodeSet& actual) {
return assertEquals(extractToAssertBuf(message), expected, actual);
}
+UBool IntlTest::assertEquals(const UnicodeString& message,
+ const std::vector<std::string>& expected,
+ const std::vector<std::string>& actual) {
+ return assertEquals(extractToAssertBuf(message), expected, actual);
+}
#if !UCONFIG_NO_FORMATTING
UBool IntlTest::assertEquals(const UnicodeString& message,