commit - be734cf5e58ed36b967d5403df96a061b2126610
commit + 375aa2688f8b153c12ef87d6438da6656610bbd4
blob - 65402cd90a810a8d10d86b12a0d6ecf7d0c9eeea
blob + 2dd66474221c65f42ae309860b37b772d385120f
--- tests/test_parse_url.cc
+++ tests/test_parse_url.cc
namespace vostok
{
-int test_parse_url()
-{
- int ret = 0;
+TEST_START(test_parse_url)
zs_url_path_t zs_url_path;
-
IS_TRUE(parse_url(cut_null("gemini://host"), zs_url_path) == url_ok);
IS_TRUE(strcmp(zs_url_path.begin(), "") == 0);
IS_TRUE(parse_url(cut_null("gemini://host/a/b/../c/./d"), zs_url_path) == url_ok);
IS_TRUE(strcmp(zs_url_path.begin(), "a/c/d") == 0);
+TEST_END()
- if (ret == 0)
- std::cout << __FUNCTION__ << " successfully passed!" << std::endl;
-
- return ret;
-}
-
} // namespace vostok
blob - afce9cc5b57c18bc8ba16f4a33292f2baffe5471
blob + e48bd425a7637201b650636bd242e1ed7409bdcd
--- tests/tests.h
+++ tests/tests.h
#pragma once
-#define IS_TRUE(x) if(!(x)){std::cout<<__FUNCTION__<<" failed on line "<<__LINE__<<std::endl;ret=1;}
+#define TEST_START(name) \
+int name() \
+{ \
+ int ret = 0;
+
+#define IS_TRUE(x) \
+ if(!(x)) \
+ { \
+ std::cout<<__FUNCTION__<<" failed on line "<<__LINE__<<std::endl;\
+ ret=1;\
+ }
+
+#define TEST_END() \
+ if(ret == 0) \
+ std::cout << __FUNCTION__ << " successfully passed!" << std::endl; \
+ return ret; \
+}