[M73 Dev][Tizen] Fix compilation errors for TV profile
[platform/framework/web/chromium-efl.git] / base / traits_bag_unittest.nc
1 // Copyright 2018 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // This is a "No Compile Test" suite.
6 // http://dev.chromium.org/developers/testing/no-compile-tests
7
8 #include "base/traits_bag.h"
9
10 namespace base {
11
12 enum class RequiredTrait {
13   A,
14   B,
15   C
16 };
17
18 struct NotAValidTrait {};
19
20 struct TestTraits {
21   // List of traits that are valid inputs for the constructor below.
22   struct ValidTrait {
23     ValidTrait(RequiredTrait);
24   };
25
26   template <class... ArgTypes,
27             class CheckArgumentsAreValid = std::enable_if_t<
28                 trait_helpers::AreValidTraits<ValidTrait, ArgTypes...>::value>>
29   constexpr TestTraits(ArgTypes... args)
30       : required_trait(trait_helpers::GetEnum<RequiredTrait>(args...)) {}
31
32   const RequiredTrait required_trait;
33 };
34
35 #if defined(NCTEST_TRAITS_BAG_REQUIRED_TRAIT_NOT_SET)  // [r"The traits bag is missing a required trait."]
36 constexpr TestTraits traits = {};
37 #elif defined(NCTEST_TRAITS_BAG_INVALID_TRAIT)  // [r"no matching constructor for initialization of 'const base::TestTraits'"]
38 constexpr TestTraits traits = {RequiredTrait::A, NotAValidTrait{}};
39 #endif
40
41 }  // namespace base