1/**
2 * Copyright (c) Glow Contributors. See CONTRIBUTORS file.
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 "glow/LLVMIRCodeGen/LLVMIRGen.h"
18#include "glow/LLVMIRCodeGen/AllocationsInfo.h"
19
20#include "glow/IR/IR.h"
21
22#include "gtest/gtest.h"
23
24using namespace glow;
25
26#ifndef GLOW_WITH_CPU
27#error "This should be compiled with the CPU backend"
28#endif
29
30/// Check that get/setMainEntryName behaves in a sane way.
31TEST(LLVMIRGen, getEntryName) {
32 IRFunction irfunc;
33 AllocationsInfo allocInfo;
34 LLVMIRGen llvmIRGen(&irfunc, allocInfo, "name", "");
35 EXPECT_EQ(llvmIRGen.getMainEntryName(), "name");
36
37 llvmIRGen.setMainEntryName("customName");
38 EXPECT_EQ(llvmIRGen.getMainEntryName(), "customName");
39
40 // If we set an empty name we get "main".
41 llvmIRGen.setMainEntryName("");
42 EXPECT_EQ(llvmIRGen.getMainEntryName(), "main");
43}
44