mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-04-21 03:55:24 +00:00
LibJS: Add TypedArray.BYTES_PER_ELEMENT
This commit is contained in:
parent
bb6bc70c5b
commit
ddaab598a7
Notes:
sideshowbarker
2024-07-19 01:06:11 +09:00
Author: https://github.com/linusg Commit: https://github.com/SerenityOS/serenity/commit/ddaab598a76 Pull-request: https://github.com/SerenityOS/serenity/pull/4304
3 changed files with 10 additions and 0 deletions
|
@ -32,6 +32,7 @@
|
|||
namespace JS {
|
||||
|
||||
#define ENUMERATE_STANDARD_PROPERTY_NAMES(P) \
|
||||
P(BYTES_PER_ELEMENT) \
|
||||
P(BigInt) \
|
||||
P(Boolean) \
|
||||
P(E) \
|
||||
|
|
|
@ -65,6 +65,7 @@ namespace JS {
|
|||
NativeFunction::initialize(global_object); \
|
||||
define_property(vm.names.prototype, global_object.snake_name##_prototype(), 0); \
|
||||
define_property(vm.names.length, Value(1), Attribute::Configurable); \
|
||||
define_property(vm.names.BYTES_PER_ELEMENT, Value((i32)sizeof(Type)), 0); \
|
||||
} \
|
||||
Value ConstructorName::call() \
|
||||
{ \
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
test("basic functionality", () => {
|
||||
expect(Uint8Array.BYTES_PER_ELEMENT).toBe(1);
|
||||
expect(Uint16Array.BYTES_PER_ELEMENT).toBe(2);
|
||||
expect(Uint32Array.BYTES_PER_ELEMENT).toBe(4);
|
||||
expect(Int8Array.BYTES_PER_ELEMENT).toBe(1);
|
||||
expect(Int16Array.BYTES_PER_ELEMENT).toBe(2);
|
||||
expect(Int32Array.BYTES_PER_ELEMENT).toBe(4);
|
||||
});
|
Loading…
Add table
Reference in a new issue