MCPcopy Create free account
hub / github.com/Samsung/UTopia / TEST_F

Function TEST_F

tests/propanalysis/TestLoopAnalyzer.cpp:56–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54};
55
56TEST_F(TestLoopAnalyzer, AnalyzeP) {
57 const std::string CODE = "extern \"C\" {\n"
58 "void EXTERNAL();\n"
59 "void test_exitcond(int P) {\n"
60 " for (int i = 0; i < P; ++i) {\n"
61 " EXTERNAL();\n"
62 " }\n"
63 "}\n"
64 "void test_nested(int P) {\n"
65 " for (int i = 0; i < 10; ++i) {\n"
66 " for (int j = 0; j < P; ++j) {\n"
67 " EXTERNAL();\n"
68 " }\n"
69 " }\n"
70 "}\n"
71 "void test_exitcond_rel1(int P) {\n"
72 " int J = P + 10;\n"
73 " for (int i = 0; i < J; ++i) {\n"
74 " EXTERNAL();\n"
75 " }\n"
76 "}\n"
77#if LLVM_VERSION_MAJOR >= 12
78 "void test_exitcond_rel2(int P) {\n"
79 " for (int i = 0; i < P + 10; ++i) {\n"
80 " EXTERNAL();\n"
81 " }\n"
82 "}\n"
83#endif
84 "}";
85
86 auto IRAccess =
87 load(CODE, CompileHelper::SourceType_CPP, "PropAnalyzer", "-O0");
88 ASSERT_TRUE(IRAccess);
89
90 std::vector<std::string> Funcs = {
91 "test_exitcond",
92 "test_nested",
93 "test_exitcond_rel1",
94#if LLVM_VERSION_MAJOR >= 12
95 "test_exitcond_rel2"
96#endif
97 };
98 auto LAnalyzer = analyze(*IRAccess, Funcs);
99 ASSERT_TRUE(LAnalyzer);
100 ASSERT_TRUE(
101 checkTrue(true, 1, LAnalyzer->result(), *IRAccess, "test_exitcond", 0));
102 ASSERT_TRUE(
103 checkTrue(true, 2, LAnalyzer->result(), *IRAccess, "test_nested", 0));
104 ASSERT_TRUE(checkTrue(true, 1, LAnalyzer->result(), *IRAccess,
105 "test_exitcond_rel1", 0));
106#if LLVM_VERSION_MAJOR >= 12
107 ASSERT_TRUE(checkTrue(true, 1, LAnalyzer->result(), *IRAccess,
108 "test_exitcond_rel2", 0));
109#endif
110}
111
112TEST_F(TestLoopAnalyzer, AnalyzeN) {
113 const std::string CODE = "extern \"C\" {\n"

Callers

nothing calls this directly

Calls 5

setMethod · 0.45
fromJsonMethod · 0.45
toJsonMethod · 0.45
hasMethod · 0.45
getMethod · 0.45

Tested by

no test coverage detected