22 lines
501 B
C++
22 lines
501 B
C++
#include <Void/ShortUrl/ShortUrl.hpp>
|
|
#include <Void/ShortUrl/V2.hpp>
|
|
|
|
#include <memory>
|
|
|
|
int main()
|
|
{
|
|
using namespace Void::ShortUrl::V2;
|
|
auto repo = std::make_shared<InMemoryLinkRepository>();
|
|
auto provider = std::make_shared<LocalProvider>(repo);
|
|
V1Adapter v1{provider};
|
|
auto s = v1.shorten({.target_url = "https://example.com/pkg"});
|
|
if (!s.ok()) {
|
|
return 1;
|
|
}
|
|
auto r = v1.resolve({.key = s.key});
|
|
if (!r.ok() || r.target_url != "https://example.com/pkg") {
|
|
return 2;
|
|
}
|
|
return 0;
|
|
}
|