1 //===-- FormatManagerTests.cpp --------------------------------------------===//
2 //
3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4 // See https://llvm.org/LICENSE.txt for license information.
5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6 //
7 //===----------------------------------------------------------------------===//
8 
9 #include "lldb/DataFormatters/FormatManager.h"
10 
11 #include "gtest/gtest.h"
12 
13 using namespace lldb;
14 using namespace lldb_private;
15 
TEST(FormatManagerTests,CompatibleLangs)16 TEST(FormatManagerTests, CompatibleLangs) {
17   std::vector<LanguageType> candidates = {eLanguageTypeC_plus_plus,
18                                           eLanguageTypeObjC};
19   EXPECT_EQ(FormatManager::GetCandidateLanguages(eLanguageTypeC), candidates);
20   EXPECT_EQ(FormatManager::GetCandidateLanguages(eLanguageTypeC89), candidates);
21   EXPECT_EQ(FormatManager::GetCandidateLanguages(eLanguageTypeC99), candidates);
22   EXPECT_EQ(FormatManager::GetCandidateLanguages(eLanguageTypeC11), candidates);
23 
24   EXPECT_EQ(FormatManager::GetCandidateLanguages(eLanguageTypeC_plus_plus),
25             candidates);
26   EXPECT_EQ(FormatManager::GetCandidateLanguages(eLanguageTypeC_plus_plus_03),
27             candidates);
28   EXPECT_EQ(FormatManager::GetCandidateLanguages(eLanguageTypeC_plus_plus_11),
29             candidates);
30   EXPECT_EQ(FormatManager::GetCandidateLanguages(eLanguageTypeC_plus_plus_14),
31             candidates);
32 
33   candidates = {eLanguageTypeObjC};
34   EXPECT_EQ(FormatManager::GetCandidateLanguages(eLanguageTypeObjC),
35             candidates);
36 }
37