mirror of
https://gitee.com/openharmony/arkcompiler_runtime_core
synced 2025-02-26 01:47:48 +00:00
Fix codecheck of unit tests
Issue:https://gitee.com/openharmony/arkcompiler_runtime_core/issues/I7TLEU Signed-off-by: ctw-ian <chentingwei2@huawei.com> Change-Id: I76742260f725fa669287554013bb2ad946690792
This commit is contained in:
parent
717a1f7d95
commit
f6c174e566
@ -123,7 +123,7 @@ HWTEST_F(CodegenTest, codegen_test_003, TestSize.Level1)
|
||||
* @tc.name: codegen_test_004
|
||||
* @tc.desc: Verify the EmitJump function.
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issueNumber
|
||||
* @tc.require: issueNumber
|
||||
*/
|
||||
HWTEST_F(CodegenTest, codegen_test_004, TestSize.Level1)
|
||||
{
|
||||
@ -139,8 +139,8 @@ HWTEST_F(CodegenTest, codegen_test_004, TestSize.Level1)
|
||||
EXPECT_NE(graph, nullptr);
|
||||
for (auto bb : graph->GetBlocksRPO()) {
|
||||
EXPECT_NE(bb, nullptr);
|
||||
for(auto inst : bb->AllInsts()){
|
||||
if(inst->GetOpcode() == Opcode::IfImm){
|
||||
for (auto inst : bb->AllInsts()) {
|
||||
if (inst->GetOpcode() == Opcode::IfImm) {
|
||||
status = true;
|
||||
Function *function = nullptr;
|
||||
BytecodeOptIrInterface *interface = nullptr;
|
||||
@ -175,7 +175,7 @@ HWTEST_F(CodegenTest, codegen_test_005, TestSize.Level1)
|
||||
|
||||
EXPECT_NE(graph, nullptr);
|
||||
for (auto bb : graph->GetBlocksRPO()) {
|
||||
for(auto inst : bb->AllInsts()) {
|
||||
for (auto inst : bb->AllInsts()) {
|
||||
if (inst->GetOpcode() != Opcode::Constant) {
|
||||
continue;
|
||||
}
|
||||
@ -214,7 +214,7 @@ HWTEST_F(CodegenTest, codegen_test_005, TestSize.Level1)
|
||||
EXPECT_FALSE(graph_visitor.GetResult().empty());
|
||||
EXPECT_EQ(graph_visitor.GetResult().back().opcode, panda::pandasm::Opcode::STA);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
EXPECT_TRUE(status);
|
||||
}
|
||||
@ -275,7 +275,7 @@ HWTEST_F(CodegenTest, codegen_test_007, TestSize.Level1)
|
||||
EXPECT_NE(graph, nullptr);
|
||||
for (auto bb : graph->GetVectorBlocks()) {
|
||||
EXPECT_NE(bb, nullptr);
|
||||
for(auto inst1 : bb->AllInsts()) {
|
||||
for (auto inst1 : bb->AllInsts()) {
|
||||
if (inst1->GetOpcode() != Opcode::LoadString) {
|
||||
continue;
|
||||
}
|
||||
@ -291,8 +291,8 @@ HWTEST_F(CodegenTest, codegen_test_007, TestSize.Level1)
|
||||
auto inst = inst1->CastToLoadString();
|
||||
inst->SetTypeId(2);
|
||||
|
||||
unsigned index = 5; // 5: It's a random number
|
||||
unsigned size = 6; // 6: It's a random number
|
||||
unsigned index = 5; // 5: It's a random number
|
||||
unsigned size = 6; // 6: It's a random number
|
||||
User user(true, index, size);
|
||||
inst->AddUser(&user);
|
||||
|
||||
@ -432,7 +432,7 @@ HWTEST_F(CodegenTest, codegen_test_012, TestSize.Level1)
|
||||
* @tc.name: codegen_test_013
|
||||
* @tc.desc: Verify the GetMethodFullName function.
|
||||
* @tc.type: FUNC
|
||||
* @tc.require: issueNumber
|
||||
* @tc.require: issueNumber
|
||||
*/
|
||||
HWTEST_F(CodegenTest, codegen_test_013, TestSize.Level1)
|
||||
{
|
||||
@ -536,7 +536,7 @@ HWTEST_F(CodegenTest, codegen_test_015, TestSize.Level1)
|
||||
|
||||
for (auto bb : graph->GetBlocksRPO()) {
|
||||
EXPECT_NE(bb, nullptr);
|
||||
if(bb->IsTryBegin()){
|
||||
if (bb->IsTryBegin()) {
|
||||
status = true;
|
||||
graph->AppendTryBeginBlock(bb);
|
||||
}
|
||||
|
@ -74,7 +74,7 @@ public:
|
||||
}
|
||||
|
||||
template <class Callback>
|
||||
void TestBuildGraphFromFunc(pandasm::Program &prog, const char *method_name,
|
||||
void TestBuildGraphFromFunc(pandasm::Program &prog, const char *method_name,
|
||||
pandasm::AsmEmitter::PandaFileToPandaAsmMaps &maps, bytecodeopt::BytecodeOptIrInterface &ir_interface,
|
||||
const Callback &cb)
|
||||
{
|
||||
|
@ -15,50 +15,51 @@
|
||||
|
||||
|
||||
function func1() {
|
||||
let a = 1.5;
|
||||
try {
|
||||
a += 1;
|
||||
} catch(e) {
|
||||
a++;
|
||||
}
|
||||
let a = 1.5;
|
||||
try {
|
||||
a += 1;
|
||||
} catch (e) {
|
||||
a++;
|
||||
return a;
|
||||
}
|
||||
a++;
|
||||
return a;
|
||||
}
|
||||
|
||||
function func2(a, b, c) {
|
||||
var a = 1;
|
||||
if (a) {
|
||||
return a;
|
||||
}
|
||||
else
|
||||
a += 1;
|
||||
var a = 1;
|
||||
if (a) {
|
||||
return a;
|
||||
}
|
||||
else {
|
||||
a += 1;
|
||||
}
|
||||
}
|
||||
|
||||
function func3(a, b, c, d, e) {
|
||||
return a + b + c + d + e;
|
||||
return a + b + c + d + e;
|
||||
}
|
||||
|
||||
function func4(x, y) {
|
||||
var a = x + y;
|
||||
var b = x - y;
|
||||
var c = x * y;
|
||||
var d = x / y;
|
||||
var e = x % y;
|
||||
return func3(e, d, c, b, a);
|
||||
var a = x + y;
|
||||
var b = x - y;
|
||||
var c = x * y;
|
||||
var d = x / y;
|
||||
var e = x % y;
|
||||
return func3(e, d, c, b, a);
|
||||
}
|
||||
|
||||
function func5(i, j, l) {
|
||||
for (var i = 0; i <= 4; i++) {
|
||||
for (var j = 0; j <= 4; j++) {
|
||||
for(var k = 1; k <= 2; k++){
|
||||
System.out.printf(Loadstring);
|
||||
}
|
||||
}
|
||||
func4(x, y);
|
||||
for (var i = 0; i <= 4; i++) {
|
||||
for (var j = 0; j <= 4; j++) {
|
||||
for (var k = 1; k <= 2; k++) {
|
||||
System.out.printf(Loadstring);
|
||||
}
|
||||
}
|
||||
func4(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
function func6()
|
||||
{
|
||||
return "hello world";
|
||||
return 'hello world';
|
||||
}
|
@ -15,25 +15,23 @@
|
||||
|
||||
|
||||
try {
|
||||
try {
|
||||
a = 1;
|
||||
} catch(e) {
|
||||
a;
|
||||
}
|
||||
if(a == "") {
|
||||
throw "null";
|
||||
}
|
||||
if(x > 100) {
|
||||
throw "max";
|
||||
} else {
|
||||
throw "min";
|
||||
}
|
||||
try {
|
||||
a = 1;
|
||||
} catch (e) {
|
||||
a;
|
||||
}
|
||||
if (a == '') {
|
||||
throw 'null';
|
||||
}
|
||||
if (x > 100) {
|
||||
throw 'max';
|
||||
} else {
|
||||
throw 'min';
|
||||
}
|
||||
}
|
||||
catch(err) {
|
||||
func0(a, 10);
|
||||
catch (err) {
|
||||
func0(a, 10);
|
||||
}
|
||||
finally {
|
||||
console.log("error");
|
||||
}
|
||||
|
||||
|
||||
console.log('error');
|
||||
}
|
@ -239,7 +239,7 @@ HWTEST_F(CompilerGraphTest, graph_test_007, TestSize.Level1)
|
||||
std::string pfile = GRAPH_TEST_ABC_DIR "moduleTryCatch.abc";
|
||||
const char *test_method_name = "func_main_0";
|
||||
bool status = false;
|
||||
graph_test_.TestBuildGraphFromFile(pfile,
|
||||
graph_test_.TestBuildGraphFromFile(pfile,
|
||||
[&test_method_name, &out, &status](Graph* graph, std::string &method_name) {
|
||||
if (test_method_name != method_name) {
|
||||
return;
|
||||
|
@ -11,7 +11,7 @@
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
try {
|
||||
@ -29,6 +29,7 @@ function func2(a) {
|
||||
if (a) {
|
||||
return a;
|
||||
}
|
||||
else
|
||||
else {
|
||||
a += 1;
|
||||
}
|
||||
}
|
@ -43,7 +43,7 @@ function func2(x, y) {
|
||||
var car = ["B", "V", "p", "F", "A"];
|
||||
var text = "";
|
||||
var i;
|
||||
for (i = 0; i < 5; i++) {
|
||||
for (i = 0; i < 5; i++) {
|
||||
text += car[i] + x + y;
|
||||
}
|
||||
return text;
|
||||
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
a = 1;
|
||||
} catch (e) {
|
||||
@ -39,7 +39,7 @@ finally {
|
||||
var car = ["B", "V", "p", "F", "A"];
|
||||
var text = "";
|
||||
var i;
|
||||
for (i = 0; i < 5; i++) {
|
||||
for (i = 0; i < 5; i++) {
|
||||
text += car[i] + x + y;
|
||||
}
|
||||
|
||||
@ -69,9 +69,9 @@ function func1(x, y) {
|
||||
i++;
|
||||
}
|
||||
while (i < 5);
|
||||
}
|
||||
}
|
||||
|
||||
function func2(x, y) {
|
||||
function func2(x, y) {
|
||||
var arr = ["B", "V", "p", "F", "A"];
|
||||
for (let x of arr) {
|
||||
y += x;
|
||||
@ -82,4 +82,4 @@ function func1(x, y) {
|
||||
y += x;
|
||||
}
|
||||
return y;
|
||||
}
|
||||
}
|
@ -14,7 +14,7 @@
|
||||
*/
|
||||
|
||||
|
||||
try {
|
||||
try {
|
||||
try {
|
||||
a = 1;
|
||||
} catch (e) {
|
||||
@ -39,7 +39,7 @@ finally {
|
||||
var car = ["B", "V", "p", "F", "A"];
|
||||
var text = "";
|
||||
var i;
|
||||
for (i = 0; i < 5; i++) {
|
||||
for (i = 0; i < 5; i++) {
|
||||
text += car[i] + x + y;
|
||||
}
|
||||
function func0(x, y) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user