aboutsummaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
Diffstat (limited to 'tests')
-rw-r--r--tests/main.cpp33
1 files changed, 17 insertions, 16 deletions
diff --git a/tests/main.cpp b/tests/main.cpp
index 647fdff..c5138e3 100644
--- a/tests/main.cpp
+++ b/tests/main.cpp
@@ -6,44 +6,45 @@
int main() {
std::vector<std::string> urls;
+ const char *str;
- urls.clear();
- QuickMedia::extract_urls("example.com", urls);
+ str = "example.com";
+ urls = QuickMedia::ranges_get_strings(str, QuickMedia::extract_urls(str));
assert_equals(urls.size(), 1);
assert_equals(urls[0], "example.com");
- urls.clear();
- QuickMedia::extract_urls("example.com, is where I like to go", urls);
+ str = "example.com, is where I like to go";
+ urls = QuickMedia::ranges_get_strings(str, QuickMedia::extract_urls(str));
assert_equals(urls.size(), 1);
assert_equals(urls[0], "example.com");
- urls.clear();
- QuickMedia::extract_urls("The website I like to go to is example.com", urls);
+ str = "The website I like to go to is example.com";
+ urls = QuickMedia::ranges_get_strings(str, QuickMedia::extract_urls(str));
assert_equals(urls.size(), 1);
assert_equals(urls[0], "example.com");
- urls.clear();
- QuickMedia::extract_urls("example.com. Is also a website", urls);
+ str = "example.com. Is also a website";
+ urls = QuickMedia::ranges_get_strings(str, QuickMedia::extract_urls(str));
assert_equals(urls.size(), 1);
assert_equals(urls[0], "example.com");
- urls.clear();
- QuickMedia::extract_urls("these. are. not. websites.", urls);
+ str = "these. are. not. websites.";
+ urls = QuickMedia::ranges_get_strings(str, QuickMedia::extract_urls(str));
assert_equals(urls.size(), 0);
- urls.clear();
- QuickMedia::extract_urls("This is not an url: example.", urls);
+ str = "This is not an url: example.";
+ urls = QuickMedia::ranges_get_strings(str, QuickMedia::extract_urls(str));
assert_equals(urls.size(), 0);
- urls.clear();
- QuickMedia::extract_urls("the.se/~#423-_/2f.no/3df a.re considered sub.websit.es", urls);
+ str = "the.se/~#423-_/2f.no/3df a.re considered sub.websit.es, this.is.not";
+ urls = QuickMedia::ranges_get_strings(str, QuickMedia::extract_urls(str));
assert_equals(urls.size(), 3);
assert_equals(urls[0], "the.se/~#423-_/2f.no/3df");
assert_equals(urls[1], "a.re");
assert_equals(urls[2], "sub.websit.es");
- urls.clear();
- QuickMedia::extract_urls("(see https://emojipedia.org/emoji/%23%EF%B8%8F%E2%83%A3/)", urls);
+ str = "(see https://emojipedia.org/emoji/%23%EF%B8%8F%E2%83%A3/)";
+ urls = QuickMedia::ranges_get_strings(str, QuickMedia::extract_urls(str));
assert_equals(urls.size(), 1);
assert_equals(urls[0], "https://emojipedia.org/emoji/%23%EF%B8%8F%E2%83%A3/");
return 0;