修改BitVector UT用例,新增边界值检测

Issue:https://gitee.com/openharmony/arkcompiler_ets_runtime/issues/IAYTUD

Signed-off-by: tangbin <2387440390@qq.com>
This commit is contained in:
tangbin 2024-10-22 10:45:51 +08:00
parent ec3b71e270
commit e2a7eb5331

View File

@ -232,6 +232,31 @@ HWTEST_F_L0(JSAPIBitVectorTest, Has_instance)
EXPECT_TRUE(res); EXPECT_TRUE(res);
} }
/**
* @tc.name: Has_Testboundary
* @tc.desc:
* @tc.type: FUNC
* @tc.require:
*/
HWTEST_F_L0(JSAPIBitVectorTest, Has_Testboundary)
{
uint32_t increasedLength = 8;
JSHandle<JSAPIBitVector> bitVector(thread, CreateBitVector());
for (uint32_t i = 0; i < increasedLength; i++) {
JSHandle<JSTaggedValue> value(thread, JSTaggedValue(1));
JSAPIBitVector::Push(thread, bitVector, value);
}
JSHandle<JSTaggedValue> value(thread, JSTaggedValue(0));
JSHandle<JSTaggedValue> value1(thread, JSTaggedValue(7));
bool res = JSAPIBitVector::Has(thread, bitVector, value, value, value1);
EXPECT_FALSE(res);
JSHandle<JSTaggedValue> value2(thread, JSTaggedValue(1));
JSHandle<JSTaggedValue> value3(thread, JSTaggedValue(8));
JSAPIBitVector::Push(thread, bitVector, value2);
res = JSAPIBitVector::Has(thread, bitVector, value2, value, value3);
EXPECT_TRUE(res);
}
/** /**
* @tc.name: SetBitsByRange * @tc.name: SetBitsByRange
* @tc.desc: * @tc.desc: