diff options
author | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:23:19 +0200 |
---|---|---|
committer | Daniel Wilhelm <daniel@wili.li> | 2014-04-18 17:23:19 +0200 |
commit | 0887aee8c54d0ed51bb2031431e2bcdafebb4c6e (patch) | |
tree | 69537ceb9787bb25ac363cc4e6cdaf0804d78363 /zenxml/unit_test.cpp | |
parent | 5.12 (diff) | |
download | FreeFileSync-0887aee8c54d0ed51bb2031431e2bcdafebb4c6e.tar.gz FreeFileSync-0887aee8c54d0ed51bb2031431e2bcdafebb4c6e.tar.bz2 FreeFileSync-0887aee8c54d0ed51bb2031431e2bcdafebb4c6e.zip |
5.13
Diffstat (limited to 'zenxml/unit_test.cpp')
-rw-r--r-- | zenxml/unit_test.cpp | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/zenxml/unit_test.cpp b/zenxml/unit_test.cpp new file mode 100644 index 00000000..a671c9ee --- /dev/null +++ b/zenxml/unit_test.cpp @@ -0,0 +1,95 @@ +// ************************************************************************** +// * This file is part of the zenXML project. It is distributed under the * +// * Boost Software License: http://www.boost.org/LICENSE_1_0.txt * +// * Copyright (C) Zenju (zenju AT gmx DOT de) - All Rights Reserved * +// ************************************************************************** + +#include <set> +#include <map> +#include <deque> +#include <vector> +#include <list> +#include <utility> +#include "xml.h" + +using namespace zen; + +namespace +{ +void unit_test() +{ + class Dummy {}; + + //compile time checks only + + assert_static(!IsStlContainer<wchar_t> ::value); + assert_static(!IsStlContainer<char> ::value); + assert_static(!IsStlContainer<Dummy> ::value); + assert_static(!IsStlContainer<NullType> ::value); + assert_static(IsStlContainer<std::set <int>> ::value); + assert_static(IsStlContainer<std::deque <float>> ::value); + assert_static(IsStlContainer<std::list <size_t>> ::value); + assert_static((IsStlContainer<std::map <double, char>> ::value)); + assert_static((IsStlContainer<std::multimap<short, double>>::value)); + assert_static(IsStlContainer <std::vector <wchar_t>> ::value); + assert_static((IsStlPair <std::pair<int, double>> ::value)); + assert_static(!IsStlPair<Dummy> ::value); + + assert_static(!IsStringLike<Dummy>::value); + assert_static(!IsStringLike<int>::value); + assert_static(!IsStringLike<double>::value); + assert_static(!IsStringLike<short>::value); + assert_static(IsStringLike<char>::value); + assert_static(IsStringLike<const wchar_t>::value); + assert_static(IsStringLike<const char>::value); + assert_static(IsStringLike<wchar_t>::value); + assert_static(IsStringLike<char*>::value); + assert_static(IsStringLike<wchar_t*>::value); + assert_static(IsStringLike<char* const>::value); + assert_static(IsStringLike<wchar_t* const>::value); + assert_static(IsStringLike<const char*>::value); + assert_static(IsStringLike<const char* const>::value); + assert_static(IsStringLike<const wchar_t*>::value); + assert_static(IsStringLike<const wchar_t* const>::value); + assert_static(IsStringLike<const char[4]>::value); + assert_static(IsStringLike<const wchar_t[4]>::value); + assert_static(IsStringLike<char[4]>::value); + assert_static(IsStringLike<wchar_t[4]>::value); + assert_static(IsStringLike<std::string>::value); + assert_static(IsStringLike<std::wstring>::value); + assert_static(IsStringLike<const std::string>::value); + assert_static(IsStringLike<const std::wstring>::value); + assert_static(IsStringLike<const std::string&>::value); + assert_static(IsStringLike<const std::wstring&>::value); + assert_static(IsStringLike<std::string&>::value); + assert_static(IsStringLike<std::wstring&>::value); + + assert_static(!(IsSameType<GetCharType<int>::Type, char>::value)); + assert_static(!(IsSameType<GetCharType<double>::Type, char>::value)); + assert_static(!(IsSameType<GetCharType<short>::Type, char>::value)); + assert_static((IsSameType<GetCharType<char>::Type, char>::value)); + assert_static((IsSameType<GetCharType<wchar_t>::Type, wchar_t>::value)); + assert_static((IsSameType<GetCharType<const char>::Type, char>::value)); + assert_static((IsSameType<GetCharType<const wchar_t>::Type, wchar_t>::value)); + assert_static((IsSameType<GetCharType<char*>::Type, char>::value)); + assert_static((IsSameType<GetCharType<wchar_t*>::Type, wchar_t>::value)); + assert_static((IsSameType<GetCharType<char* const>::Type, char>::value)); + assert_static((IsSameType<GetCharType<wchar_t* const>::Type, wchar_t>::value)); + assert_static((IsSameType<GetCharType<const char*>::Type, char>::value)); + assert_static((IsSameType<GetCharType<const char* const>::Type, char>::value)); + assert_static((IsSameType<GetCharType<const wchar_t*>::Type, wchar_t>::value)); + assert_static((IsSameType<GetCharType<const wchar_t* const>::Type, wchar_t>::value)); + assert_static((IsSameType<GetCharType<const char[4]>::Type, char>::value)); + assert_static((IsSameType<GetCharType<const wchar_t[4]>::Type, wchar_t>::value)); + assert_static((IsSameType<GetCharType<char[4]>::Type, char>::value)); + assert_static((IsSameType<GetCharType<wchar_t[4]>::Type, wchar_t>::value)); + assert_static((IsSameType<GetCharType<std::string>::Type, char>::value)); + assert_static((IsSameType<GetCharType<std::wstring>::Type, wchar_t>::value)); + assert_static((IsSameType<GetCharType<const std::string>::Type, char>::value)); + assert_static((IsSameType<GetCharType<const std::wstring>::Type, wchar_t>::value)); + assert_static((IsSameType<GetCharType<const std::string&>::Type, char>::value)); + assert_static((IsSameType<GetCharType<const std::wstring&>::Type, wchar_t>::value)); + assert_static((IsSameType<GetCharType<std::string&>::Type, char>::value)); + assert_static((IsSameType<GetCharType<std::wstring&>::Type, wchar_t>::value)); +} +} |