Home | History | Annotate | Download | only in aidl
      1 /*
      2  * Copyright (C) 2015, The Android Open Source Project
      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 #include <memory>
     18 
     19 #include <gtest/gtest.h>
     20 
     21 #include "type_cpp.h"
     22 
     23 namespace android {
     24 namespace aidl {
     25 namespace cpp {
     26 
     27 class CppTypeNamespaceTest : public ::testing::Test {
     28  protected:
     29   void SetUp() override {
     30     types_.Init();
     31   }
     32   TypeNamespace types_;
     33 };
     34 
     35 TEST_F(CppTypeNamespaceTest, HasSomeBasicTypes) {
     36   EXPECT_TRUE(types_.HasTypeByCanonicalName("byte"));
     37   EXPECT_TRUE(types_.HasTypeByCanonicalName("int"));
     38   EXPECT_TRUE(types_.HasTypeByCanonicalName("long"));
     39   EXPECT_TRUE(types_.HasTypeByCanonicalName("float"));
     40   EXPECT_TRUE(types_.HasTypeByCanonicalName("double"));
     41   EXPECT_TRUE(types_.HasTypeByCanonicalName("boolean"));
     42   EXPECT_TRUE(types_.HasTypeByCanonicalName("char"));
     43   EXPECT_TRUE(types_.HasTypeByCanonicalName("String"));
     44 }
     45 
     46 TEST_F(CppTypeNamespaceTest, SupportsListString) {
     47   EXPECT_TRUE(
     48       types_.HasTypeByCanonicalName("java.util.List<java.lang.String>"));
     49 }
     50 
     51 }  // namespace cpp
     52 }  // namespace android
     53 }  // namespace aidl
     54