11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ciconst common = require('../../common'); 31cb0ef41Sopenharmony_ciconst assert = require('assert'); 41cb0ef41Sopenharmony_ci 51cb0ef41Sopenharmony_ci// Testing api calls for arrays 61cb0ef41Sopenharmony_ciconst test_dataview = require(`./build/${common.buildType}/test_dataview`); 71cb0ef41Sopenharmony_ci 81cb0ef41Sopenharmony_ci// Test for creating dataview 91cb0ef41Sopenharmony_ci{ 101cb0ef41Sopenharmony_ci const buffer = new ArrayBuffer(128); 111cb0ef41Sopenharmony_ci const template = Reflect.construct(DataView, [buffer]); 121cb0ef41Sopenharmony_ci 131cb0ef41Sopenharmony_ci const theDataview = test_dataview.CreateDataViewFromJSDataView(template); 141cb0ef41Sopenharmony_ci assert.ok(theDataview instanceof DataView, 151cb0ef41Sopenharmony_ci `Expect ${theDataview} to be a DataView`); 161cb0ef41Sopenharmony_ci} 171cb0ef41Sopenharmony_ci 181cb0ef41Sopenharmony_ci// Test for creating dataview with invalid range 191cb0ef41Sopenharmony_ci{ 201cb0ef41Sopenharmony_ci const buffer = new ArrayBuffer(128); 211cb0ef41Sopenharmony_ci assert.throws(() => { 221cb0ef41Sopenharmony_ci test_dataview.CreateDataView(buffer, 10, 200); 231cb0ef41Sopenharmony_ci }, RangeError); 241cb0ef41Sopenharmony_ci} 25