File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change 3
3
4
4
// IE 11 does not support Array.from, so we do it manually
5
5
export function uint32ArrayFrom ( a_lookUpTable : Array < number > ) : Uint32Array {
6
- if ( ! Array . from ) {
6
+ if ( ! Uint32Array . from ) {
7
7
const return_array = new Uint32Array ( a_lookUpTable . length )
8
8
let a_index = 0
9
9
while ( a_index < a_lookUpTable . length ) {
10
10
return_array [ a_index ] = a_lookUpTable [ a_index ]
11
+ a_index += 1
11
12
}
12
13
return return_array
13
14
}
Original file line number Diff line number Diff line change
1
+ // Copyright Amazon.com Inc. or its affiliates. All Rights Reserved.
2
+ // SPDX-License-Identifier: Apache-2.0
3
+
4
+ import { expect } from "chai" ;
5
+ import "mocha" ;
6
+ import { uint32ArrayFrom } from "../src/uint32ArrayFrom" ;
7
+
8
+ describe ( "uint32ArrayFrom" , ( ) => {
9
+ it ( "When given an empty array, should return an empty array" , ( ) => {
10
+ expect ( uint32ArrayFrom ( Array . of ( 0 ) ) )
11
+ . to
12
+ . eql ( Uint32Array . of ( 0 ) )
13
+ } )
14
+
15
+ it ( "Given a populated array, returns a valid Uint32 Array" , ( ) => {
16
+ expect ( uint32ArrayFrom ( Array . of ( 0x00000000 , 0xF26B8303 , 0xE13B70F7 ) ) )
17
+ . to
18
+ . eql ( Uint32Array . of ( 0 , 4067132163 , 3778769143 ) )
19
+ } )
20
+ } )
You can’t perform that action at this time.
0 commit comments