+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/********************************************************************
* COPYRIGHT:
- * Copyright (c) 1997-2014, International Business Machines Corporation and
+ * Copyright (c) 1997-2016, International Business Machines Corporation and
* others. All Rights Reserved.
********************************************************************/
#include "testutil.h"
#include "cmemory.h"
-#define ARRAY_LENGTH(array) ((int32_t)(sizeof array / sizeof array[0]))
-
CollationRegressionTest::CollationRegressionTest()
{
UErrorCode status = U_ZERO_ERROR;
c->setStrength(Collator::IDENTICAL);
c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
- compareArray(*c, decomp, ARRAY_LENGTH(decomp));
+ compareArray(*c, decomp, UPRV_LENGTHOF(decomp));
delete c;
}
{0xFB4F, 0}, {0x3d, 0}, {0x05D0, 0x05DC} // Alef-Lamed vs. Alef, Lamed
};
- compareArray(*c, tests, ARRAY_LENGTH(tests));
+ compareArray(*c, tests, UPRV_LENGTHOF(tests));
delete c;
}
};
c->setStrength(Collator::TERTIARY);
- compareArray(*c, tertiary, ARRAY_LENGTH(tertiary));
+ compareArray(*c, tertiary, UPRV_LENGTHOF(tertiary));
/*
String[] secondary = {
};
c->setStrength(Collator::PRIMARY);
- compareArray(*c, secondary, ARRAY_LENGTH(secondary));
+ compareArray(*c, secondary, UPRV_LENGTHOF(secondary));
delete c;
}
{0x70, 0x00EA, 0x63, 0x68, 0x65, 0}, {0x3c, 0}, {0x70, 0x00E9, 0x63, 0x68, 0x00E9, 0}
};
- compareArray(*c, tests, ARRAY_LENGTH(tests));
+ compareArray(*c, tests, UPRV_LENGTHOF(tests));
delete c;
}
{0x00E0, 0}, {0x3e, 0}, {0x01FA, 0}
};
- compareArray(*c, tests, ARRAY_LENGTH(tests));
+ compareArray(*c, tests, UPRV_LENGTHOF(tests));
delete c;
}
{0x59, 0}, {0x3c, 0}, {0x75, 0x0308, 0}, // Y < u-umlaut
};
- compareArray(*c, tests, ARRAY_LENGTH(tests));
+ compareArray(*c, tests, UPRV_LENGTHOF(tests));
delete c;
}
{0x31, 0x32, 0x33, 0}, {0x3d, 0}, {0x31, 0x32, 0x33, 0x0001, 0} // 1 2 3 = 1 2 3 ctrl-A
};
- compareArray(*c, tests, ARRAY_LENGTH(tests));
+ compareArray(*c, tests, UPRV_LENGTHOF(tests));
delete c;
}
{0x00B5, 0}, {0x3d, 0}, {0x03BC, 0}
};
- compareArray(*c, tests, ARRAY_LENGTH(tests));
+ compareArray(*c, tests, UPRV_LENGTHOF(tests));
delete c;
}
{0x03D4, 0}, {0x3d, 0}, {0x03AB, 0}
};
- compareArray(*c, tests, ARRAY_LENGTH(tests));
+ compareArray(*c, tests, UPRV_LENGTHOF(tests));
delete c;
}
{0x66, 0x69, 0x6c, 0x65, 0}, {0x3c, 0}, {0x66, 0x69, 0x6c, 0x65, 0x61, 0x63, 0x63, 0x65, 0x73, 0x73, 0}
};
- compareArray(*c, tests, ARRAY_LENGTH(tests));
+ compareArray(*c, tests, UPRV_LENGTHOF(tests));
delete c;
}
};
c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
- compareArray(*c, test1, ARRAY_LENGTH(test1));
+ compareArray(*c, test1, UPRV_LENGTHOF(test1));
// From UTR #15:
// *In earlier versions of Unicode, jamo characters like ksf
//obsolete- };
//obsolete-
//obsolete- c->setDecomposition(Normalizer::DECOMP_COMPAT);
-//obsolete- compareArray(*c, test2, ARRAY_LENGTH(test2));
+//obsolete- compareArray(*c, test2, UPRV_LENGTHOF(test2));
delete c;
}
{0x65, 0x0300, 0x0301, 0}, {0x3c, 0}, {0x65, 0x0301, 0x0300, 0}
};
- compareArray(*c, test1, ARRAY_LENGTH(test1));
+ compareArray(*c, test1, UPRV_LENGTHOF(test1));
delete c;
}
{0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0}, {0x3c, 0}, {0x53, 0x74, 0x72, 0x69, 0x6e, 0x67, 0x42, 0x75, 0x66, 0x66, 0x65, 0x72, 0}
};
- compareArray(*en_us, test1, ARRAY_LENGTH(test1));
+ compareArray(*en_us, test1, UPRV_LENGTHOF(test1));
}
// @bug 4114077
};
c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_OFF, status);
- compareArray(*c, test1, ARRAY_LENGTH(test1));
+ compareArray(*c, test1, UPRV_LENGTHOF(test1));
static const UChar test2[][CollationRegressionTest::MAX_TOKEN_LEN] =
{
};
c->setAttribute(UCOL_NORMALIZATION_MODE, UCOL_ON, status);
- compareArray(*c, test2, ARRAY_LENGTH(test2));
+ compareArray(*c, test2, UPRV_LENGTHOF(test2));
delete c;
}
return;
}
- for (i = 0; i < sizeof(text1) / (CollationRegressionTest::MAX_TOKEN_LEN * sizeof(UChar)); i++) {
+ for (i = 0; i < UPRV_LENGTHOF(text1); i++) {
uint8_t key1[100], key2[100];
int32_t len1, len2;