summaryrefslogtreecommitdiff
path: root/zenxml/unit_test.cpp
blob: a671c9ee25ae82b706ac3d958e4cf83d869cdaed (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
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));
}
}
bgstack15