aboutsummaryrefslogtreecommitdiffstats
path: root/unittest.cpp
diff options
context:
space:
mode:
authoripknHama <ipknhama@gmail.com>2014-04-03 05:31:32 +0900
committeripknHama <ipknhama@gmail.com>2014-04-03 08:29:22 +0900
commitd533a619c99c5ead31e86afd14dd9b017c63a9ab (patch)
tree3afcd6fd4ddb83ea623fbba374a011ff40042659 /unittest.cpp
parent5e5d69688435ffe8fc148af73fe33b029d9f6110 (diff)
downloadcrow-d533a619c99c5ead31e86afd14dd9b017c63a9ab.tar.gz
crow-d533a619c99c5ead31e86afd14dd9b017c63a9ab.zip
routing class working version
Diffstat (limited to 'unittest.cpp')
-rw-r--r--unittest.cpp23
1 files changed, 18 insertions, 5 deletions
diff --git a/unittest.cpp b/unittest.cpp
index 0cea0c7..66c58a0 100644
--- a/unittest.cpp
+++ b/unittest.cpp
@@ -5,23 +5,36 @@
using namespace flask;
using namespace flask::black_magic;
-template <int N> struct T{};
+template <int N> struct ThrowTest{};
int main()
{
try
{
- throw T<is_int("1<int>22",0)>();
+ throw ThrowTest<is_int("1<int>22",0)>();
}
- catch(T<0>)
+ catch(ThrowTest<0>)
{
}
try
{
- throw T<is_int("1<int>22",1)>();
+ throw ThrowTest<is_int("1<int>22",1)>();
}
- catch(T<1>)
+ catch(ThrowTest<1>)
{
}
+
+ {
+ constexpr Router r = Router("/");
+ static_assert(r.validate<void()>(), "Good handler");
+ static_assert(!r.validate<void(int)>(), "Bad handler - no int argument");
+ }
+ {
+ constexpr Router r = Router("/blog/<int>");
+ static_assert(!r.validate<void()>(), "Bad handler - need argument");
+ static_assert(r.validate<void(int)>(), "Good handler");
+ static_assert(!r.validate<void(std::string)>(), "Bad handler - int is not convertible to std::string");
+ static_assert(r.validate<void(double)>(), "Acceptable handler - int will be converted to double");
+ }
}