Home | History | Annotate | Download | only in meta
      1 #!/usr/bin/env python3
      2 #  Copyright 2016 Google Inc. 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 from fruit_test_common import *
     17 
     18 COMMON_DEFINITIONS = '''
     19     #define IN_FRUIT_CPP_FILE 1
     20     
     21     #include "meta/common.h"
     22     #include <fruit/impl/meta/algos.h>
     23     '''
     24 
     25 def test_HasDuplicates():
     26     source = '''
     27         int main() {
     28           AssertNot(HasDuplicates(Vector<>));
     29           AssertNot(HasDuplicates(Vector<Int<0>>));
     30           AssertNot(HasDuplicates(Vector<Int<0>, Int<1>>));
     31           Assert(HasDuplicates(Vector<Int<0>, Int<0>>));
     32           Assert(HasDuplicates(Vector<Int<2>, Int<0>, Int<1>, Int<0>, Int<3>>));
     33         }
     34         '''
     35     expect_success(
     36         COMMON_DEFINITIONS,
     37         source,
     38         locals())
     39 
     40 if __name__== '__main__':
     41     main(__file__)
     42