From 65bd76a5ce85b609e74731a38f3f066432683b13 Mon Sep 17 00:00:00 2001 From: tastytea Date: Sun, 1 Apr 2018 05:03:50 +0200 Subject: [PATCH] Added a basic Easy-test --- tests/test_02_easy_get_public_timeline.cpp | 27 ++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 tests/test_02_easy_get_public_timeline.cpp diff --git a/tests/test_02_easy_get_public_timeline.cpp b/tests/test_02_easy_get_public_timeline.cpp new file mode 100644 index 0000000..8da6c7d --- /dev/null +++ b/tests/test_02_easy_get_public_timeline.cpp @@ -0,0 +1,27 @@ +/* This file is part of mastodon-cpp. + */ + +#include +#include +#include "mastodon-cpp.hpp" +#include "easy/easy.hpp" +#include "easy/status.hpp" + +int main(int argc, char *argv[]) +{ + Mastodon::Easy test("botsin.space", ""); + std::string answer; + std::uint16_t ret = test.get(Mastodon::API::v1::timelines_public, + { { "limit", { "1" } } }, answer); + if (ret == 0) + { + Mastodon::Easy::Status status(answer); + if (status.valid()) + { + return 0; + } + } + + std::cout << ret << ": " << answer << '\n'; + return 1; +}