mirror of
https://github.com/openharmony/ark_js_runtime.git
synced 2026-08-27 20:40:01 -04:00
Add Containers List And LinkedList
Description
1.To ensure the high performance of container classes, List and LinkedList is provided in ark.
2.modify Copyright 2021->2022.
3.fix containers.
Related issue
#I58XA9:Add Containers List And LinkedList.
Signed-off-by: chenqi <chenqi151@huawei.com>
This commit is contained in:
@@ -250,4 +250,29 @@ HWTEST_F_L0(JSAPIPlainArrayTest, PA_RemvoeAnrRemvoeAtAndSetValueAtAndGetValueAt)
|
||||
taggedValue = array->GetValueAt(lvalue);
|
||||
EXPECT_TRUE(JSTaggedValue::Equal(thread, value, JSHandle<JSTaggedValue>(thread, taggedValue)));
|
||||
}
|
||||
|
||||
HWTEST_F_L0(JSAPIPlainArrayTest, GetOwnProperty)
|
||||
{
|
||||
constexpr uint32_t DEFAULT_LENGTH = 8;
|
||||
ObjectFactory *factory = thread->GetEcmaVM()->GetFactory();
|
||||
JSHandle<JSAPIPlainArray> toor(thread, CreatePlainArray());
|
||||
JSMutableHandle<JSTaggedValue> key(thread, JSTaggedValue::Undefined());
|
||||
JSMutableHandle<JSTaggedValue> value(thread, JSTaggedValue::Undefined());
|
||||
|
||||
std::string plainArrayvalue("plainArrayvalue");
|
||||
for (uint32_t i = 0; i < DEFAULT_LENGTH; i++) {
|
||||
uint32_t ikey = 100 + i;
|
||||
std::string ivalue = plainArrayvalue + std::to_string(i);
|
||||
key.Update(JSTaggedValue(ikey));
|
||||
value.Update(factory->NewFromStdString(ivalue).GetTaggedValue());
|
||||
JSAPIPlainArray::Add(thread, toor, key, value);
|
||||
}
|
||||
// test GetOwnProperty
|
||||
int testInt = 100 + 1;
|
||||
JSHandle<JSTaggedValue> plainArrayKey1(thread, JSTaggedValue(testInt));
|
||||
EXPECT_TRUE(JSAPIPlainArray::GetOwnProperty(thread, toor, plainArrayKey1));
|
||||
testInt = 100 + 20;
|
||||
JSHandle<JSTaggedValue> plainArrayKey2(thread, JSTaggedValue(testInt));
|
||||
EXPECT_FALSE(JSAPIPlainArray::GetOwnProperty(thread, toor, plainArrayKey2));
|
||||
}
|
||||
} // namespace panda::test
|
||||
|
||||
Reference in New Issue
Block a user