b3e6285615efc4286ef3fe8fd19abd465829d7f2
[framework/web/wrt-commons.git] / tests / dpl / core / test_type_list.cpp
1 /*
2  * Copyright (c) 2011 Samsung Electronics Co., Ltd All Rights Reserved
3  *
4  *    Licensed under the Apache License, Version 2.0 (the "License");
5  *    you may not use this file except in compliance with the License.
6  *    You may obtain a copy of the License at
7  *
8  *        http://www.apache.org/licenses/LICENSE-2.0
9  *
10  *    Unless required by applicable law or agreed to in writing, software
11  *    distributed under the License is distributed on an "AS IS" BASIS,
12  *    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  *    See the License for the specific language governing permissions and
14  *    limitations under the License.
15  */
16 /**
17  * @file       test_type_list.cpp
18  * @author     Krzysztof Jackiewicz (k.jackiewicz@samsung.com)
19  * @version    0.1
20  * @brief
21  */
22
23 #include <dpl/test/test_runner.h>
24 #include <dpl/type_list.h>
25
26 RUNNER_TEST_GROUP_INIT(DPL)
27
28 /*
29 Name: TypeList_TypeCount
30 Description: tests size of typelist idiom
31 Expected: size should match
32 */
33 RUNNER_TEST(TypeList_TypeCount)
34 {
35     typedef DPL::TypeListDecl<int, char, int[64]>::Type TestTypeList1;
36     typedef DPL::TypeListDecl<int>::Type TestTypeList2;
37     typedef DPL::TypeListDecl<>::Type TestTypeList3;
38     typedef DPL::TypeList<int, TestTypeList1> TestTypeList4;
39
40     RUNNER_ASSERT(TestTypeList1::Size == 3);
41     RUNNER_ASSERT(TestTypeList2::Size == 1);
42     RUNNER_ASSERT(TestTypeList3::Size == 0);
43     RUNNER_ASSERT(TestTypeList4::Size == 4);
44
45     RUNNER_ASSERT(TestTypeList4::Tail::Tail::Size == 2);
46 }