summaryrefslogtreecommitdiff
path: root/test/string/rollingHash.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'test/string/rollingHash.cpp')
-rw-r--r--test/string/rollingHash.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/string/rollingHash.cpp b/test/string/rollingHash.cpp
index 0491bc0..a9dace5 100644
--- a/test/string/rollingHash.cpp
+++ b/test/string/rollingHash.cpp
@@ -3,7 +3,7 @@
string thueMorse(ll n) {
string res = "a";
- while (sz(res) < n) {
+ while (ssize(res) < n) {
string tmp = res;
for (char& c : tmp) c ^= 1;
res += tmp;
@@ -12,7 +12,7 @@ string thueMorse(ll n) {
}
auto getHash(const string& s) {
- return Hash(s)(0, sz(s));
+ return Hash(s)(0, ssize(s));
}
void testThueMorse() {
@@ -20,13 +20,13 @@ void testThueMorse() {
set<string> expected;
string s = thueMorse(1000);
Hash h(s);
- for (int l = 0; l < sz(s); l++) {
- for (int r = l + 1; r <= sz(s); r++) {
+ for (int l = 0; l < ssize(s); l++) {
+ for (int r = l + 1; r <= ssize(s); r++) {
got.insert(h(l, r));
expected.insert(s.substr(l, r - l));
}
}
- if (sz(got) != sz(expected)) cerr << "error: thueMorse" << FAIL;
+ if (ssize(got) != ssize(expected)) cerr << "error: thueMorse" << FAIL;
cerr << "thueMorse: ok" << endl;
}
@@ -43,13 +43,13 @@ void testSmall() {
auto dfs = [&](auto&& self, string pref)->void {
expected++;
got.insert(getHash(pref));
- if(sz(pref) >= 5) return;
+ if(ssize(pref) >= 5) return;
for (char c = 'a'; c <= 'z'; c++) {
self(self, pref + c);
}
};
dfs(dfs, "");
- if (sz(got) != expected) cerr << "error: small" << FAIL;
+ if (ssize(got) != expected) cerr << "error: small" << FAIL;
cerr << "small: ok" << endl;
}
@@ -58,13 +58,13 @@ void stress_test() {
set<string> expected;
string s = Random::string(1000, "abc");
Hash h(s);
- for (int l = 0; l < sz(s); l++) {
- for (int r = l + 1; r <= sz(s); r++) {
+ for (int l = 0; l < ssize(s); l++) {
+ for (int r = l + 1; r <= ssize(s); r++) {
got.insert(h(l, r));
expected.insert(s.substr(l, r - l));
}
}
- if (sz(got) != sz(expected)) cerr << "error: stress test" << FAIL;
+ if (ssize(got) != ssize(expected)) cerr << "error: stress test" << FAIL;
cerr << "stress test: ok" << endl;
}